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
0
votes
3 answers

BroadcastReceiver persistent during the whole activity lifecycle

I have an application that makes async HTTP requests from various places (app activities and a background service). I'd like to catch response events inside my main activity and modify some views. This is achieved by using anonymous class…
bvk256
  • 1,837
  • 3
  • 20
  • 38
0
votes
1 answer

How can i set an alarm with AlarmManager set()

I have tried to set an alarm in my android app. But it failed. I have read some tutorials but they don't work for me, i don't see where is my mistake. Here is my code: Manifest :
Ananta
  • 660
  • 1
  • 7
  • 19
0
votes
0 answers

android- Cancelling ongoing IntentService download by breaking the while loop with Broadcast

I'm using IntentService to download files from url, using the following code: package com.example.myapp; import java.io.BufferedInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; …
0
votes
0 answers

Multiple GCM receivers - Push doesn't work sometimes

I have two GCM receivers in my app. One of them is used by urbanAirship and the other is used by our application for another service. I am experiencing a strange problem now. Sometimes push notifications work for an installation and if i try to…
0
votes
1 answer

Android detect incoming call on background

I have problem with detecting incoming call. I have tried many tutorials, but it does not working. I am really not sure where is mistake. I have added permission READ_PHONE_STATE, but still in Android Device Monitor see this warning (when calling…
0
votes
1 answer

How to send Order broadcast receiver using pending intent android

Hi i have function like when user hit on notification i have to check my application is in foreground if it so, just close the notification. Otherwise need to open up the application. I have use concept of ordered broadcast to achieve but i am stuck…
0
votes
1 answer

How put get extra using intent in notification to BroadCast

I have notification, and on click notification should be put values using intent. This value should be receive in BroadcastReceiver in other Activity. Any help how it fix? Below there is my code: public void showNotification(){ Intent intent…
0
votes
1 answer

Toast not shown for simple SMS broadcast receiver

I am an Android beginner, and I wrote the following code, the code can show the toast in phone with API 10, but I cannot show the toast and run the onReceive in phone with API 19. I had searched the internet and found out that I should add flag on…
Hon
  • 1
  • 2
0
votes
1 answer

access to activity from a broadcast receiver class

I want to protect certain features behind device password. So if users try to use those feature, they have to confirm password again. This is code in activity class. Context appContext = activity.getApplicationContext(); RestrictionsManager rManager…
hixhix
  • 771
  • 7
  • 23
0
votes
1 answer

BroadcastReceiver in service doesn't react

I am writing an app which receives SMS data message, encrypt its content and save it to database. To realize it I've created a service with a local BroadcastReceiver as follow: public class SMMReceiverService extends Service { private class…
Blady214
  • 729
  • 6
  • 19
0
votes
0 answers

How to use FusedLocation API to monitor location updates when app is not active

The FusedLocation API is newer than LocationManager API, but it is not clear to me when to use one vs the other. I want to monitor location changes even when the user is not running the app. I found this nice example using the LocationManager but…
0
votes
2 answers

Broadcast Receiver not getting triggered

This should be fairly easy but I somehow can't get a Broadcast receiver's onReceive method triggered. Details below: App B provides a broadcast receiver. Manifest:
Sai
  • 2,089
  • 3
  • 19
  • 30
0
votes
1 answer

Android receiving with broadcastreceiver within onClickListener

myButton is a button that when clicked is supposed to receive a broadcast from a background IntentService. But the broadcast is never received. However if I move the broadcastReceiver outside of myButton.setOnClickListener function, then I begin to…
Dobob
  • 337
  • 1
  • 3
  • 12
0
votes
2 answers

How to set up multiple BroadcastReceivers in an app

I'm creating an app that lists upcoming movies, the user sets a reminder for any movie he wants to be reminded about when its release is approaching (using DatePicker he chooses the date when the notification will pop up). So you guessed it each…
user5452241
0
votes
0 answers

'A resource was acquired at attached stack trace but never released ' error when a receiver is starting an IntentService

I have a BroadcastReceiver which calls a IntentService. I am getting the following error when the receiver code is finished running. Error 'A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on…