sendUserNotification issue on Android ("No Activity found to handle Intent") - detox

I'm attempting to use sentUserNotification on Android and I get the error below.
Test Failed: No Activity found to handle Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x24000000 pkg=com...****** (has extras) }
Is this something someone here has ran into before? I think my app is set up correctly (e.g. manifest has intent filter) but I'm wondering if there's something else I missed.
I'm on Detox v17.11.4.

Related

[JETPACK COMPOSE]: is there a way to restart whole app programmatically?

I need a way to make my app close and opens again. Or just restart everything inside of it.
Since the issue with my app can be fixed by closing app and opening again (When creating user the loading function to firebase the collection inside user document does not load for some reason)
Below code can do it:
val context = LocalContext.current
val packageManager: PackageManager = context.packageManager
val intent: Intent = packageManager.getLaunchIntentForPackage(context.packageName)!!
val componentName: ComponentName = intent.component!!
val restartIntent: Intent = Intent.makeRestartActivityTask(componentName)
context.startActivity(restartIntent)
Runtime.getRuntime().exit(0)
So... you could write ways to "restart everything", but I am going to strongly suggest not doing that. When building an app, you will run into edge cases. You will hit some failure states that you can't recover from. That happens. But, solving these cases by just "restarting" doesn't actually address the issue and will probably result in wonky and undesirable UX.
I would instead suggest you post here some steps to reproduce and debugging results.
Under what circumstance/flow does this document stop loading?
When it does happen, can you capture the call to Firebase where it is trying to load the document?
If so, what does that call look like?
Is it looking for the document in the correct place?
Can you show an example of the call when it fails and also what the database hierarchy looks like?
Can you show us a snippet of code where this is failing?
Without more information, this sounds more like a race condition - you might be trying to find the document before it is actually created and not handling the error path for when the document is not found. However, we would need to do some debugging to verify.

Fabric CrashLog only show the crashed .so file, doesn't show the detail line number

I have a native crash in my app,and the crash uploads,but it shows only the crashed .so file, don't have the detail crash line, just missing word in every line..
and when the crash happens,the studio can log the detail messages,like this.
my question is why Crashlytics don't show the detail crash log like AndroidStudio.
I found the solution
I have added this code into the build.gradle and it will get all the symbols from .so and I can found the crash report into firebase
crashlytics {
enableNdk true
//https://medium.com/#aungkyawmyint_26195/setting-up-ndk-crashlytics-android-11ad775676f7
//https://stackoverflow.com/questions/49511783/crashlytics-android-ndk-missing-all-symbols-in-crash-reports
manifestPath 'src/main/AndroidManifest.xml'
}
tasks.whenTaskAdded { task ->
if (task.name.startsWith('assemble')) {
task.finalizedBy "crashlyticsUploadSymbols" + task.name.substring('assemble'.length())
}
}
no need to do anything else
no need to fire this ./gradlew crashlyticsUploadSymbols{variant} command every time

React: Calling JS function after bridge has been destroyed --- How to find which function

I'm working on an update for our app. I've added a HeadlessTask and I've started seeing this warning in the console:
React: Calling JS function after bridge has been destroyed
How can I get the name of the function being executed?
From the error message I assume you're in java (react-native Android):
When you reload on react-native, what happens behind the scenes is that the react context is getting destroyed, and a new one is being created.
That error get's thrown whenever a react-native Native Module is trying to do work, by using the old react context (the one that was valid before the reload).
The last time I saw that error it also included an explanation as to which module tried to do work by using the old context. Typically it's the RCTDeviceEventEmitter module trying to send a message to javascript.
You'll have to open logcat on Android studio and read the full error message.
p.s: If you're using react-native-navigation in your project, (after you discover which module is the trouble maker by using the logcat), make sure to search on their issues as they are heavily using the native side of react-native android, and I've seen lot's of similar issues so far.
Never found a good solution to this until recently, so thought I'd put this here in case it helps someone else. I finally got around this error by doing the following:
public class RNMyNativeModule extends ReactContextBaseModule {
private ReactApplicationContext currentContext;
public RNMyNativeModule(ReactApplicationContext reactContext) {
super(reactContext);
currentContext = reactContext;
}
public void myEmitFn(String emitMe) {
currentContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit("RNMyNativeModuleEvent", emitMe);
}
}
Basically, in your module constructor, make sure you capture the currentContext in it's own variable, and just use that whenever you need it. Otherwise it gets overwritten and destroyed whenever a live reload happens, and getReactApplicationContext() is not actually giving you the current context.

Java-Cucumber : Feature file is not calling step definition file

