How to resolve ANR errors in Google Play Store - android

I have a Flutter app targeting Android.
Recently I started getting ANR errors in Google Play Console pre-launch report. I have not made any significant changes to my app to trigger this, so it seems it is something Google is suddenly doing differently.
Errors are below:
ANR in com.google.android.apps.messaging;PID: 12100;Broadcast of Intent { act=com.google.android.gms.phenotype.UPDATE flg=0x30 pkg=com.google.android.apps.messaging cmp=com.google.android.apps.messaging/com.google.apps.tiktok.experiments.phenotype.ConfigurationUpdatedReceiver_Receiver (has extras) };
ANR in com.google.android.dialer;PID: 8132;Broadcast of Intent { act=com.google.android.gms.phenotype.UPDATE flg=0x30 pkg=com.google.android.dialer cmp=com.google.android.dialer/com.google.apps.tiktok.experiments.phenotype.ConfigurationUpdatedReceiver_Receiver (has extras) };
ANR in com.google.android.apps.photos;PID: 9438;Broadcast of Intent {
act=com.google.android.gms.phenotype.UPDATE flg=0x30
pkg=com.google.android.apps.photos
cmp=com.google.android.apps.photos/com.google.android.libraries.phenotype.client.stable.PhenotypeUpdateBackgroundBroadcastReceiver
(has extras) };
ANR in com.google.android.apps.safetyhub;PID: 12115;Broadcast of
Intent { act=com.google.android.gms.phenotype.UPDATE flg=0x30
pkg=com.google.android.apps.safetyhub
cmp=com.google.android.apps.safetyhub/com.google.apps.tiktok.experiments.phenotype.ConfigurationUpdatedReceiver_Receiver
(has extras) };
My app does not use photos, dialer, or any kind of messaging. Not even sure what safety hub is.
Strangely, only one device is reporting these errors (Pixel 6 arm64 API 31). Other devices Google uses for testing are not reporting this. If there was something wrong with my app I suspect all devices would be getting it (or at least all devices on the same API). Or am I missing something here?
What can be done?

Looks like this is a problem with Google Play Store testing devices. The problems went away without me making any significant changes.

Related

How to determine live wallpaper intent is valid programmatically?

I add a live wallpaper feature in our app, but got some exception in firebase. I tested on our ten android devices and got no exception, I wonder if I can determine live wallpaper is supported in a specific device programmatically (I don't want to filter devices in Google Play Console, as it kick out tow much devices)? thanks.
Exception: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.service.wallpaper.CHANGE_LIVE_WALLPAPER (has extras) }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2067)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1727)
at android.app.Activity.startActivityForResult(Activity.java:5383)
at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java)
at android.app.Activity.startActivityForResult(Activity.java:5341)
at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java)
may be you could check if an activity is available before starting the intent.
if (intent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(intent);
}

IAB, onActivityResult() and the strange message "startActivity called from non-Activity context"

I am using OpenIAB to support in app purchasing in my app (OpenIAB uses google code to implement IAP for Google Play Store). The problem is that, sometimes, when i call launchPurchaseFlow(), the method onActivityResult() of my FragmentActivity is not called. Checking the logs, i have found that when this happens there is always the following msg:
W/ActivityManager( 319): startActivity called from non-Activity
context: forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent {
cmp=com.android.vending/com.google.android.finsky.billing.lightpurchase.IabV3Activity
(has extras) }
When this happens, i have to close the app. Usually it start working again after some time (i have absolutely no clue of why is it so).
I don't know why this message show up, since the context is obviously my activity (and in fact it works most of time). I have to say that the .apk installed on my device is an updated verion with respect to the apk uploaded in the beta version of the developer console and that i am using my google developer account to test IAP. This implies that i cannot make any real buy. However, this is not important, since i am testing the app.
These are my questions:
Is it true that starting an activity for result with
FLAG_ACTIVITY_NEW_TASK prevents onActivityResult() to be called?
How do you explain that message?
Regarding the first question, i have tested with launchMode=singleTask and the behaviour is the same of launchMode=singleTop.

Android / Cannot start app at boot on certain devices (e.g. Xiaomi)

I followed all the guidance found on SO to autostart app at boot time.
In my manifest, I have set the right permission (RECEIVE_BOOT_COMPLETED) and also declared my broadcast receiver: .BootReceiver picking up Android.Intent.Action.BOOT_COMPLETED.
I also launch my service in BootReceiver, this is very straightforward stuff.
The thing is, my app starts at boot time on certain devices (I hope most devices) but not on some of them. I have a Xiaomi phone that gives me the following error at boot time:
"Unable to launch app com..example/10120 for broadcast Intent {act=android.intent.action.BOOT_COMPLETE flg=0x8000010 (has extras) }: process is not permitted to autostart."
I am surprised to see this message, because I can see that the list of permissions includes running at startup.
There must be a way, because Whatsapp for instance is launched at boot time.
Any clue would be highly appreciated.
Same here. I tried to delete the file in the SD card ( but the system direct to internal storage ) by using the permission WRITE_EXTERNAL_STORAGE, and get the similar message from log-cat. Maybe it can be fixed by rooting the xiao-mi mobile, that's what I searched from the Internet.

No Activity found to handle Intent { act=android.media.action.IMAGE_CAPTURE (has extras) }

Why I could receive this crash? I check the report in crittercism and the device affected was a GT-I9300 (Samsung S3) in 4.2.2. It's only one report in about 2500 daily users.
java.lang.RuntimeException: Unable to start activity ComponentInfo{co.seahorse.android/co.seahorse.android.views.camera.CameraActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.media.action.IMAGE_CAPTURE (has extras) }
This exception is thrown when the phone can't find an activity (application) that can handle your intent. On S3 it shouldn't be the case of no camera application but in very rare occasions things that are supposed to always work just fail.
As long as you don't have more frequent reports I wouldn't worry. I'd say that in 99% of the cases, single time reports are not a problem.

Android 4.0 c2dm issue

When I'm using android c2dm to push notification to my devices, I have a strange problem.
If I'm closing application using "Manage apps->My application->force stop" and I try to send a push to my device, it doesn't work.
It works with all my other devices which have an Android version less than 4.0.
Any ideas?
Thanks
EDIT:
Ok, I have investigated a little bit more, it seems that background code can not be run when an application is killed this way.
The system logs show me this:
05-09 11:43:15.450: W/GTalkService(25542): [DataMsgMgr] broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE cat=[net.scimob.xxxxxx] (has extras) }
I don't know why it works on previous version of android and not 4.0 and more. Maybe google changed something in their code.
ps: When I use task killers, it doesn't use the same way to kill app and the c2dm push still works.
I hope this will help in the futur!
If I'm closing application using "Manage apps->My application->force stop" and I try to send a push to my device, it doesn't work.
Correct. Don't do that.
It works with all my other devices which have an Android version less than 4.0.
This effect can be seen starting with Android 3.1. Apps when they are first installed, or are force-stopped, will not run again until the user manually launches some activity.

Categories

Resources