broadcastreceiver

Android Widget Click and Broadcast Receiver Not Working

我怕爱的太早我们不能终老 提交于 2019-12-21 16:53:51
问题 The below code should describe an app where once the widget button is clicked, it sends off an intent that should be received by TestReceiver. However, in running my below code, the onReceive of TestReceiver is never called. Could someone let me know what I'm doing wrong? Widget code public class Widget extends AppWidgetProvider { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { final int N = appWidgetIds.length; // Perform this loop procedure for

are multiple broadcast receivers legal in android?

徘徊边缘 提交于 2019-12-21 12:27:08
问题 Is this true? Only one BroadcastReceiver class can be specified per application. Should you need to incorporate two or more BroadcastReceivers from different SDKs, you will need to create your own BroadcastReceiver class that will receive all broadcasts and call the appropriate BroadcastReceivers for each type of Broadcast. http://code.google.com/apis/analytics/docs/mobile/android.html#google-play-tracking There is no mention of this in the manifest documentation for <receiver/> http:/

Broadcast receiver works differently on different Version of Android (4.1.1 & 4.2.2)

℡╲_俬逩灬. 提交于 2019-12-21 12:12:04
问题 I have a problem that when I run my Android App which has Broadcast Receiver for WiFi . it perform differently on different version of Android OS (Like 4.1.1 and 4.2.2 ). When I run it on 4.1.1 it works perfect like Broadcast receiver receive the Broad cast when Wifi state changed.(on Disconnect wifi broadcast receive I have calculate Total time for wifi connection and store it in database). but when I run it on 4.2.2 , Broadcast Receiver calls twice when Wifi is disconnected so at that time

Android - How to start an application on the /sdcard after boot

三世轮回 提交于 2019-12-21 06:57:17
问题 Is there a way how to start and android application after a boot automatically if it is on the /sdcard ? Ok, probably by BroadcastReceiver . But which action is the right one? ACTION_BOOT_COMPLETED - does not work if it is on the /sdcard (documented) ACTION_MEDIA_MOUNTED - does not work if it is on the /sdcard (which is undocumented) ACTION_EXTERNAL_APPLICATIONS_AVAILABLE - does not work, I do not know why ACTION_USER_PRESENT - does not work if the BroadcastReceiver is registered in

Receive volume key press events when phone is in deep sleep

随声附和 提交于 2019-12-21 06:37:35
问题 I'm trying to catch Volume Up/Down pressing events when phone is in deep sleep mode. I have read several articles and here what I have done. In Activities onCreate method I set a WakeLock PowerManager mgr = (PowerManager)this.getSystemService(Context.POWER_SERVICE); WakeLock wakeLock = mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MyWakeLock"); wakeLock.acquire(); I have read that even if my screen is locked if I set this my application will respond to events. Also I have added permission

how to get the state for outgoing calls

女生的网名这么多〃 提交于 2019-12-21 06:06:37
问题 In the OnReceive method I have something like this: Bundle bundle=intent.getExtras(); String phonenumber=intent.getStrngExtra(Intent.EXTRA_PHONE_NUMBER); How to chech if the dialing call is still on or the client hanged up the call? How to check if the call was answered? I need to print up a toat when the client hanged up the call or when the called client answered to the call. 回答1: you can use the below code for handling call state::: private Runnable callMonitor = new Runnable() { public

Wallpaper change event

醉酒当歌 提交于 2019-12-21 06:06:34
问题 Can I get a wallpaper changed event in a broadcast receiver? I need to detect if the user changed the wall paper. How could I do it? What I am doing is this: I have an app that changes wallpaper automaticly. If the user changes it manually using a different aplication I would like to notice it and ask the users if he/she wants to add that new wallpaper to the list in my application 回答1: There is only a broadcast for when a wallpaper image changes: http://developer.android.com/reference

Calling BroadCastReceiver from Service in android to Update UI in Fragment?

我的梦境 提交于 2019-12-21 05:57:06
问题 I want to update the UI of a fragment from service .I am using GCM for sending message.I have this class for GCM : public class GcmIntentService extends IntentService { public GcmIntentService() { super("GcmIntentService"); } @Override protected void onHandleIntent(Intent intent) { Bundle extras = intent.getExtras(); GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this); // The getMessageType() intent parameter must be the intent you received // in your BroadcastReceiver. String

Calling BroadCastReceiver from Service in android to Update UI in Fragment?

萝らか妹 提交于 2019-12-21 05:57:01
问题 I want to update the UI of a fragment from service .I am using GCM for sending message.I have this class for GCM : public class GcmIntentService extends IntentService { public GcmIntentService() { super("GcmIntentService"); } @Override protected void onHandleIntent(Intent intent) { Bundle extras = intent.getExtras(); GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this); // The getMessageType() intent parameter must be the intent you received // in your BroadcastReceiver. String

Receive intent “android.settings.APPLICATION_DETAILS_SETTINGS” for my app

核能气质少年 提交于 2019-12-21 05:49:23
问题 I want to get the package name and class name of the received intent , But am not able to get it. I want to make my app secure so it asks for password before being uninstalled. Only the user who Installed the app knows the password, so only he/she can uninstall the app. My code for Receiver: public class PackageReceiver extends BroadcastReceiver { @ Override public void onReceive (Context context, Intent intent) { if (intent.getAction().equals("android.settings.APPLICATION_DETAILS_SETTINGS"))