Android :: How To Use Broadcast Receivers?

Dec 30, 2009

Is it possible to use just a broadcast receiver without any activities? I just want to run some sample code only when the phone receives a call and nothing more. I use Log.d to write out but I don't see anything in the log. Am I missing something here? I also have permissions set in the androidmanifest.xml to allow for these type of intents.

Android :: How to use broadcast receivers?


Android :: Using Broadcast Receivers

Sep 9, 2009

I had one question: Is it feasible to use a BroadcastReceiver as a glue layer between the user interface and the underlying business logic ? Example use case: Suppose i am maintaining the state of a call, and providing callbacks to the UI by invoking sendBroadcast with the relevant intent. Similarly, my underlying business logic can send broadcasts to the activity that has registered for receiving it on certain events ( like call connected, connecting, timed out etc).

View 4 Replies View Related

Android :: Dns Failing In Broadcast Receivers?

Mar 16, 2010

something weird just started happening. my app has a broadcast receiver which may access the network when invoked. the code has been solid for ages, but in the last few days it has started getting DNS errors on perfectly fine hosts. these are hosts which can be reached without problems in the main app or from other apps.interestingly i've seen another app get DNS errors too another app with a broadcast receiver.seems to affect all OS versions -- we have 1.5, 1.6, and 2.01 here. i don't have a Nexus to test 2.1, though. are there caveats to doing network inside broadcast receivers? i didn't think so, as ours worked fine until the time change [fx: twilight zone theme]

View 6 Replies View Related

Android :: Broadcast Receivers - Trigger Their Associates?

Apr 21, 2010

Can anyone give a hint if you know why there are some ACTIONS that do not trigger their associated receivers when they are registered in the manifest while they are received when they are register through registerReceiver() ? For instance, when I declare: <receiver android:name=".MyReceiver"> <intent-filter> <action android:name= "android.intent .action .NEW_ OUTGOING_CALL" /></intent-filter> </receiver> if the application is NOT running My Receiver is never invoked. But now, if I register the intent from inside a service, MyReceiver is invoked properly

View 2 Replies View Related

Android :: Difference Between Services And Broadcast Receivers

Jul 17, 2010

im trying to understand what the difference between a service and a broadcast receiver is,as i see it they can do the same thing.For example i have an application : App1 That provide a service called ToastHelloWorld which just creates a Toast and stopSelf(). expose it to other applications using an intent filter with the action name: "com.test.HelloToast"Now i have another application : App2 i want to implicit use a service with the action "com. test. Hello Toast" so i call startService( new Intent ("com. test.HelloToast"));and it works.Why would i use broadcast receivers when i can do everything with services and dont have the restriction of a 5sec execution limit?.I know most "system events" is exposed via broadcasts' but couldnt they just aswell be published as Service Intents?

View 1 Replies View Related

Android :: Bug Using Broadcast Receivers In App Widget Framework?

May 4, 2009

I started to implement my own App Widget using the example provided in the ApiDemos. In order to update the Widget efficiently I chose the Broadcast Receiver mechanism. In the ApiDemos there is this ExampleBroadcastReceiver which would (or should) react to changes related to TimeZone and Time as specified in the Android Manifest of the ApiDemos. I have debugged this Example using Eclipse and the Logcat output (provoking changes in TimeZone through the settings) and come to the conclusion that there must be some bug in the app widget framework. The only Broadcast Receiver that seems to work is the AppWidgetProvider itself. For instance I would expect something like: D/ExampleBroadcastReceiver intent=XY in the logcat's output after I have provoked the event XY. I have even tried without the 'enabled' option in the receiver's specification in the Android Manifest.

View 5 Replies View Related

Android :: App Widget Provider / Broadcast Receivers

Jun 28, 2010

The online android documentation says: Everything you can do with AppWidgetProvider, you can do with a regular Broadcast Receiver.So, what i want to do is to register via registerReceiver() another event other than ACTION_APPWIDGET_* on my Widget. For example ACTION_BATTERY_OKAY, is there any way to do this? Obviously i cant register the event from the onUpdate() code but i should do it using a service or something else. The problem is that im not able to find any reference to the Provider (AppWidgetManager only returns AppWidgetProviderInfo objects).

View 1 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 :: How To Set Priorities For Multiple Broadcast Receivers?

Jul 22, 2010

How to set a priority for multiple Broadcast Receivers when dealing with ordered intent broadcast?

View 7 Replies View Related

Android :: Design Approach - Web Service And Broadcast Receivers

Sep 23, 2010

I am developing an app for android mobiles that communicates with a json/rest web service. I need to make certain kinds of calls periodically to the server to check for some information. Within that context I might need also to query the GPS for the current position. I'm quite undecided to use a Local Service, since I don't know very well how to deal with them, in fact I need to retrieve those data periodically and refresh a MapView accordingly. I heard that I can use PendingIntents,in the service, associate this data as a payload and send them to a broadcast receiver which unpack the data and refresh the UI, I heard also that this is a bad design approach because of what broadcast receiver are intended to be used for.

View 1 Replies View Related

