Questions tagged [android-broadcastreceiver]

BroadcastReceiver is an Android component that responds to system-wide broadcast announcements.

BroadcastReceiver is an Android component that responds to system-wide broadcast announcements.

Many broadcasts originate from the system – for example, a broadcast announcing that the screen has turned off, the battery is low, or a picture was captured.

Applications can also initiate broadcasts – for example, to let other applications know that some data has been downloaded to the device and is available for them to use.

Although broadcast receivers don't display a user interface, they may create a status bar notification to alert the user when a broadcast event occurs. More commonly, though, a broadcast receiver is just a "gateway" to other components and is intended to do a very minimal amount of work. For instance, it might initiate a service to perform some work based on the event.

For more information visit the Android BroadcastReceiver reference or the documentation for the receiver element used in the Android manifest file.

859 questions
3
votes
2 answers

Can non-default SMS app ALWAYS receive broadcast when SMS received, even when force closed?

So I have followed this guideline to show a simple toast when SMS is received. While it works ok when app is running, when I go to settings and force-close the app, it stops working. I checked many answers here on StackOverflow for simmilar…
michnovka
  • 2,880
  • 3
  • 26
  • 58
2
votes
1 answer

Small confusion about PhoneStateIntentReceiver

public class MyReceiver extends PhoneStateIntentReceiver { @Override public void onReceiveIntent(Context context, Intent intent) { if (intent.action == Intent.CALL_ACTION) { } } } Assume that…
pixelscreen
  • 1,945
  • 2
  • 18
  • 40
2
votes
2 answers

How to register a network connectivity change receiver programmatically?

In my application I want to notify if a device has been lost network connection and if it's connected to a network again. So I wrote a Broadcastreceiver like this: class NetworkReceiver() : BroadcastReceiver() { override fun onReceive(context:…
dudi
  • 5,523
  • 4
  • 28
  • 57
2
votes
2 answers

Android boot completed notification not received after reboot

I have a broadcast receiver registered in the application manifest to receive the BOOT_COMPLETED notification. After restarting the mobile device I receive no notification. However, I do receive the notification when I open my application. Please…
Hendré
  • 262
  • 10
  • 27
2
votes
1 answer

BroadcastReceiver doesn't receive the broadcast event message

I created my broadcast receiver AnprEventReciever that should be triggered when connectivity state changes, however it doesn't. AnprEventReciever: import android.content.BroadcastReceiver; import android.content.Context; import…
2
votes
2 answers

How to send a data from a broadcast receiver to fragment?

How to send a data from a broadcast receiver to fragment? Here I want to send the phonenumber (OriginatingAddress) to another fragment. public void onReceive(Context context, Intent intent) { Bundle intentExtras = intent.getExtras(); if…
2
votes
3 answers

Broadcast receiver for Phone State changed not working

i have created a broadcast receiver for Phone state change. but the broadcast is not working. i have been trying from couple of hours and tried 2,3 solutions but still its not working. other guys over internet have same code and the is working fine…
2
votes
1 answer

BroadcastReceiver not execute on release mode

I try implement Request SMS Verification in an Android App and my code work like a charm in debug but when i generate sign apk app and run it as release my BroadcastReceiver class seems not execute , i try so many ways like define my receiver as…
Erfan
  • 3,059
  • 3
  • 22
  • 49
2
votes
0 answers

AlarmManager is not firing the intent when the alarm goes off

Even though I am setting the alarm and registering the broadcast receiver the alarm is not firing the intent. I am registering the receiver here:- private void registerOfflineEntitlementUpdateReceiver(Context context) { IntentFilter…
2
votes
1 answer

Broadcast receiver is not calling on internet connectivity check

I am trying to make a simple app which will notify if there is internet connection available or not on internet connectivity change. i have found some solution on internet and tries to implement them but somehow its not working. my broadcast…
2
votes
0 answers

Adding BroadcastReceiver to FirebaseMessagingServices

I am having some problems with FirebaseMessagingServices. I have a project with two apps, where we can send data messages (notification with payloads) from one app to another. They are working fine when they are in foreground and when they are in…
2
votes
0 answers

Handle click on cutom notification button and show Facebook ShareDialog

I am trying to open Facebook default Share Dialog through the custom Firebase notification view in my Android app. I have created a button in the notification to open Facebook Share Dialog. I have registered a broadcast receiver on action of the…
2
votes
0 answers

Android Screen On And Screen Off Receivers not firing after boot unless activity is brought into focus (with Oreo)

I'm messing around with broadcast receivers. I want to latch onto boot, screen on and screen off. If I set up one for boot up, it works fine: In AndroidManifest.xml:
2
votes
1 answer

Is my broadcast receiver explicit or implicit?

after reading some manuals (1,2) about this I still need help. I am targeting my app to android O and on android 7.0 it work fine but on 8.1 I don`t seem to get any broadcast. So, if targeting android O in manifest and running on 7.0 and using…
Dim
  • 4,527
  • 15
  • 80
  • 139
2
votes
0 answers

Update GCM code to Android SDK > 26

I'm working on a project that need to be updated, but I don't have very clear what I need to change. I have the idea that the best option is to migrate to FCM but my boss disagree with me. My source code of the receiver: public class…