Android :: Recieve Broadcast Action In An Activity?

Feb 14, 2010

Can I receive a broadcast event in an activity? I've seen this done in broadcast receivers but not in an activity. In particular I would like to receive an event when a bluetooth device is found. ACTION_DISCOVERY_FINISHED.

Do I need to declare that in the activity intent filters? Should I be using permissions for that? How do I define the callback to handle that in the activity when i get receive the action?

Android :: recieve broadcast action in an Activity?


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 :: Recieve Data From Activity In Droid?

Jun 3, 2010

I want one sample code for startActivityForResult().
Please explain how it works?

View 1 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 :: 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 :: Transfer An Action (ex:key Press) From An Activity To Other?

Mar 12, 2009

When my application is running, a button is pressed.After my application processes this event, i want to continue to transfer this event to other applications. Is it possible? If yes, how to do that?

View 6 Replies View Related

Android :: Starting An Activity From Broadcast Receiver

May 28, 2010

I am trying to launch the Main Activity from a broadcast receiver. Can anyone guide me as to how I can do it? I always get "Process is Bad" message.

View 1 Replies View Related

Android :: How To Call Broadcast Receiver From Activity?

Jul 9, 2010

I have a broadcast class that blocks the incoming call. I want to call that broadcast receiver from the activity ? Can any one help me fix this. I appreciate your help. 1. Class A extends activity will call Class B that extends BroadcastReceiver, now I want to block calls , only based on certain requirements, which are checked in Class A, if true then call the Class B (or block the call in short)

View 3 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 :: Possible To Start Activity When Received Broadcast?

Dec 8, 2009

I found that the "onReceive" of broadcast intent can't start an activity explicitly. Is there any way to start an activity when I receive a broadcast? eg: I need an interaction UI with user when specific package has been installed in the system.

View 3 Replies View Related

Android :: Start A New Activity From A Menu Action - ActivityNotFoundException

Feb 28, 2010

I am trying to start a new activity from a menu action, as follows:

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

The class exists, and has the OnCreate method over-ridden, but whenever I try to perform the action in the simulator I get an ActivityNotFoundException raised. I have looked through the documents and as far as I can read, I do not need to create an Intent in the manifest.xml for this to work.

View 3 Replies View Related

Android :: Starting Translucent Activity From Broadcast Receiver

Sep 30, 2010

I got a graphical problem regarding the Translucent theme at Samsung Galaxy i9000.It works well in the emulator with android version ranging from 1.6 to 2.2 as well as on SE x10 mini.I have yet to test on more devices.I am starting an activity from a broadcast receiver. The activity started got the theme @android:style/Theme.Translucent If all the activities in my application are destroyed when the broadcast occurs, then the new activity got a working translucent theme and is presented on top of the activity currently in front. However, if the user left the application with the HOME-key, not destroying the activity, I get a graphical bug when the broadcast triggers. The application gets brought to the front with the activity the user last visited showing instead of the new activity that I started from my broadcast receiver. When I press the back key I can see my Translucent activity quickly showing itself and then getting destroyed.This flow results in the graphical bug: Start application. Activity A will be shown. Leave application by pressing HOME-key. Home screen is shown. Trigger broadcast. Start activity B.