Android :: Extending Application Class And Broadcast Receivers

Nov 1, 2010

In a book I read, the author suggests to extend the application class in order to have a place to be used as a singleton. In this way, it is easy to make some initialization stuff in it onCreate().Now my question: if my application has also some broadcast receivers declared in the manifest, and the application was not started explicitly, or it was but then the os reclaimed it resources back, what will be happening if the broadcast receiver is triggered? Will the onCreate of the application class be called first?

View 7 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 :: Run Multiple Broadcast Receivers For Same Intent In Same Application?

Oct 25, 2010

I'm working on a project where I need to run the BroadcastReceiver for a third party library for a specific Intent. I also want to run some of my own code when the Intent is broadcast. If I supply my own BroadcastReceiver for the same Intent, it seems that only, one or the other runs, but not both, depending on which appears first in the AndroidManifest.xml file. Is it possible to register multiple BroadcastReceivers for the same Intent in the same application and have them all run? AndroidManifest.xml snippet

View 4 Replies View Related

Android :: Broadcast Receivers Not Receiving Pending Intents

May 20, 2009

I've had an issue where no matter how I've tried to set it up I'm finding the Broadcast Receivers aren't receiving any Pending Intents. A look through LogCat confirms that the intents are launched, but they're not being executed. I managed to make a simple(ish) repro case. If you take the SimpleWiktionary widget by Jeff Sharkey http://code.google.com/p/wiktionary-android/ and make the following changes plus any required imports. Code...

View 8 Replies View Related

Android :: How To Capture Key Events From Intent's / Broadcast Receivers?

Oct 29, 2010

Is there a way to capture a key event from the Menu button using an Intent or Broadcast Receiver? Basically I want my app's Service to be activated when the Menu key is pressed.

View 1 Replies View Related

Android :: Is This Systems Broadcast Ordered Or Normal Broadcast?

Aug 13, 2010

I'm trying to figure out if a system event broadcast is broadcasted using ordered broadcast or normal.The event is EVENT_REMINDER and in the source for the calendarprovider i noticed it sets up a alarmmanager to sent the broadcast. I can't find how the alarmmanager sends it. My guess would be as a normal broadcast , But while i was trying some things i noticed i could delay the system's notification (tried up to 10 sec) by building a sleep in my broadcastreceiver. This would indicate that they are handled ordered , and the systems receiver is only called when mine has finished. But can i be sure of this behavour?? (in all 1.5> sdk versions) the docs state that in some cases normal broadcasts are also handled ordered..due to spare of resources.

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 :: Alarms / Receivers And Wakelocks

Dec 10, 2009

I think I may have found an issue within the My understanding is that to properly hold a device awake after an alarm is triggered you have to aquire a WakeLock in the onReceive() event, call a Service, then perform the work in the Service, releasing the lock within the Service when complete. http://groups.google.com/group/android-developers/ browse_ thread /threa . http://www.mail-archive.com/android-developers@ googlegroups.com/msg66. This pattern can also be found in the CommonWare Advanced Android Development book. I tried this, but I found that the AlarmManager, when calling the BroadcastReceiver, runs on a separate PID than the IntentService when started from the BroadcastReceiver's onReceive() event. This makes the static variable on the lock manager. I tried this, and my logs indicate that the PID is definately not the same, and my understanding is that the DalikVM instances act like a standard JVM, whereby objects and variables are no shared between JVMs. Furthermore, since the WakeLock is not serializable, there is really no way to pass the reference to the lock via an "extra" in the Intent.Has anyone else seen this pattern work or fail? I have an example project (with compiled APK) if you'd like to test it yourself, where shall I post this? I have tested this on the emulator on versions 1.6 and 2.0.

View 8 Replies View Related

General :: Android Device With FM Receivers -> TMC

Aug 9, 2012

Is it possible to create a virtual TMC receiver via FM radio? On the Windows Mobile built such projects as OmniaTMC, HyperGPS. What about devices based on Android?

View 1 Replies View Related

Android :: Broadcasts Receivers And Permissions In Two Applications?

Sep 15, 2010

I have two applications, one of which (B) implements a broadcast receiver. The application (A) which sends the broadcast, binds a permission to it which the receiver (B) shall possess. The problem is now: If I install the receiver (B) first and the sender (A) afterwards, the receiver will never receive the broadcast. I assume this happens because the installation of the receiver somewhere fails when it comes to the "uses permission" part of the manifest (because this permission is not yet registered/defined).

However, this issue should be resolved as soon as the sender (which defines the permission in the manifest) is installed, but unfortunately isn't. It does not even help to re-install the receiver. The only way to resolve the issue is to completely uninstall the receiver application and do a fresh install. Is this behaviour intended ("not a bug, a feature")?

View 3 Replies View Related

Android :: Does Not Return Receivers Registered By Registe RReceiver()?

Oct 4, 2010

I would like to check which receivers are there for a specific Intent yet queryBroadcastReceivers() ignores receivers that were registered in code using registerReceiver() call. It returns only receivers declared in the AndroidManifest.xml file. Is this behavior by design ? Any other way I can get information on *all* receivers capable of handling an Intent even if they where registered in code ?