Java-Cucumber : Feature file is not calling step definition file, I am trying in Intellij Idea tool. While clicking on Feature file steps(Given and Then) with CTRL button, it's redirecting to my step definition file, but while running it's throwing below error.
Connected to the target VM, address: '127.0.0.1:64966', transport: 'socket'
Undefined step: Given I am logged in to Intersect HE as user type "administrator"
Undefined step: Then I verify I have access the Intersect Help page
1 Scenarios (1 undefined)
2 Steps (2 undefined)
0m0.000s
You can implement missing steps with the snippets below:
Given("^I am logged in to Intersect HE as user type \"([^\"]*)\"$", (String arg1) -> {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
});
Then("^I verify I have access the Intersect Help page$", () -> {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
});Disconnected from the target VM, address: '127.0.0.1:64966', transport: 'socket'
enter code here
Process finished with exit code 0
After adding Glue, it's throwing other error "Exception in thread "main" cucumber.runtime.CucumberException: Failed to instantiate class stepDefinitions.LoginPageStepDefs".
The stepDefinitions file is added correctly, don't know why I am getting this error.
Console Error Description
Project Structure
Click on Edit Configuration as shown in below images.
Expand the drop down highlighted in the first image, then click on Edit Configurations option
In glue field Enter package name where all your step definitions are stored, as highlighted in below screenshot and save it.(verify feature file path also whether it is correct or not)
Let me know if you have any queries.
You have a class path problem. You need to share more of your setup for us to be able to help you.
Or you can make life easier and start with something that works. Clone the getting started project supplied by the Cucumber team. Then transform it to solve the problem you really want to solve. You are currently in the situation described by Gall's law:
A complex system that works is invariably found to have evolved from a
simple system that worked. A complex system designed from scratch
never works and cannot be patched up to make it work. You have to
start over with a working simple system.

Play Store Alert - Unsafe Implementation of onReceivedSSLError

One of my app in the play store has received this alert recently and I am completely lost as to what should be done to stop this alert. Please refer this.
Scenarios in my app:
There's a payment gateway involved in the app but the payment takes place through a webview and I am almost sure that this alert might be a result of those webviews.
Insights from Google :
As far as I've searched, I've come across the OnReceivedSslError more often and even the alert clearly states me to handle that method properly. But I am totally lost cause I haven't implemented that method in the first place.
Deeper surfing lead me to links like this,this and this too. The common thing that I found in all the links is that they were all referring to an older version of android. But I am using my minSDK as 14 which is Android 4.0 and above. So I got lost again. And I presume that this alert comes when we use a https in our webview.
So my questions are
How did I get this issue suddenly ?
This app has been in the play store for more than 6 months and this alert comes out of the blue !!! Absolutely no idea what happened !!
How do I reproduce the issue ?
I have tried many methods to reproduce this issue and I have implemented the SSL method as given in here:But nothing seems to be working.
Will this issue affect my payment or my app in any ways ?
How can I reproduce this issue to know more and how can i stop this alert ?
What have I tried ? :
As I had my doubts in older android versions, I designed an emulator with my minSDK but even in that my flow did not enter the method.
My doubt :
Could there be a not-so-genuine SSL which could've triggered this issue ?
Any ideas and insights on this issue will be much helpful. Thanks in advance. I just need to disable that alert, as simple as that.
It seems that Google has upgraded their security checks when you use WebViewClients. In many cases - no pun intended - developers fix an SSL problem like this:
#Override
public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) {
handler.proceed();
}
I had this issue too, and it seems that Lint doesn't implement this check yet. So it'll be quite difficult to reproduce. If you would like to see what happens, create a self-signed certificate, set-up a webserver using this certificate and connect a webviewclient to this "untrusted" webserver. If you don't handle the onReceivedSSLError, you'll either get an error, or nothing will happen in the webview (by default).
Will it affect your payment? I guess it would, IF the SSL certificate is untrusted, as the request to the url/api will be cancelled.
The above snippet would just ignore the SSL error, and provide the possibility for a MITM-attack. Have you tried intercepting the request, alerting the user, and allowing them to make the choice to continue?
e.g.
#Override
public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) {
//super.onReceivedSslError(view, handler, error);
AlertDialog.Builder builder = new AlertDialog.Builder(GroupsActivity.this);
builder.setTitle("Invalid/Untrusted certificate");
builder.setMessage("You're accessing a page with an untrusted or invalid certificate. Do you want to continue?");
builder.setNegativeButton("Cancel", new OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
handler.cancel();
Toast.makeText(GroupsActivity.this, "Request cancelled", Toast.LENGTH_LONG).show();
}
});
builder.setPositiveButton("Continue", new OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
handler.proceed();
}
});
}
To properly handle SSL certificate validation, change your code to invoke handler.proceed() whenever the certificate presented by the server meets your expectations, and invoke handler.cancel() otherwise.
onReceivedSslError() should notify user about error by Alert Dialog.
If you remove onReceivedSslError() then it will call by default handler.cancel() in case of SSL error.This also will work.