Android :: Sending Broadcast Intent From Runnable

Jul 10, 2010

I want to send a broadcast from a new thread is start.

This is what i tried:

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

But ofcourse i need context..this won't work. How can i handle this.

Android :: sending broadcast intent from runnable


Android :: Sending / Receiving Custom Broadcast Intent

Jul 25, 2009

I'm building a service that sends a broadcast intent when some value changes. The service sends the broadcast like this:

Intent broadcastIntent = new Intent(); broadcastIntent.setAction("nl.vu.contextframework.NEWREADING"); broadcastIntent.setData(Uri.parse("context://"+cer.getKey())); broadcastIntent.putExtra("reading",cer); broadcastIntent.addCategory("nl.vu.contextframework.CONTEXT"); sendBroadcast(broadcastIntent);

In some Activity (in a different process), I'm tryint to receive this broadcast as follows:

IntentFilter intentFilter = new IntentFilter();
intentFilter.addDataScheme("context");
intentFilter.addCategory(CATEGORY_CONTEXT);
registerReceiver(new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
Log.d(TAG,"Received intent "+intent); }
}, intentFilter);

View 6 Replies View Related

Android :: Broadcast Intent For USB Power?

Feb 20, 2010

Is there a Broadcast Intent that gets sent out when the device is plugged in for power? I want to create a BroadcastReceiver to detect the device's plugged in state.

I've looked everywhere in the Developer's resources and reference, but I can't find anything that resembles what I'm trying to do.

View 4 Replies View Related

Android :: Way To Broadcast Any Intent As New Email Received?

Jul 28, 2010

Do any one know how to broadcast any intent if new email is received?

View 8 Replies View Related

Android :: Start Another Activity With Broadcast Intent

Nov 29, 2009

I'm trying to start an activity out of a widget so I can't use the startActivity() function. So I'm trying to create the correct intent but I don't find what I'm missing.

View 2 Replies View Related

Android :: Create A New Intent For Another App's Broadcast Receiver?

Jul 23, 2010

In the examples, they create Intent as:

Intent intent = new Intent(this, AlarmReceiver.class);

But suppose my AlarmReceiver class is in another app, how do I create this intent?

I've tried with

new Intent("com.app.AlarmReceiver")

but nothing happens.. It was not called..

--Broadcast definition added using the manifest editor on Eclipse:

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

View 1 Replies View Related

Android :: How To Broadcast Intent From Native Code

Nov 2, 2010

Is it possible to broadcast an Intent from native code? If so, is there documentation and/or sample code pertaining to the relevant APIs?

View 1 Replies View Related

Android :: Way To Determine Sender Of Broadcast Intent

Sep 20, 2010

I have an application that is at the same time a broadcast sender and receiver of standard action android.intent.action.SET_WALLPAPER. I want to do some stuff only in a case when another application broadcasted this intent.

Is there any way to determine who initiated a broadcast in onReceive method of a BroadcastReceiver?

View 1 Replies View Related

Android :: How Broadcast Receiver And Intent Filter Behaves?

Jul 6, 2010

I am new to android platform.please help me out how the Broadcast Receiver and Intent Filter behaves in android.please explain in simple line or with example.

View 1 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 Intent When Network State Has Changend

Apr 20, 2010

Does Android broadcast an intent when the network state has changend, i.e. from GSM to Wifi? And if so what permission do I need and what is the intent action called?

View 3 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 :: Listen For Entries To Log / Broadcast Intent For When Log Entry Is Appended?

Aug 22, 2010

Is it possible to listen for entries to the log?
Ie is there a broadcast intent for when a log entry is appended?

View 1 Replies View Related

Android :: Data Lost When Sending Bundle With PendingIntent To Broadcast Receiver

Sep 16, 2010

I am adding some basic alarm functionality to my program via the use of AlarmManager and a BroadcastReceiver class (named AReceiver.java). My problem is that the data I add to the bundle attached to the Intent creating the PendingIntent appears to be lost. The only bundle data I can access in the AReceiver class is a android.intent.extra.ALARM_COUNT=1. Here is the basic code in the main activity class creating the Intent, PendingIntent and the AlarmManager: [Code in main activity - Notepadv3]

Intent intent = new Intent(Notepadv3.this, AReceiver.class);
intent.putExtra("teststring","hello, passed string in Extra");
PendingIntent alarmIntent = PendingIntent.getBroadcast(this, pendingPeriodIntentId, intent, 0);
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, timeOfNextPeriod.getTimeInMillis(), alarmIntent);..................

View 1 Replies View Related

Android :: Sending LinkedHashMap To Intent

Nov 12, 2010

I want send LinkedHashMap to another Intent.

But I don't known what method for extras is allowable.

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

View 1 Replies View Related

Android :: Sending Event / Intent To AppWidgetProvider

Sep 30, 2009

From a service that's running, how do I send an event or an intent to an app widget that is just sitting their idle.

