Android :: Detect If Broadcast Receiver Is Registered?

Mar 11, 2010

I'm using more than 1 instance of MapActivity in an application that look different from each other. I'm running into an issue sometimes when leaving a MapActivity doesn't unregister it's BroadcastReceiver and going Back to resume the MapActivity page it tries to re-register the receiver again, thus receiving an Exception that Receiver already registered.

Anyone know of a way to tell if a Broadcastreceiver is registered and is listening?

Android :: detect if Broadcast Receiver is registered?


Android :: To Unregister A Broadcast Receiver Register Registered In Manifest File

Mar 19, 2010

I have been able to register and unregister a broadcast receiver from the java code and know that a broadcast receiver is unregistered (even if it is not done explicitly) on its own as the process that registered it is killed. Now I have a broadcast receiver which has been registered through manifest file and not through the java code, and need to unregister the broadcast receiver from the java code. Since this, i think would need a reference to System context that instantiates the broadcast receiver.

View 4 Replies View Related

General :: Create Broadcast Receiver To Detect When Screen Was Locked

Jul 12, 2013

I am trying to create a broadcast receiver to detect when the screen was locked. I have it already working to detect when the the tablet was booted, but it won't work for the SCREEN_OFF action. Right now I just have it log any intents that where triggered and so far its only working for when the boot was completed.

Code:
package com.atlantis;
import android.content.BroadcastReceiver;
import android.content.Context;
[code]...

View 1 Replies View Related

Android :: Broadcast Receiver - Create A Broadcast Receiver Which Responds To System Events

Sep 28, 2009

trying to create a broadcast receiver which responds to system events and change system settings. I don't need any interaction from the user so I don't need an activity and have been trying to do everything through the manifest file. I've put a log event into my onReceive method but it never logs anything so I'm presuming my method is never called. I've tried this with both the 1.5 and 1.6 SDKs. I was hoping somebody could have a look at my code please and let me know if there are any problems.

View 2 Replies View Related

Android :: RegisterReceiver For Broadcast Only If It's Not Already Registered?

Jan 26, 2010

I have a snippet of code that I'm calling from a service:

CODE:........

What I would like is a way to check and make sure that the registerReceiver isnt already listening before it calls it again. Is this possible?

For example if my snippet of code is in a method, and I call the method 10 times, right now the onReceive method appears to run 10 times.

View 1 Replies View Related

Android :: How To Check If Receiver Is Registered?

Apr 21, 2010

I need to check if my registered receiver is still registered if not how do i check it any methods?

View 2 Replies View Related

Android :: Finding Which Broadcast Receivers Are Registered?

Jul 2, 2010

I have a program that monitors incoming SMS's, and I want it to monitor them full-time, so I registerReceiver with a Broadcast receiver that I've created. The problem is, if I want to unregister that receiver, I can't unless I know the original Broadcast Receiver class I registered. This is not a problem if I set it to stop when the program stops, but I want the receiver to keep running, only stopping when the user specifies. EDIT: Or is there a way of "Storing" the Broadcast Receiver class that I've created, such that when onDestroy is called it can be saved and when create is called again it can be pulled out.Is there any way of doing this?

View 1 Replies View Related

Android :: Check If There Are Registered Broadcast Listeners?

Mar 22, 2009

Is there a way to check before sending a broadcast (from a remote service) whether there are registered broadcast listeners? What I'd like to do is to send broadcasts only if there are registered listeners, otherwise make a toast. Does it make any sense?

View 3 Replies View Related

Android :: ViewFlipper Dies With Receiver Not Registered

Nov 12, 2010

We have a very simple ViewFlipper widget in a layout. The following trace back happens when it crashes. This does not trace back into our application code at all.

There is a similar bug logged for 2.1 http://code.google.com/p/android/issues/detail?id=6191

We are running on 2.2 and getting this error.

Is this fixed or is it necessary to create a workaround subclass?

CODE:....................

View 6 Replies View Related

Android :: Registered Broadcast Receivers After Application Is Killed?

Mar 25, 2010

Currently my application is configured to always receive the CONNECTIVITY_CHANGED action to force an update if the previous update failed because there was no connectivity. What I don't like about this is that the broadcast receiver gets to be called too many times although it is not needed. I was thinking to register my broadcast receiver only if an update failed using the Context.registerReceiver(BroadcastReceiver receiver, IntentFilter filter) method. But I'm not so sure if this is a good idea. I'm concerned that if my application is evicted from memory the broadcast receiver will be unregistered or lost and my application will not be notified about the future CONNECTIVITY_CHANGED actions. The update is done in a short lived service. So if the update fails, the service will register the broadcast receiver just before it ends its execution time. Can somebody explain what happens to my broadcast receiver after the application is evicted from memory?

