How does AlarmManager works when app killed - android

My app set PenddingIntent in AlarmManager.I kown this PenddingIntent will be keep in AlarmManger and the PendingIntentRecord is saved in ActivityManagerService.So when my app
be killed,it has nothing to do with the AlarmManager calling the ActivityManagerService do
the penddingIntent in the future.But the fact is not.I find the logcat would output the log
03-13 09:32:43.149 462-475/? I/AlarmManager﹕ Remove <my package> from mIntentHisRW
03-13 09:32:43.159 462-475/? I/AlarmManager﹕ record removed
I just can't find where does the log produced in source code.And How does AlarmManager works when app killed?
Thanks in advance.

If your app is killed by the user(stop app in the settings),the Android OS will think that it is the user's desire that this app should not be working any more.So the Android OS will remove the AlarmManager record.
I have not found this log too,maybe your ROM's developers added it.

Related

xamarin forms Android App crashes when BroadcastReceiver fires during Doze in OREO

I have a reminder app which needs to show reminders on time even if the phone is in Doze mode. This was appeared to be fine when compiling using the Android 7.1 SDK.
My BroadcastReceiver gets a WAKE_LOCK when it starts and releases it in a finally clause. It also logs activity to a local SQLLite database (for debug)
I've now changed to compile with Android 8.1 SDK and still all works fine
when the phone is not in Doze mode.
However, when the phone goes into Doze the App crashes at the due time of the alarm. My logging statement, which is the first line within OnReceive, is not invoked.
I have traps in for uncaught exceptions, which report to AppCenter and record locally. These work for other exceptions.
TaskScheduler.UnobservedTaskException += ReportUnobservedTaskException;
AppDomain.CurrentDomain.UnhandledException += ReportUnhandledException;
AndroidEnvironment.UnhandledExceptionRaiser += ReportThrowableEvent;
Can anybody advise why and where this might be failing, or how I can debug it better?
It feels like a change since moving the 8.1 SDK for compiling, but I can't see anything that has changed that would affect this.
Answering my own question in case it helps somebody else.
Investigation of the logcat shows that the problem here was that the application was not initialized when the Broadcast Receiver was invoked.
logcat showed the message:
android.runtime.JavaProxyThrowable: System.InvalidOperationException: You MUST call
Xamarin.Forms.Init(); prior to using it.
It appears that a scheduled job was crashing the app and so when the alarm fired the receiver was not initialized and could not deal with the message.
Next investigation is why the scheduled job failed ....

Android Boot Completed Receiver doesn't work on system app

My application contains a BOOT_COMPLETED receiver like described in other threads here. It works perfectly until I changed my app into a system application. Now the Receiver does not trigger the event anymore.
Any ideas for this issue? I'm using Android Kitkat 4.4.2 on a Radxa Rock Pro. Compiled my own image to register the app as system application.
we need more detail to help you, post the code and the manifest, also debug log, in other hand you must use Log.i(TAG, "onReceive."); to know if the problem is in onReceive() or when trying to run the service class.

AVD blackscreen after enableLocalDatastore

Has anyone experienced something like this ? My app works but after I add the line "Parse.enableLocalDatastore(this);" in my Application class it stops. Eclipse tries to launch it but right after the white screen, it turns black and LogCat notifies this warning "05-24 14:15:20.683: W/ActivityManager(382): Launch timeout has expired, giving up wake lock!"
First time I experience such thing, tried searching on Parse.com and nothing.
Additional info:
Android + Google APIs v4.4.2
Parse v1.5.0
Well, it wasn't the SDK's fault.
Solution: Had to create a new AVD to test my app after adding the line "enableLocalDatastore".
^true, same here, I lost ~10h to find out why!!!! seems it is parse.com lib BUG!!!!! when build the android application on release mode!!!!!!!
solution add this :
Parse.enableLocalDatastore(this);
before
Parse.initialize

Calling a method in the system process without a qualified user error

I'm using the notification listener service in android 4.4 and I'm coming across an error that causes my app to stop getting notifications posted.
It's fairly random, but when it happens I'm seeing:
12-31 01:40:44.080 21680-21680/? W/ContextImpl﹕ Calling a method in the system process without a qualified user:
android.app.ContextImpl.sendOrderedBroadcast:1192
android.app.ContextImpl.sendOrderedBroadcast:1183
android.content.ContextWrapper.sendOrderedBroadcast:390
com.android.settings.applications.ProcessStatsDetail.checkForceStop:314
com.android.settings.applications.ProcessStatsDetail.onResume:108
in the logs.
I can even recreate this by just entering the "process stats" section of the developer tools on the phone. As soon as I select an app that uses the notification listener the puts up this warning and unbinds and destroys the service and when it recreates is it doesn't always pick up on events again.
I'm not sure why this would happen, can anyone shed any light?
1) the NotificationListenerService is started by the system and the code for sendOrderedBroadcast throws a warning if it was called by the system process (here)
2) That is just a warning though. There is probably a crash somewhere else in your code. When a NotificationListenerService crashes, Android doesn't restart it unless you toggle the permission or restart your phone. Look for another crash and try either of those methods to restart it if it has. Starting it yourself will not work.
Check your AIDL Package name, for me the Package name in client and server were mismatched. Hope it help somebody

Service not available in c2dm

I am running a sample push notification example.I have done the c2dm signup and got an email.But the problem is when i run the program logcat shows registration id as null and error as "Service not available".
Please help me.
Thanx in advance
This has happened in my application as well. I find that when the emulator starts you often need to let it run the intent (i.e. your main activity) and then exit the application. Start the application again from the emulator and it seems to work for me. A few things to double check while your at it:
1. Did you declare your receivers in your manifest file?
2. Did you use the proper package name in your manifest?
3. Did you run the google api (level 8) AVD
4. Did you add your push sender account to the emulator?
hope this helps!

Categories

Resources