broadcastreceiver

IntentService LocalBroadcastManager not reaching Receiver

夙愿已清 提交于 2019-12-08 08:49:17
问题 I'm using Android Studio 1.3, I have an IntentService setup that gathers some data and sends it out via a LocalBroadcastManager as so: IntentService public class cService extends IntentService { public cService(){ super("cService"); } @Override protected void onHandleIntent(Intent intent) { SoapPrimitive response = (SoapPrimitive)envelope.getResponse(); Intent broadcastIntent = new Intent("action.getTestData"); broadcastIntent.putExtra("data", response.toString()); LocalBroadcastManager

Android kill process from broadcast receiver

六月ゝ 毕业季﹏ 提交于 2019-12-08 08:15:48
问题 Hi i'm looking to kill an activity in my application when the usb is disconnected i have a broadcast receiver and all set up and working fine public class USBOff extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Intent intent1 = new Intent(context, SdcardOff.class); startActivity(intent1); finish(); } } This code however tells me that the finish method and startActivity methods need to be created? why is this not working thank you for any help with

error : BroadcastReceiver trying to return result

北慕城南 提交于 2019-12-08 08:10:36
问题 I am trying to understand when device is connected to internet. but I get this error : 03-12 20:35:06.801: E/BroadcastReceiver(28892): BroadcastReceiver trying to return result during a non-ordered broadcast My BroadcastReceiver : public class ConnectivityChangeReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // Explicitly specify that which service class will handle the intent. ComponentName comp = new ComponentName(context.getPackageName

BroadcastReceiver for Package_Install not working

泪湿孤枕 提交于 2019-12-08 08:02:02
问题 @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub Toast.makeText(context, "Package Received", Toast.LENGTH_SHORT).show(); Log.d("Package Installing", "Package Installing"); String action=intent.getAction(); if(action.equals(intent.ACTION_PACKAGE_INSTALL)) { Toast.makeText(context, "Package Added", Toast.LENGTH_SHORT).show(); Log.d("Package INstalling", "Package Installed"); } } //My Manifest File: <receiver android:name="com.example

Android: intercept Youtube intents?

我与影子孤独终老i 提交于 2019-12-08 07:28:47
问题 I would like to intercept an intent with a BroadcastReceiver, in the youtube app, when a video starts to play - I managed to read this from the logs: Starting: Intent { cmp=com.google.android.youtube/.WatchActivity (has extras) } from pid 18710 I tried to add this to the manifest: <intent-filter> <component android:name="com.google.android.youtube/.WatchActivity"/> </intent-filter> But this didn't work. What do you think? 回答1: If you want to let your app respond to specifically formed HTTP

Why my BroadcastReceiver doesn't work?

随声附和 提交于 2019-12-08 07:08:42
问题 I'm trying to learn to use Android BroadcasReceiver. I wrote this code but It doesn't work... I tryed for example to change the Time etc... What is it wrong? I added in the Manifest: <receiver android:name="com.example.broadcastreceiverspike.Broadcast" > <intent-filter android:priority="100"> <action android:name="android.intent.action.ACTION_SCREEN_ON" /> <action android:name="android.intent.action.ACTION_SCREEN_OFF" /> <action android:name="android.intent.action.TIME_SET" /> </intent-filter

How to run BroadcastReceiver after every minute?

大憨熊 提交于 2019-12-08 06:15:35
问题 I am developing an application to monitor the network after every minute. i am using a BroadcastReceiver for this. I want to execute the BroadcastReceiver after every minute. How can I do it? can i use Thread.sleep() in BroadcastReceiver? Is it okay to continuously keep running BroadcastReceiver in android? 回答1: BroadcastReceievers are designed to run only when some broadcast is received (System broadcast or user defined broadcast). In case you want to run some code every minute, you can

Check network connectivity android

你。 提交于 2019-12-08 05:57:34
问题 I am new using Service in Android and I am quite confused. I have and Activity and I want to check for all the time that the network connection is up (wifi or 3g). I implemented a simple Service and a BroadcastReveiver . here the code of the Service public class NetworkCheck extends IntentService { private final String CONNECTION = "connection"; public NetworkCheck(String name) { super(name); } @Override protected void onHandleIntent(Intent workIntent) { ConnectivityManager conMgr =

Is onDestroy called only if you explicitly call finish() ?? or are there any exceptions?

只谈情不闲聊 提交于 2019-12-08 05:20:48
问题 I have a LocalBroadcastReceiver and I am unregistering it in my ondestroy() . Now i read about ondestroy() mentioned in these two SO answers is-ondestroy-not-always-called and why-implement-ondestroy-if-it-is-not-guaranteed-to-be-called and as well as in Androi Docs that onDestroy will be called if you explicitly call finish(); But why in my case I am not calling finish() but still ondestroy() is getting called everytime in all of my Android devices. Also according to you guys where are the

Displaying a notification when bluetooth is disconnected - Android

久未见 提交于 2019-12-08 05:00:56
问题 I am trying to create a program that will display a notification to the user if a Blue tooth device suddenly comes out of range from my Android device. I currently have the following code but no notification is displayed. I was wondering if it was possible I shouldn't use ACTION_ACL_DISCONNECTED because I believe the bluetooth stack would be expecting packets that state a disconnect is requested. My requirements state that the bluetooth device will disconnect without warning. Thank you for