View 4 Replies View Related

Android :: Viewflipper Receiver Not Registered Error While Orientation Change In 2.1 And 2.2

Sep 19, 2010

I am using viewflipper for fling gesture recognition everything works fine for 2.0 and prior but in 2.2 and 2.1 it throws exception as "java.lang.IllegalArgumentException: Receiver not registered: android.widget.ViewFlipper" below is full debug trace.

CODE:.....................

There is issue on Google related to this bug 6191.

And the solutions mentioned in there seems to work only if your are creating ViewFlipper through code but in my case i am using ViewFlipper in XML which is my layout file and so i cant use the solution mentioned for extending the ViewFlipper i tried using delay nothing seems to work.

Below is my layout code.

CODE:...............................

View 1 Replies View Related

Android :: Java.lang.IllegalArgumentException - Receiver Not Registered - Widget - ViewFlipper

Jan 3, 2010

I have a ViewFlipper in my app.

When my app is running and the phone goes to sleep it works fine.

When I wake the phone up and my app then tries to display again, I get the following error.

I can't figure this out.

CODE:......................

View 2 Replies View Related

Android :: Start TTS From Broadcast Receiver

Jul 9, 2009

I am trying to start TTS from a broadcast receiver and it as document an intent receiver can't bind the service. Is there a work around, I can't figure out how to start the service using startService(Intent, Bundle).

View 4 Replies View Related

Android :: Broadcast Receiver Without Activity

Feb 12, 2010

A WAP PUSH (Broadcast)receiver basically doesn't need any UI. It is a silence application which handles the Push messages based on actions/ mimetype without needing any intreaction with user, I've tried to test it in a SMS receiver by removing the Activity from the project and it stopped receiving the SMS messages. My question: Does all android applications "MUST" define a activity? Is there a way to hide it?

View 5 Replies View Related

Android :: Broadcast Receiver Error

Jul 23, 2010

I am working on one project where i am using broadcast receiver in one of my activity to capture the incomming call and its works fine. when one of my other activity is open and that time if call is come then my broadcast receiver is fail to respond. can any one help me for this ? or its nessesorry to declare broadcast receiver in all my activity to do some comman task.

View 5 Replies View Related

Android :: Broadcast Receiver From Widget

Dec 2, 2009

I am making a widget that needs a broadcast receiver, like the one in com.example.android.apis.appwidget.ExampleBroadcastReceiver. However, the example defines Intent.ACTION_TIMEZONE_CHANGED in the manifest, but there are some that do not allow this. For example, Intent.ACTION_TIME_TICK says "You can not receive this through components declared in manifests, only by exlicitly registering for it with Context.registerReceiver(). "

So I removed the manifest declarations and tried replacing the AppWidgetProvider.onEnabled function that was in the example with a call like the following: context.registerReceiver(myReceiver, new IntentFilter(Intent.ACTION_TIME_TICK));
(where "myReceiver" is an instance of the receiver I want.) However, when I try to run the code, I get the following error:
Unable to start receiver...android.content.ReceiverCallNotAllowedException: IntentReceiver components are not allowed to register to receive intents.
Any way to get this broadcast receiver working from a widget?

View 3 Replies View Related

Android :: Any Other Application As Broadcast Receiver?

Jul 29, 2009

I am broadcasting an Intent from an activity. Can we make another application as a receiver. So that it will get invoked when that specific intent is broadcasted.

View 2 Replies View Related

Android :: Broadcast Receiver Sometimes Works

Jan 6, 2010

I wish to listen to android.intent.action.BOOT_COMPLETED. However I am not getting the broadcast intent, if I specify com.test.BootBroadcastReceiver in the manifest. When I change this value to simply BootBroadcastReceiver, then I am getting the broadcast intent.

<receiver android:name="BootBroadcastReceiver" android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

My package in the manifest file is:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test"
And the BootBroadcastReceiver resides in this package. What is the reason behind this?

View 2 Replies View Related

Android :: Trying To Understand Use Of Broadcast Receiver

Aug 17, 2009

I have an application that uses an extended Broadcast Receiver class inside the Activity. I have the extended Broadcast Receiver class as a member variable of the Activity class. But it looks like the receiver references keep changing between its construction and 'on Receive' method call. I would like to understand this better. Here are some details. public class MyEventReceiver extends Broadcast Receiver

View 3 Replies View Related

Android :: Broadcast Receiver For Action

Oct 3, 2009

I was wondering if its possible to have a broadcast receiver to listen when the app its in launches.I tried doing by creating a BroadcastReceiver to listen for the android.intent.action.MAIN action but it never gets called?Is there something I need to do or a different action I should be listening for?

