broadcastreceiver

SMS BroadCast Receiver receives many times?

送分小仙女□ 提交于 2019-12-10 16:46:29
问题 I am using sms broadcast receiver in my application. When i send first sms it popups one message as sms sent. when i sent second request the popup message get doubled. In third time it tripled and so on. I am using following code for sending and receiving the broadcast. private void sendRequest() { String SENT = "SMS_SENT"; String DELIVERED = "SMS_DELIVERED"; PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT), 0); PendingIntent deliveredPI = PendingIntent.getBroadcast

Android passing data from Activity to BroadcastReceiver shows null

Deadly 提交于 2019-12-10 16:32:31
问题 I've got an activity which uses an AlarmManager to call a BroadcastReceiver at a particular point in time. This all works fine, except when I try to add some extra strings to the intent when calling the BroadcastReceiver, they always come up as null on the other end. Activity code: Intent intent = new Intent(this, ScheduleReceiver.class); intent.putExtra("testString", "I'm a string"); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 999, intent, 0); AlarmManager alarmManager =

Locally managed broadcast receiver leak?

 ̄綄美尐妖づ 提交于 2019-12-10 16:16:44
问题 Is it possible that a local (i.e. managed with LocalBroadcastManager) BroadcastReceiver leaks when the app is killed by the system? The specific use case for which I need it is that I would like to register/unregister the BroadcastReceiver in an Activity's onCreate/onDestroy (I need the receiver to be active when the activity is not visible), but I wouldn't like to risk causing a memory leak by doing this. As I understand, if a single activity is destroyed by the system, onDestroy runs and

Using getContentResolver in BroadcastReceiver extended class

好久不见. 提交于 2019-12-10 16:08:28
问题 I have to use the getContentResolver method in a class that extends BroadcastReceiver and I found that getContentResolver can be used only in a class that extends Activity. I try to do a static method in a class that extends activity but i can't use getContentResolver in a static method. I also tried with a non-static method but when i run the appliaction I get an error. How can I do? Thanks! 回答1: In your onReceive(Context, Intent) you receive a Context object which has a getContentResolver()

Broadcast Receiver MY_PACKAGE_REPLACED never called

坚强是说给别人听的谎言 提交于 2019-12-10 15:44:16
问题 I have the following app scenario: 1) an app which updates by itself 2) the device is rooted 3) the checks for the version online and if new version is online it downloads the 'apk' file and installs it Everything works fine but the APP does not restart after the new version install. I tried to set the MY_PACKAGE_REPLACED Broadcast Receiver, but it is never called. The app install new and stops but the receiver in the app is never triggered. What am I doing wrong? The code: MANIFEST <receiver

GCM BroadcastReceiver setResultCode use

牧云@^-^@ 提交于 2019-12-10 15:27:28
问题 I'm using the GCM example from android developers and couldn't understand the purpose of the setResultCode(Activity.Result_OK). which component receiving this message? who is calling it and receiving it? here is the example public class GcmBroadcastReceiver extends WakefulBroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { ComponentName comp = new ComponentName(context.getPackageName(),GcmIntentService.class.getName()); startWakefulService(context, (intent

Android volatile not working?

岁酱吖の 提交于 2019-12-10 14:13:06
问题 I have an Activity class, in which I have a static flag, let's say public static volatile flag = false; Then in the class, I start a thread, which checks the flag and do different things. I also have a broadcastreceiver, which sets the flag to true or false. I though volatile will force the flag to the most recent value. But I can see my broadcastreceiver sets the static flag to true, but my thread is still getting it as false. Am I missing something basic here? Any help would be appreciated!

Go SMS Pro overriding android.provider.Telephony.SMS_RECEIVED

混江龙づ霸主 提交于 2019-12-10 14:06:21
问题 I have an app that allows users to forward SMS messages as they are received. Back in the day, I had the android:priority in my intent-filter for android.provider.Telephony.SMS_RECEIVED set to barely above Android's default messaging app. I did so, so that the user can forward the messages without having to clear them in the messaging app. However, a few months later, Go SMS Pro released an update of their app with a android:priority value extremely high, so users with that app installed

BroadcastReceiver: set android:process programmatically

不羁的心 提交于 2019-12-10 13:48:16
问题 I want my app to detect if when the state of external storage changes. At first defined a BroadcastReceiver in my AndroidManifest. Here I can set android:process and android:exported attributes like this: <receiver android:name=".StorageStateReceiver" android:process=":storage_state" android:exported="false"> <intent-filter> <action android:name="android.intent.action.MEDIA_UNMOUNTED" /> <action android:name="android.intent.action.MEDIA_MOUNTED" /> <action android:name="android.intent.action

Broadcasting an INSTALL_REFERRER Intent issue

◇◆丶佛笑我妖孽 提交于 2019-12-10 13:43:38
问题 My Android Manifest file <service android:name="com.google.android.gms.analytics.CampaignTrackingService" /> <receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver" android:exported="true" > <intent-filter> <action android:name="com.android.vending.INSTALL_REFERRER" /> </intent-filter> </receiver> I don't have any other receiver. Test: ~/development/sdk/platform-tools $ ./adb shell am broadcast -a com.android.vending.INSTALL_REFERRER -n com.myapp.myapplication/com