Application gets brought to foreground and activity A is shown. Press BACK-key. Activity B quickly shows itself and disappears. Now activity A is shown.Also, after activity B is started and when activity A is shown in its place. Pressing the screen will triggers buttons that belong in activity B even if the user can't see them. If I remove the theme, then activity B will show itself when it's supposed to.Is there anyone else who have encountered a similar problem? Is there any good workarounds I can apply? (I don't want to rebind home to finish all activities) Is the problem my fault or can there possibly be some glitch in Touchwiz?

View 2 Replies View Related

Android :: Broadcast Receiver / Service Will Only Restart Activity Once

Mar 17, 2010

I have a single Activity application, within it I have a service which creates an AlarmManager and sends a broadcast to a broadcast Receiver.If the activity which starts the services dies, (ie. divide by zero), the broadcast receiver stops the old service which created the AlarmManager.It works the first time. The second time, it does not.It seems like the AlarmManager is still active but the broadcast receiver is no longer receiving. It works great once!

View 2 Replies View Related

Android :: Update Activity / Layout From Within Broadcast Receiver

Jun 29, 2010

I have a layout with two buttons, I want to disable or make unclikable one of the buttons when internet connection is lost and back to clickable when connection is regained. From my broadcast receiver I am calling another class(which extends activity and thus can call findViewById) which is attempting to change the main layout. App is force closing. What am I doing wrong here, any other ideas as to how to achieve what I am trying to do.

View 4 Replies View Related

Android :: Notify Running Activity From Broadcast Receiver?

Jun 26, 2010

I have an activity, it needs to response to a broadcast event.Since an activity can not be a broadcast receiver at the same time,I made a broadcast receiver.My question is: how can I notify the activity from the broadcast receiver?I believe this is a common situation, so is there a design pattern for this?

View 1 Replies View Related

Android :: How To Send Data From Broadcast Receiver To Activity?

Mar 25, 2010

I am writing an application to listen the SMS inbox in android with one activity and one BroadcastReceiver. Once the SMS comes the Receiver is showing alert message. But I want to send the message information from Receiver to Activity. I don't know how to achieve this.

View 2 Replies View Related

Android :: Broadcast Message Leave Activity In Background

Oct 31, 2010

My app's main activity listens to a broadcast message. When it receives the message it brings the activity to the front. I want to update the activity if it is in the front, so the user is playing with it, but otherwise I do not want to bring the activity to the front. How should I do it? Is there a flag for invoking the intent, or what?

View 4 Replies View Related

Android :: Unable To Launch An Activity Using Implicit Intent Specifying Only Action

Mar 5, 2010

I am trying to launch an activity by specifying only its action(custom) defined in its intent filter from an activity in other application. The activity to be launched is the main activity of its application thus have android.intent.action.MAIN & android.intent.category.LAUNCHER set as action and category in its intent filter. Now according to android doc on Intent and Intent Filter, i do not need to specify DEFAULT category at all in this case. But doing the same i am i am unable to launch the activity.

LogCat says, Activity could not be found...

Am i misinterpreting the text or is there something else missing...?

Code, used for calling the activity

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

Definition of Activity being called in the manifest file

COE:....................

View 1 Replies View Related

Android :: Intent Set Action Activity's / Get Free Online Tutorial?

Nov 12, 2010

Can any one suggest some helpful links so that I can get free online tutorial?

View 1 Replies View Related

Android : Close Current Activity When An Action Happens In Custom View

Oct 13, 2010

I have a toolbar view set for most of my activities.

The toolbar has several buttons which all trigger certain intents. Now, the problem is: how can I close current activity before starting another one ?

Problem 1) Activity cones For instance one of the buttons ('A') starts activity A. Activity A also has toolbar. If you press on the 'A' button, a new A activity will be started. I suppose I can look at Activity.getInstanceCount(), right ?

Problem 2) Unnecessary activities The activity X is not needed any more if the opts for A. I just want A then. How can I remove X from toolbar which only has access to context ?

I, of course could find toolbar view inside activity X and override the onClicks, but in general this would mean doing so for all my activities !? Am I on the right track ?

View 2 Replies View Related

Android : Wire A Button Action Without Activity Implementing View.OnClickListener

May 11, 2010

I'm starting with Scala + Android (and using the sbt android plugin). I'm trying to wire a button action to a button without the activity implementing View.OnClickListener.

The button click fails at runtime because the method cannot be found. The document I'm working through says that I need only declare a public void method taking a View on the action, and use that method name in the layout.

What have I done wrong? MainActivity.scala package net.badgerhunt.hwa

import android.app.Activity
import android.os.Bundle
import android.widget.Button
import android.view.View
import java.util.Date. Code...

View 1 Replies View Related

Android :: Broadcast Receiver Can't Receive UMS_CONNECTED - UMS_DISCONNECTED Msg Dynamically In Activity?

Nov 20, 2009

I was make source to catch and process SD Card mount/unmount broadcast received dynamically in activity.

but the USM_CONNECTED/DISCONNECTED broadcast msg is not catched dynamically in activity like below:.

how the receiver can receive the UMS msg in activity?

below:

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

View 3 Replies View Related

Android :: Catch.intent.action.ACTION UMS CONNECTED Event

Nov 3, 2010