View 3 Replies View Related

Android :: How To Use Broadcast Receiver In Different Applications?

May 1, 2010

I have here two applications in two different projects in eclipse. One application

(A) defines an activity

(A1) which is started first. Then i start from this activity the second activity

(B1) in the second project

(B). This works fine.

Unfortunately, the message is never received. Although the method in activity A1 is called, i never receive an intent in B1.

View 1 Replies View Related

Android :: Broadcast Receiver For Sent SMS Messages?

Jun 13, 2009

I created a BroadcastReceiver and configured it with an android.provider.Telephony.SMS_RECEIVED action filter so it is called everytime the phone receives a text.Is there some event/action or other way for my application to be notified whenever the phone sends a text (preferably independent of the application that sends it)?So far the only option I see is to poll the content provider for content://sms/sent which doesn't even give me all sent texts because applications can choose not to put it there.

View 1 Replies View Related

Android :: Set Priority To Broadcast Receiver

Oct 24, 2010

The symptom: I have a broadcast receiver that listen to sms, when a sms is received, i call an activity to display. It works all fine if the screen is on and not locked. But when screen is locked, and as soon as i received the sms, the activity popup for a second then disappeared and I use the code to unlock the screen.

getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);

I think it might be the competitions with phone default sms program (the sms default program shows a notification only). I am wondering is there a way to set priority to broadcast receivers or even the activity that receiver stared, to avoid the conflicts between multiple receivers. or set orders to execute one by one? I have tried to thread.sleep my receiver for a second, still not working.

View 2 Replies View Related

Android :: How To Use Intents From Service Or Broadcast Receiver?

Dec 15, 2009

I need to be able to handle/catch Intents while my Activity is closed. So I am looking at either a Service or a BroadcastReceiver. Is it possible to "receive" intents to a service itself? I tried to search, but could not find anything helpful. With a BroadcastReceiver, I am not exactly sure how that works outside of an Activity. Does it depend on the Activity being open/running? Can it run by itself?

Let's say that my Activity is killed by Android(or a task killer app), does the BroadcastReceiver still receive intents and process them? I have used a BroadcastReceiver as a widget, but I do not want to use a widget this time. My goal is to have the user open the Activity to set some options. From there, they would be able to close the Activity, but I would still be able to process Intents that were sent out by the system. I am still fairly new to Android development, so I could be so far away from where I need to be.

View 1 Replies View Related

Android :: Error In Receiving SMS Using Broadcast Receiver

Oct 11, 2010

I'm trying to receive SMS using broadcast receiver. MySMSReceiver :

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage;
import android.util.Log;

public class MySmsReceiver extends BroadcastReceiver {
/** Tag string for our debug logs */
private static final String TAG = "MySmsReceiver";
@Override
public void onReceive(Context context, Intent intent) {
Log.i(TAG, "Recieved a message");
Bundle extras = intent.getExtras();
if (extras == null)
return;
Object[] pdus = (Object[]) extras.get("pdus");
for (int i = 0; i < pdus.length; i++) {
SmsMessage message = SmsMessage.createFromPdu((byte[]) pdus[i]);
String fromAddress = message.getOriginatingAddress();
String fromDisplayName = fromAddress;

Log.i(TAG, fromAddress);
Log.i(TAG, fromDisplayName);
Log.i(TAG, message.getMessageBody().toString());
break; } } }

and added in Mainfest file
<receiver android:name=".MySmsReceiver" android:enabled="false">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
<uses-permission android:name="android.permission.RECEIVE_SMS" />

But when I run this application and send a SMS using emulator it shows following logs in logcat

10-12 00:14:53.082: VERBOSE/Telephony(1032): getOrCreateThreadId uri: content://mms-sms/threadID?recipient=9898989898
10-12 00:14:53.203: VERBOSE/Telephony(1032): getOrCreateThreadId cursor cnt: 1
10-12 00:14:53.432: DEBUG/Mms:app(1032): getSmsNewMessageNotificationInfo: count=4, first addr=9898989898, thread_id=3
10-12 00:14:53.482: WARN/NotificationService(62): STOP command without a player
10-12 00:14:53.562: DEBUG/MediaPlayer(62): Couldn't open file on client side, trying server side
10-12 00:14:53.582: ERROR/MediaPlayerService(34): Couldn't open fd for content://settings/system/notification_sound
10-12 00:14:53.592: ERROR/MediaPlayer(62): Unable to to create media player
10-12 00:14:53.643: WARN/NotificationService(62): error loading sound for content://settings/system/notification_sound
10-12 00:14:53.643: WARN/NotificationService(62): java.io.IOException: setDataSource failed.: status=0x80000000
10-12 00:14:53.643: WARN/NotificationService(62): at android.media.MediaPlayer.setDataSource(Native Method)
10-12 00:14:53.643: WARN/NotificationService(62): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:716)
10-12 00:14:53.643: WARN/NotificationService(62): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:671)
10-12 00:14:53.643: WARN/NotificationService(62): at com.android.server.NotificationPlayer$CreationAndCompletionThread.run(NotificationPlayer.java:8)

