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

Callback/Event after multiple OkHttp post request

My application has an BroadCastReceiver, It is programatically registered using registerReceiver(receiver, filter). The code registerReceiver(receiver, filter) is placed in Application class hence it has global access.The BroadCastReceiver starts a…
-1
votes
3 answers

Broadcast Receiver is not receiveing the intent data in android.Looking for Solution

I am trying to send intent data to MainActivity.And i'm receiving the data from GCM Server, that received data I want to send to my MainActivity. In GcmBroadcastReceiver Class ComponentName comp = new ComponentName(context.getPackageName(), …
-1
votes
2 answers

Enable/Disable ImageView inside RecyclerView based on network call result

I have a RecyclerView that displays twitter like posts. Each list item has a little heart you can press to "Like" the post. The way it works is that clicking on a heart icon launches an IntentService which makes the API call. The API then returns a…
-1
votes
1 answer

Start an Activity After Sms Received

So I'm trying to find a way on how to start a new activity after the conditions. Tried calling a function but it won't work. I hope someone can help. I'm just a beginner please respect. if (bundle != null) { Object[] pdus = (Object[])…
Gentle
  • 759
  • 2
  • 8
  • 20
-1
votes
1 answer

I have implemented this code in broadcastreceiver class to notify the user for not attending the call while charging.... but its not working

public class MyReceiver extends BroadcastReceiver { private Context mcontext; TelephonyManager telephonyManager = (TelephonyManager) mcontext.getSystemService(Context.TELEPHONY_SERVICE); public void onReceive(Context context,…
-1
votes
1 answer

When and where should I unregister broad cast receiver?

I have aAsyncTask as shown below in the code and its task is to enable bluetooth adapter. In onPreExecute I registered for the action ACTION_STATE_CHANGED to get notified about the power state of the bluetooth adapter (on, off, turning on, turning…
-2
votes
1 answer

Why I can't send broadcast to receiver successfull if Intent was set Type?

I create a receiver and dynamic register it in my app: MyReceiver receiver = new MyReceiver(); IntentFilter intentFilter = new IntentFilter("com.test.receiver"); LocalBroadcastManager.getInstance(this).registerReceiver(receiver, intentFilter); I…
sunjinbo
  • 2,137
  • 4
  • 22
  • 45
-2
votes
2 answers

Broadcast receiver - how to?

i'm just practing and i'm trying to make simple brodcastreceiver in Android Studio. I have this manifest:
maurelio79
  • 292
  • 1
  • 9
-2
votes
2 answers

Why we need to use dynamic broadcast receiver in android?

In which situation do we have to use static broadcast receiver and in which situation do we have to use dynamic broadcast receiver in android? Please Explain with examples
-2
votes
3 answers

Cannot resolve method 'openFileInput(java.lang.String)'

I have a broadcast receiver class and I want to use my method "ReadInternalData" to read the internal data in my app, but I can't manage to solve the problem of Cannot resolve method 'openFileInput(java.lang.String)' on openFileInput! import…
Majid ff
  • 249
  • 7
  • 22
-2
votes
1 answer

Alarm manager and broadcast receiver in force closed app

I want to do some network job periodically even when app if force closed. Now it works until it's force closed. What i am missing? Also if i add to manifest this: android:process=":remote" - it's not triggering onReceive method (like app is force…
-2
votes
1 answer

BroadcastReceiver for contact viewing

I'm trying to design a broadcast receiver for contacts, means it opens my app when other apps or the user wants any contact details. is there any means to do it(i didnt find it in intent filter). or i have to design my own? basically when any app is…
-2
votes
1 answer

Android: Broadcastreceiver throwing java.lang.RuntimeException

I am trying to implement a Broadcast receiver to get the events when I uninstall, install and make a phone call (incoming and outgoing). I have registered the intent-filters in the AndroidManifest.xml but when I run my app on my phone then it throws…
Pagar
  • 87
  • 1
  • 12
-2
votes
1 answer

handling loss of internet connection

i designed an app that checks for internet connection before making http requests and it works fine, but the problem is that when there is an internet connection and i switch of mobile data or forcefully lose internet connection within that period…
awesome_cos
  • 15
  • 1
  • 5
-2
votes
1 answer

Android how to receive Broadcast when Screen is ON

I was able to receive Screen state when the app is running, but when the app is stop I can't receive it. here my code LockService public class LockService extends Service { @Override public IBinder onBind(Intent intent) { return…
KidPPAP
  • 21
  • 1
  • 7