Android :: How To Unicast An Intent To An Activity With Inner BroadCastReceiver

Aug 18, 2010

I have 2 Activities that need to communicate with each other: ActivityA and ActivityB

Say that ActivityA opens ActivityB. How do I unicast a message from ActivityB to ActivityA without closing ActivityB?

Here's what I tried: setResult() - but the intent will be delivered only when ActivityB closes sendBroadcast() - but this sends the intent to everyone listening to the action.

I only want the action to reach ActivityA since it spawned ActivityB.

I tried having ActivityA registering a BroadCast receiver, but I cannot target that via Intent's SetComponentName(). startActivity() - this brings up ActivityA, which I don't want.

Android :: How to unicast an intent to an Activity with inner BroadCastReceiver


Android :: Don't Receive Intent - While Have A BroadcastReceiver

Sep 1, 2009

My current problem is that I don't receive an intent. I have a BroadcastReceiver and defined in the AndroidManifest.xml file that it also should receive intents with these actions.

View 2 Replies View Related

Android :: Passing Arguments To A BroadcastReceiver Through An Intent

Jan 14, 2010

I have an application, which sets an alarm using AlarmManager, which starts another Activity when it goes off. The AlarmManager takes a PendingIntent and spawns a BroadcastReceiver class when the specified time comes. I'm wondering whether there is any way that I can pass arguments to this BroadcastReceiver through the Intent object which goes into PendingIntent?I'd like to be able to retrieve arg1 in the BroadcastReceiver's onReceive(Context, Intent) method. I figured that the local variable my_intent would be the second parameter passed on to onReceive by the PendingIntent, but apparently that's not quite right. Is it possible to pass parameters between an Activity and a BroadcastReceiver in this fashion (using Intent.putExtra()) or should I use a ContentProvider instead?

View 3 Replies View Related

Android :: BroadcastReceiver Never Getting Boot Completed Intent

Jan 12, 2010

I have a BroadcastReceiver which never enters onReceive(), so to debug I created a bare bones project with a simple BroadcastReceiver and still it never gets the BOOT_COMPLETED intent (see manifest below).

I do see a lot of warnings/errors in my Eclipse log (filtered and after manifest) which didn't seem to cause issues before, but maybe I have a bad install of the emulator? I have all the latest SDK and plugins. I also noticed that when I run the emulator I always get "Waiting for" popup for either Alarm or MMS.

The debugger attaches normally for my main Activity, it's just this "boot" receiver that never seems to start. I've tried using "com.boottest.BootReceiver" instead of".BootReceiver" to no avail.

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

View 4 Replies View Related

Android :: App Contains BroadcastReceiver And Activity

Aug 6, 2009

I want to start a project which contains a BroadcastReceiver and an Activity. The BroadcastReceiver doesn't communicate with the activity. But they share a same resource. Can i do it in only one Project (that means, i use only 1 apk to install both BroadcastReceiver and the Activity on my phone), or i have to develope them seperately in 2 projects.

View 3 Replies View Related

Android :: BroadcastReceiver Communicating With Activity

Feb 26, 2009

Is it possible to update a currently running activity from a BroadcastReceiver? I want to update my activity from a BroadcastReceiver that runs alongside it. When I run my app (from Eclipse), my activity starts. When the BroadcastReceiver is triggered, it currently tries to start the activity (with extras in the bundle...this is the important part), but nothing happens, presumably because the activity is already running. So my question is, how do I get the new information to my Activity (or even just tell the activity that there's new information to get if I stick the information in a database)? This seems like it should be fairly straightforward, but I'm clearly missing something.

View 3 Replies View Related

Android :: BroadcastReceiver To Listen For Activity Being Launched

Jun 22, 2010

I am wondering whether is possible to use a BroadcastReceiver to listen for an Activity being launched. I have no control of the Activity I need to know about as it is from the Android platform.

View 3 Replies View Related

Android :: Call Main Activity From BroadcastReceiver?

Oct 28, 2010

While developing an alarm based application, i have stuck in a scenario.

When my alarm is fired, i can receive the event in BroadCastReceiver::onReceive().
Within this function, i want to notify/call a function, which is located on MainActivity.

How to achieve the same?

View 1 Replies View Related

Android :: Dataflow Between BroadcastReceiver ContentProvider And Activity?

Mar 19, 2009

I've developed an application that receives a Broadcast and then launches an Activity, where that Activity queries a ContentProvider which pulls information out of the DNS in real-time.

I'd like to be able to shuffle this so that instead of going:

CODE:.......

It goes:

CODE:.......

i.e. if the query() returns no data I want to miss out launching the activity, and allow the Broadcast message to fall through as normal.

If the query() does return data, I want that Cursor to be supplied to the Activity, so that I don't have to go and query for the data again.

In turn, the Activity has its own UI which the user needs to respond to.

View 2 Replies View Related

Android :: Best Practice On Updating UI From BroadcastReceiver To A Certain Activity?

Jul 18, 2010

When i have a broadcastReceiver say android.intent.action.MEDIA_BUTTON and i want to update the current activity's UI without creating a new activity, is there any good practice on this one?

What i know (might not be correct)

1) I can put the BroadcastReceiver in the same class as the activity and call the updateUI function after certain activity

2) Create a ContentObserver?

3) Communicate to a service created by the activity, use aidl. (I dont know how to get the current service if its registered from an activity)

4) Create a custom filter on the broadcastReceiver located on the same class as the activity, and use context.sendBroadcast(msg of custom filter) and in the custom filter call updateUI (same as one but more generic?)

The final flow is it would come from a BroadcastReceiver and ends up updating the UI without renewing the activity (unless the activity is dead?)

Kindly provide links/source code on your how you tackle this kind of problem.

View 1 Replies View Related

Android :: Update Activity From BroadcastReceiver / Practice For It?

Mar 3, 2010

Does anyone know how I might go about accessing an Activity in an application from a BroadcastReceiver (in the same application)?

(I have some state information in the Activity I'd like to update)

I'm not sure if there is a best practice for it.

View 2 Replies View Related

Android : Inform Activity From A BroadcastReceiver ONLY If It Is In The Foreground

Feb 17, 2010

Maybe it's easy, but I couldn't really figure this out right so far... I got a BroadcastReceiver waiting to get triggered by the AlarmMangager - this works fine.

Now: because the event, if it occurs, needs to refresh some elements on screen of the main Activity, I would like to send an Intent from that background BroadcastReceiver to my Activity - but only if it is currently in the foreground, aka active.

If it is not running or not visible, I don't care - and the last thing I want to do is start the Activity by my intent! I handle repainting of the views in my onResume method, so I don't care at all.

EDIT: my BroadcastReceiver is waiting for alarms that must be notified to the user. So, it must be there and declared in the manifest. The problem is: it will have to decide whether the mentioned Activity is currently up in front or not.

View 3 Replies View Related

Android : Way To Access To Activity From BroadCastReceiver.onReceive?

Sep 7, 2010

I'm developing alarm application. I'm using listview on activity to reserve alarm. after application finish BroadcastReceiver.onReceive() method, I want to remove check of list. But i dont know how to access to activity.

View 1 Replies View Related

Android :: Pass Data From BroadcastReceiver Through To Activity Being Started?

Apr 11, 2010

I've got an Android application which needs to be woken up sporadically throughout the day.To do this, I'm using the AlarmManager to set up a PendingIntent and have this trigger a BroadcastReceiver. This BroadcastReceiver then starts an Activity to bring the UI to the foreground.All of the above seems to work, in that the Activity launches itself correctly; but I'd like the BroadcastReceiver to notify the Activity that it was started by the alarm (as opposed to being started by the user). To do this I'm trying, from the onReceive() method of the BroadcastReceiver to set a variable in the extras bundle of the intent,Can anyone tell me what's different about passing a bundle from a BroadcastReceiver to an Activity, as opposed to passing the bundle from an Activity to a BroadcastReceiver?

View 2 Replies View Related

Android : Start Activity From Within OnReceive Method Of BroadcastReceiver?

Feb 3, 2009

I am trying to get a UI to present itself when an incoming SMS happens. When that happens, I would like to present a UI to the user.

I have a BroadcastReceiver class that listens to the SMS_RECEIVED event. I also have an Activity class that is capable of displaying the needed UI when the event happens.

The questions is: How do I start the activity from within the onReceive method of BroadcastReceiver?

I know others have done this but I can't seem to find any resources that illustrates how.

View 3 Replies View Related

Android :: Exclude Own Activity From Activity.startActivity - Intent

Oct 17, 2010

My app works with pictures. It can take multiple pictures as an input, process them, and send them again to another app.

As a consequence, my main Activity has declared an intent filter on ACTION_SEND_MULTIPLE for image/* mimetypes and can result in issuing a new Intent with the same action and data type using Activity.startActivity(Intent).

Is there a way to exclude my own activity from the list of apps that is displayed to the user after the startActivity() call ?

View 1 Replies View Related

Android :: Handle Existing Instance Root Activity Launching Root Activity From Intent Filter

Apr 3, 2010

I'm having difficulties handling multiple instances of my root (main) activity for my application. My app in question has an intent filter in place to launch my application when opening an email attatchment from the "Email" app. My problem is if I launch my application first through the the android applications screen and then launch my application via opening the Email attachment it creates two instances of my root activity. steps: Launch root activity A, press home Open email attachment, intent filter triggers launches root activity A Is it possible when opening the Email attachment that when the OS tries to launch my application it detects there is already an instance of it running and use that or remove/clear that instance?

View 1 Replies View Related

Android : Way To Get Activity From An Intent?

Nov 2, 2010

Is it possible to get the Activity from an Intent?

View 2 Replies View Related

Android :: Set Root Activity/intent ?

Oct 14, 2010

I'm switching between different Activities using Intents. For one Activity, I would like it to clear the history stack so when the user presses the back button, it takes them Home instead of previous activities in my application.

View 2 Replies View Related

Android : Way To Handl An Intent Without Activity UI?

Jun 9, 2009

I've searched for a few hours for a solution to this, so hopefully this isn't a repost I'm setting a shortcut on the Home screen which raises an Intent to my application - the problem is that I don't want to show my app, just run a little code and display a Toast notification. This must be possible - I just can't work out how.. Once I'm handling the shortcut Intent in onCreate() the UI has initialised and I get a little screen flicker if I then run my code and finish().

View 4 Replies View Related

Android : How To Use An Intent To Update An Activity?

Aug 24, 2009

I have a service that is downloading a file. When the download is done, I would like to update my "Downloaded files" list in my Activity, but only if the Activity is running. I do not want the Activity to start if it's not already running. I was hoping I could do this by making a new Intent with some special flag. Anyone have any idea how I can achieve this? A tiny code example maybe?

View 3 Replies View Related

Android : Way To Use Intent From Non-activity Class?

Jan 2, 2010

I have three classes one main-activity(named MainMap), one non-activity class(named MyItemizedOverlay), and one activity class(named AudioStream). I want to start AudioStream activity from non-activity class but i don't know how to.

View 1 Replies View Related

Android : How To Use Intent.getStringExtra From Within An Activity?

May 27, 2010

I am relatively new to android. I have two applications A and B. I have an activity in A, lets name it x, that would launch the application B. Now the intent sent by x contains StringExtra that I want the Starting activity in B to use. Is there a way for the activity in B to do that?

View 2 Replies View Related

Android : Way To Define Two Intent In An Activity?

Jul 6, 2010

I need to start an Activity with two different Intent, can I define two Intents In an Activity node?

View 1 Replies View Related

Android : Way To Use Intent To Update A Value In Another Activity?

Sep 1, 2010

I want to pass a value from one Activity to another to update an integer. So basically I want Activity2 to send Activity1 a value it has garnered from user input. Seems like it should be simple just not sure how. Is it possible to run a function from another Activity and give it this value as an argument?

View 1 Replies View Related

Android :: Use An Intent To Send Data To My Activity

Nov 6, 2010

I have a server running that notifies the user with a statusbar notification that opens my main activity, how can I pass data to my activity trough that intent?

View 1 Replies View Related

Android :: Want Activity / Service To Communicate With Intent

Aug 2, 2010

In the Activity I write Intent i=new Intent("IntentServiceTest"); Bundle bundle = new Bundle(); bundle.putString("abc", "def"); i.putExtra("wer", bundle); IntentTest.this.startService(i); Start Service into Service OnCreate method,but I don't know how to do get this Intent in this method.

View 11 Replies View Related

Android :: Using Intent - Application To Show Another Activity

Apr 10, 2009

In my Android application, I have two activity classes. I have a button on the first one and I want to show the second when it is clicked, but I get an error.

Here are the classes:

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

The second class that should show when the button is clicked, but never does:

CODE:........

How do I create a button that will show the second activity?

View 3 Replies View Related

Android :: Oncreate - Intent Launches My Activity

Sep 30, 2010

Android will call onCreate() of my activity whenever it is launched.

In the onCreate() of my activity can I tell what intent launches my activity?

View 1 Replies View Related

Android :: Image Intent From URL To Browser Or Other Activity

Oct 6, 2010

I want to have an image open from a URL to an intent, most likely the browser or maybe a picture previewer like the one built into twidroyd.I've gotten plain URLs to open to the browser. I just can't figure out what action or category to specify,

View 1 Replies View Related







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