View 6 Replies View Related

Android :: Broadcast Event / Android Intent Action

Mar 25, 2010

I added broadcast listener "BATTERY_CHANGED" to Android Manifest file so that when the status changed I should get informed. I am adding to Android Manifest file as I want it active through my application life time. But the problem is that I am not getting the broad cast event from the system when battery status changes.

My code is here :-
<receiver android:name=".MyBroadcastReceiver" android:enabled="true"
android:permission="android.permission.BROADCAST_STICKY">
<intent-filter>
<action android:name="android.intent.action.BATTERY_CHANGED" />
</intent-filter> </receiver>
<uses-permission android:name="android.permission.BATTERY_STATS"/>
<uses-permission android:name="android.permission.BROADCAST_STICKY"/>

View 10 Replies View Related

Android :: Android - Difference Between Intent And Broadcast Receiver

Aug 30, 2010

I am new to android. I what to know the difference between Intent and Broadcast Receiver. I am more confused with Broadcast receiver then Intent. Simple codes will be helpful.

View 1 Replies View Related

Android :: Sending An Object To A Service Through Intent Without Binding

Feb 12, 2010

Is is possible to send an object to an Android Service through an Intent without actually binding to the service? Or maybe another way for the Service to access Objects...

View 2 Replies View Related

Android :: Sending An Intent From RuntimeInit Crash Handlers

Dec 2, 2009

I want to send an intent from a crash handler [ crash(String tag, Throwable t) in RuntimeInit.java) ] to an activity (stand alone appllication)

I tried to send it from above handler as follows..

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

But i failed to send an intent to my application..

Can i send an intent to my application fro RuntimeInit.java handlers?

View 3 Replies View Related

Android : Droid Email Intent Not Sending Attached File / Fix It?

Aug 29, 2010

I have created an app that sends an email with a recording, When the intent is fired and email is chosen as the app to send the attachment, you can see that there is an attachement but the attachment is not delivered. code...

View 1 Replies View Related

Android :: Sending Android Intent With POJO Inside?

Oct 7, 2010

Is their a way to put a POJO inside the intent.putExtra? I have looked into the API's and it only seems to support of type string, int, double, boolean etc. But not a actual POJO / regular Java object.

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 :: Runnable Interface

Mar 24, 2010

I'm having hard times getting my GL thread (from GLSurfaceView) to trigger some code execution within the UI thread (from Activity). I tried it in every possible way (well not every, I missed at least the good one) none worked.

My idea was to get something called from the UI thread (to update some widgets) when the surface is effectively created. So I added to my onSurfaceCreated method the following call:

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

This compiles, but when my GLSurfaceView sub-class is constructed a NoClassDefFound exception is thrown, telling me that the class com.my.package.MyGLSurfaceView$1 is not found.

Here's the log:

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

The line 297 in MySurfaceView.java is:

private Runnable mUpdater = new Runable () { public void run () { [...] } };

View 5 Replies View Related

Android :: Updating UI From Runnable

Oct 3, 2009

I didn't found clear answer for why my code does not work. I assume it is because I am trying to update textview from runnable. Anybody know some workaround? Code isn't clean off course, I am happy to get that working so far as I am totally new in java.

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

View 6 Replies View Related

Android :: Runnable Posted Successfully But Not Run / Fix It?

Nov 3, 2010

In an existing Android project I've encountered the following piece of code (where I inserted the debugging litter) code...

with not a trace of the messages from the Runnable. So appearantly the Runnable doesn't run(), although img.post() returns true. Pulling the ImageView in onCreate() and declaring it final doesn't help.

I'm clueless. Simply setting the bitmap directly, while blocking the UI thread, does fix things, but I want to get things right. Does anybody understand what's going on here?

(ps. this was all observed on an Android 1.6 phone and android-3 sdk)

View 2 Replies View Related

Android :: How To Run A Runnable Thread In Droid

Dec 17, 2009

I developed one small application to display some text at defined intervals in the android emulator screen.I am using Handler class, small snippet from my code...

When i run this appication the text is displayed only one time.Please any one knows how to run a thread using Handler.

View 1 Replies View Related

Android :: Updating UI With Runnable & PostDelayed Not Working With Timer App

Sep 21, 2010

I have looked at every discussion and thread I can find on getting this to work but it is not. I have a simple timer that updates a text view (mTimeTextField in the example below). The mUpdateTimeTask run method is being executed correctly (every second) but the UI/text field is not being updated.

Here is the code:....................

View 2 Replies View Related

Android : Valid Context Inside Runnable That Will Do Insert?

Nov 6, 2009

I'm trying to do an insert to a DB as a result of a user clicking on a button. I want to do the actual insert in the background, so it seems I should use a Handler to do this. The SQLite insert method takes a Context parameter. My problem is how do I get a valid Context inside the Runnable that will do the insert?

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







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