I want to show some notification when android phone is connected to system. I implemented BroadcastReceiver for listening to event android.intent.action.ACTION_UMS_CONNECTED in my application But it is not working. Is it possible to capture this event.

View 3 Replies View Related

Android :: Supplying Action / Data Where Filter Had Only Action

Oct 31, 2010

I thought that Action was preeminent during intent resolution and if the intent had the same action as the intent filter, it would be considered a match regardless of data, if the filter did not specify anything. So I was very surprised to find that supplying action+data where filter had only action, causes it to fail. In the code below, if you comment out line 47 so that data is *not* sent, only then it resolves correctly. To get it to work with the data (an id that is simply a String), what mime type should I specify in the intent filter?

View 11 Replies View Related

Android :: Android - SMS Broadcast Receiver / No Launcher Activity Found

Nov 7, 2010

I have been trying to get this program to work but so far having no luck. I cannot find where I am doing wrong. I'm not sure if there's something wrong with the code, or debugging.

Here is my program:
package Technicaljar.SMSBroadcastReceiver;
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 SMSBroadcastReceiver extends BroadcastReceiver {
private static final String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
private static final String TAG = "SMSBroadcastReceiver";
@Override
public void onReceive(Context context, Intent intent) {
Log.i(TAG, "Intent received: " + intent.getAction());
if (intent.getAction() == SMS_RECEIVED) {
Bundle bundle = intent.getExtras();
if (bundle != null) {
Object[] pdus = (Object[])bundle.get("pdus");
final SmsMessage[] messages = new SmsMessage[pdus.length];
for (int i = 0; i < pdus.length; i++) {
messages[i] = SmsMessage.createFromPdu((byte[])pdus[i]);
} if (messages.length > -1) {
Log.i(TAG, "Message recieved: " + messages[0].getMessageBody());
} } } } }

And the manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="Technicaljar.SMSBroadcastReceiver"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true" >
<receiver android:name=".SMSBroadcastReceiver">
<intent-filter>
<action android:name="android.provider.telephony.SMS_RECEIVED"></action>
</intent-filter>
</receiver>
</application>
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.INTERNET">
</uses-permission>
<uses-permission android:name="android.permission.RECEIVE_SMS">
</uses-permission>
</manifest>

I am sending SMS through Telnet, and I cannot see any Intent received messages in the logcat. Here is my logcat from the time of installation.

D/AndroidRuntime( 478):
D/AndroidRuntime( 478): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 478): CheckJNI is ON
D/AndroidRuntime( 478): --- registering native functions ---
D/AndroidRuntime( 478): Shutting down VM
D/dalvikvm( 478): Debugger has detached; object registry had 1 entries
I/AndroidRuntime( 478): NOTE: attach of thread 'Binder Thread #3' failed
D/Mms:app ( 220): getSmsNewMessageNotificationInfo: count=14, first addr=12345, thread_id=4
D/dalvikvm( 151): GC_EXPLICIT freed 391 objects / 22552 bytes in 65ms
D/dalvikvm( 220): GC_EXPLICIT freed 926 objects / 44840 bytes in 73ms

So the SMS seems to be received by the emulator, but looks like the no intents are firing.
What am I doing wrong here? After installing, do I have to somehow 'start' this receiver?
Because when I install, I get

[2010-11-07 21:24:41 - SMSBroadcastReceiver] No Launcher activity found!
[2010-11-07 21:24:41 - SMSBroadcastReceiver] The launch will only sync the application package on the device!

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 :: Implicit Intent - Call To Another Activity Doesnt Work If Action Name Is Defined As User Defined Names

Sep 8, 2010

implicit intent with class name as action defined in intentfilter. is not working. Only it it is defined as "android.intent.action." it is picked up ? is it so ?

I have app A with the following in manifest.xml file

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

In app B, i tried to call the activity in A using below code.

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

This code works. But not above line.

View 2 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 :: Send Email Without Invoking Any Activity (with Send / Send To Action)?

Sep 8, 2009

Can I send an email without invoking any activity (with Send/SendTo action)? Just compose a mail and send to recipient from my application.

View 7 Replies View Related

Android :: Get Email Recieve Notification From Intents?

Jul 28, 2009

could i get email recieve notification from the Intent. how can i get the email recieve notification.

View 4 Replies View Related







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