View 1 Replies View Related

Android :: Sometimes Receiver Not Receiving Any Broadcast Message

Sep 10, 2010

I have create a receiver which receive on phone state change I have register it in XML by "android.intent.action.PHONE_STATE"

But sometime it don't receive any broadcast message
log mesages are:::

09-10 11:20:36.968: WARN/ActivityManager(74): Timeout of broadcast BroadcastRecord{43347258 android.intent.action.PHONE_STATE - receiver=android.os.BinderProxy@4334ebd0
09-10 11:20:36.968: WARN/ActivityManager(74): Receiver during timeout: ResolveInfo{432dd748 com.callHandller.PhoneStateReciever p=0 o=0 m=0x108000}
09-10 11:20:36.968: INFO/Process(74): Sending signal. PID: 2223 SIG: 9
09-10 11:20:36.988: ERROR/JavaBinder(74): !!! FAILED BINDER TRANSACTION !!!
09-10 11:20:37.008: INFO/ActivityManager(74): Process com.callHandller (pid 2223) has died.
09-10 11:20:37.008: INFO/WindowManager(74): WIN DEATH: Window{4324f470 com.callHandller/com.incallHandller.callHandler paused=false}
09-10 11:20:37.958: WARN/ActivityManager(74): Activity destroy timeout for HistoryRecord{4321c7c0 com.callHandller/com.incallHandller.callHandler}
09-10 11:20:42.288: DEBUG/dalvikvm(136): GC freed 2543 objects / 143320 bytes in 179ms
Here com.callhandller is my application package where I have Receiver...

View 3 Replies View Related

Android :: Added Broadcast Receiver In Manifest

Jul 11, 2010

So, I added the receiver (contained in application) in the manifest. Broadcast doesn't fire my broadcast receive.

<receiver android:name="mypkg.IncomingCallReceiver">
<intent-filter>
<action android:name="android.telephony.TelephonyManager.ACTION_PHONE_STATE_CHANGED"/ >
</intent-filter>

View 4 Replies View Related

Android :: Understanding Broadcast Receiver / Way Of Activate It

Mar 25, 2010

I am trying to understand the use of the broadcast receiver and the way of activate it. There's two ways isn't it? Register it from an activity or declare it in the manifest. So my question is: If I code a broadcast receiver which is watching incoming messages and I register it in the manifest, when a message comes my broadcast receiver will catch it automatically although any activity of my app had registered it. In a nutshells, I don't have to activate it so it works, only register it either in the manifest or in an activity.

View 2 Replies View Related

Android :: Broadcast Receiver Not Getting Called When Expected

Dec 27, 2009

I have a service that gets updated every x minutes depending on the user preferences. This service connects to a web service and pulls some data. If during an update the user has no connection I register my receiver and start listening for changes (ConnectivityManager.CONNECTIVITY_ACTION), the thing is that onReceive () only gets called on every update instead of firing onReceived as soon as I plug the connection back in. Have I understood the concept of Broadcast Receiver wrong? Is it not suppose to send a notification as soon as it detetcs a change in the connection?

View 4 Replies View Related

Android :: Broadcast Receiver / Service & Thread

Jun 23, 2010

I am starting to develop a new app and I am a bit confused about the structure I need to give it.I need to react to broadcast intents, so I placed a broadcast received in the manifest. Every single intent produces an action to be performed. Now the first question: should I start a service (maybe with non_sticky option?) or should I start a thread (or an async task) directly from the broadcast receiver? If I start a service, should I do all the stuff in its body, or should it start a thread. I should do the heavy job in a thread if there are time consuming operations, but what if the gui of my application is just an activity with the options and a button to start the service. What is the point in keeping the main thread busy? Do I risk to be killed for not being responsive? I read here and there that I can update the gui from a background thread. Can I do that even if it is started from a service? The AsyncTask's onProgressUpdate is said to run in the application main thread, but if the application is made of different activities, who tells me which activity is the user looking at while the thread is doing all its long work? The user could change activity in the meanwhile and then the update would be unuseful.I know it's (quite) a lot of questions, but I need to get some clarifications before taking the wrong path.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved