android-broadcast
Android O : PHONE_STATE broadcast limitation
Eventually, the action was added to the “Implicit Broadcast Exceptions” list so you can add ACTION_PHONE_STATE_CHANGED to your manifest and it will work: https://developer.android.com/guide/components/broadcast-exceptions ACTION_CARRIER_CONFIG_CHANGED, TelephonyIntents.ACTION_*_SUBSCRIPTION_CHANGED, “TelephonyIntents.SECRET_CODE_ACTION”, ACTION_PHONE_STATE_CHANGED, ACTION_PHONE_ACCOUNT_REGISTERED, ACTION_PHONE_ACCOUNT_UNREGISTERED OEM telephony apps may need to receive these broadcasts.
Fatal Exception: android.app.RemoteServiceException: can’t deliver broadcast at android.os.Handler.dispatchMessage
I was facing the same issue with my app, what I do is use LocalBroadcastManager instead of context. Android documents also suggest using LocalBroadcastManager for sending in-app broadcast receivers. //register your receiver like this LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, new IntentFilter(“custom-event-name”)); // unregister like this LocalBroadcastManager.getInstance(this).unregisterReceiver(mMessageReceiver); // broadcastlike this LocalBroadcastManager.getInstance(this).sendBroadcast(intent); Hope this will help. Thanks! 🙂
Listen to incoming Whatsapp messages/notifications
I was able to do this using Accessibility Service . Using this, you can listen to all notification on the notification bar. I listened to application-specification by adding the package name to the Accessibility Service service info , which in this case was com.whatsapp. I couldn’t read the messages, but I get notified whenever a … Read more
Pop up window over Android native incoming call screen like true caller Android app
I am not sure that your custom GUI will always be on top of the default one, because the system broadcast receiver and your receiver are both trying to display its GUI on top of the screen. We are not sure which one is called first, but one tricky work to make your GUI on … Read more
Broadcast Receiver Not Working After Device Reboot in Android
Here’s a tested and working solution on both the devices that you mentioned, OnePlus and Mi. As you said the auto-start prevention feature on OnePlus and Mi devices prevent apps from starting up their services automatically on boot complete so as to improve the overall device boot speed and battery performance. However, there’s a workaround … Read more
Should I use android: process =”:remote” in my receiver?
By defining your receiver with android:process=”:remote” you basically run your receiver in a different process (= VM). For typical use-cases, you don’t need to run this in a different process, and whatever you want to do can probably run just fine locally (in your APK process). The drawback of using android:process=”:remote” is that you need … Read more
Android Broadcast Receiver vs Service [duplicate]
Services are meant to perform an action in the background for some period of time, regardless of what the user is doing in foreground (the user could be switching between activities). A good example would be a music player service – the user starts playing music through a music player app but when they exit … Read more
what is the difference between sendStickyBroadcast and sendBroadcast in Android
Here is what the Android SDK says about sendStickyBroadcast(): Perform a sendBroadcast(Intent) that is “sticky,” meaning the Intent you are sending stays around after the broadcast is complete, so that others can quickly retrieve that data through the return value of registerReceiver(BroadcastReceiver, IntentFilter). In all other ways, this behaves the same as sendBroadcast(Intent). One example … Read more
How to check if Receiver is registered in Android?
There is no API function to check if a receiver is registered. The workaround is to put your code in a try catch block as done below. try { //Register or UnRegister your broadcast receiver here } catch(IllegalArgumentException e) { e.printStackTrace(); }