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
2
votes
1 answer

How to send notification on boot completed?

I've got the following class called AlarmNotificationReceiver. The idea is to send a notification when the device is turned out. Something seems to be wrong since this isn't happening. Any ideas why? public class AlarmNotificationReceiver extends…
Flama
  • 772
  • 3
  • 13
  • 39
2
votes
3 answers

Oppo Phone removing Device Admin Permission

In my application I am using Device admin permission, It is working fine in all devices but In Latest Oppo Phones F9, F7, F5 whenever user unlocks phone it askes to remove Admin permission Or Shows a dialogue to remove admin permissions of all…
2
votes
1 answer

Receiver for Wifi connection on Marshmallow and above

I have an app that needs to know when the user connects to a specific wifi network. This wifi network may or may not provide the user with internet access. When targeting Android v25 and below, we could just use a BroadcastReceiver that…
2
votes
2 answers

Async Task inside BroadcastReceiver onReceive method not running?

I have a working app which sends String data from application's input textfield to TCP server on my PC. I have added BroadcastReceiver class to send message to computer when it's received. Application receives messages(Toast is working), but I…
2
votes
1 answer

Android Broadcast Receiver is not working in background

I have 2 Android mobile cellphones with different Android versions. The first cellphone is running Kitkat and the second one Nougat. I'm currently using the following code. After 5 or 7 hours the android application is not detecting events anymore.…
2
votes
0 answers

How to check screen on or off event of android only user behavior

I want to show some screen on the lock screen when the screen is turned on. So I wrote the following code. public class BroadcastReceiverScreen extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if…
2
votes
2 answers

Mobilock app starts before BOOT_COMPLETED broadcast... How is it possible?

There is a kiosk app called Mobilock. This app starts way faster (Almost 5 seconds before) than my own app which starts with BOOT_COMPLETED broadcast. My own app has the highest priority which is max value of integer. So this is not about the…
Serhat Türkman
  • 373
  • 2
  • 11
2
votes
1 answer

BroadcastReceiver onReceive method not called?

I have a service running in which I am getting location updates. The service returns the location successfully. But after that I am trying to broadcast the location to any activity that might be listening. I have registered the receiver in my…
2
votes
1 answer

BroadcastReceiver has no internet access

I'm facing a problem with my broadcast receiver. I have set an alarm for 6am, it has to fire my broadcast receiver, which only has to download some data from internet and process it. If I set the alarm for 3pm, for example, it works fine. But the…
2
votes
1 answer

Alarm Manager broadcast not received when app is not in memory (One Plus 3)

Alarm Manager broadcast is not received in some devices when app is not in memory ( swiped off from app-tray ) . Device in which it is not working runs with API 25 and is ONE PLUS 3 device. however same thing works in Nexus 6 (with API 25). Strange…
2
votes
0 answers

Notification not being created when Boot receiver calls a service

I have a receiver which gets triggered on Boot completion public class StartupReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction() != null &&…
Sparker0i
  • 1,787
  • 4
  • 35
  • 60
2
votes
1 answer

ActivityDetectionBroadcastReceiver does not compile after updating to GooglePlayServices 26.0.2

This is my onReceive function: @Override public void onReceive(Context context, Intent intent) { ArrayList updatedActivities = intent.getParcelableArrayListExtra(Constants.ACTIVITY_EXTRA); int type = 0x0; …
2
votes
1 answer

How to display custom dialog box when application comes to foreground after clicking on Push notification

I have one custom dialog box which I want to display after user clicks on the Push notification. I am using FirebaseMessagingService here. Below is my code for receiving push notification. I am creating an intent and broadcasting…
Pooja
  • 2,417
  • 20
  • 39
2
votes
2 answers

Android - why the app crash when the service receive a call and the app is closed?

I am making an app that make something happen when the phone gets a call, so after a lot of searching I discover that I can use a BroadcastReceiver and a Service so I created a Service called PhoneStateService: import android.app.Service; import…
user8365522
2
votes
1 answer

Running an Android Service after every 20 sec using AlarmManager doesn't restart on killing the app from the app list

I am trying to run an Android Service which runs in background every 20 sec and send user's lat-long data to server for tracking. It works for the first time when I launch my application. Now If I click the Home Button, It still runs in the…