View 4 Replies View Related

Sony Ericsson Xperia X10 :: X10 Receivers Hearing Sharp Static Noise At Their End

Aug 24, 2010

When ever i make calls from my X10. Recievers are hearing a sharp static noise @ their end. this problem has been discussed in length in below forum http://android forums .com /sony-ericsson -xperia-x10/113115-xperia-x10-problem-receivers-other-end-hearing-sharp-noise-emitted-x10-during-calls.html#post1436896 I have taken up this issue with my SE service center in INdia. and they have given me till now 3 replacement mobiles. In all the three the same problem persists. Is there any answer for this problem in SE X10 mobiles? even the service center have admitted of this problem in X10. check the thread you will come to knw.Waititng for a proper rely from SE team on this issue in X10.

View 1 Replies View Related

Android :: Multiple Broadcast Messages With Less Data Or Less Broadcast Messages With More Data

Oct 5, 2009

I am developing an application which is communicating with the server. Tha application can perform log-in and get different parameters from server.

The application consists of a RESTful client (custom class for making requests), Communication Service (the service which runs in the background) and the main activity.

For now I created multiple broadcast messages and multiple broadcast receivers in the main activity so when the application performs login operation a receiver (loginBroadcastReceiver) in the main activity receives a message and when another parameter is received from the server different message is broadcasted and another receiver handles the message.

This way however the application performance is poor but I am not sure whether it is due to multiple broadcast receivers.

Does anyone know what is the best way to exchange data between service and main activity - is it better to create a single broadcast receiver and retrieve all parameters from message or is it better to initialize multiple broadcast receivers for multiple parameters?

View 1 Replies View Related

Android :: How Different Do Broadcast Intents Need To Be?

Oct 30, 2010

I have an IntentService that broadcasts an Intent each time if finishes some work. Each broadcast Intent is identical except that it contains a Bundle with some result information from the IntentService. Evidently, having different data in the Bundle is not enough for Android to think it's a different Intent. If the IntentService broadcasts two of these Intents back-to-back, the second one is dropped as a duplicate.

I know I've read about this behavior in this forum in the past but I can't find in the documentation where this duplicate elimination logic is described in detail. Mostly, I just want to differentiate the Intents enough that they are not considered duplicates. Any pointers would be appreciated.

View 13 Replies View Related

Android :: HTC EVO Can't See UDP Broadcast Packets?

Jul 19, 2010

I'm pretty sure no one but me is using UDP broadcasts but in the rare chance that someone is - has any experienced this? I use UDP broadcast to do LAN multiplayer games - it's how clients discover hosts of games.The EVO can't ever see the games when all my other phones can.

View 4 Replies View Related

Android :: Notification / Broadcast For Sent Sms

Jul 1, 2010

is there any way to be notified (using a broadcast receiver) after a sms is sent? i want to get notified when a sms is sent and carry on with my program.

View 7 Replies View Related

Android :: IP Broadcast On Emulator

Oct 15, 2009

I have an application that acts as both client and server. I have a scenario that I need to test that involves three devices. One of them needs to broadcast a message (UDP) to the other two. Running on physical devices, this is not a problem, and it works fine. On the emulator however, this is much harder. I have managed to get it work for two devices using the emulator. Here my client thread broadcast the message to 10.0.2.255 port 6002, and server thread listens on port 6006. By using redir add udp:6002:6006 the server receives the message fine. Now, if I add another instance and do the same portforwarding, only one of them receives the message. I also tried to use a different port number on the server, and forward port 6002 to that number, with the same result. It appears as if a port can only be forwarded from one instance. Does anyone of a method to broadcast using the emulator, without sending a separate message to each emulator instance?

View 4 Replies View Related

Android :: ACTION_HEADSET_PLUG Broadcast ?

Mar 26, 2010

I've tried these phones: Motorolla Backflip 1.5, Nexus One 2.1

Basically I register BroadcastReceiver to get ACTION_HEADSET_PLUG broadcast and look on 3 extras that come in intent:

state
name
microphone

Here is the description from API:

* state - 0 for unplugged, 1 for plugged.
* name - Headset type, human readable string
* microphone - 1 if headset has a microphone, 0 otherwise

Issue #1: Broadcast comes when activity is started (not expected), when screen rotation happens (not expected) and when headset/headphones plugged/unplugged (expected).

Issue #2: Backflip phone (1.5) sends null for state + microphone, 'No Device' as name when headset/headphones unplugged, and sends null for state + microphone, 'Stereo HeadSet'/'Stereo HeadPhones' as name when headset/headphones plugged.

UPDATE: T-Mobile G1 with 1.6 behaves the same as Backflip phone.

Nexus even worse, it always sends null for state + microphone, 'Headset' as name when headset/headphones plugged or unplugged.

Question: How it can be explained that API is broken so much on both 1.5 and 2.1 versions and different devices, manufactures?

UPDATE:

Code in onCreate of main Activity:

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

Now the code of BroadcastReceiver:

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

View 1 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







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