broadcastreceiver

BroadcastReceiver declared in manifest is not receiving the Broadcast

僤鯓⒐⒋嵵緔 提交于 2019-12-18 13:01:21
问题 I've tried to register a Wifi BroadcastReceiver to get the wifi state when it changes. But so far I have no luck receiving the broadcast. <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <receiver android:name=".WifiReceiver" > <intent-filter> <action android:name="android.net.wifi.WifiManager.WIFI_STATE_CHANGED_ACTION" /> <action android:name="android.intent.action.PHONE_STATE" /> </intent-filter> </receiver> //activity declaration here... </application>

How to check if Pending intent triggered by AlarmManager setRepeating is already running?

一个人想着一个人 提交于 2019-12-18 11:56:55
问题 I would be glad to know how to check if Pending intent which is triggered by an Alarm Manager which starts an activity at a specific time given by AlarmManager.setRepeating? To be more specific , I have an activity which kicks off another activity with a paticular set time, or repeating time, (which works) . But i want to know if the request was already set by the user? in that case i should not start certain values. This is how i start the scheduled activity. Intent myIntent = new Intent

Android App A wants to track Google Play referral data for Android App B installation

a 夏天 提交于 2019-12-18 11:53:55
问题 Let's say I have an Android App A that is installed in the user's device and I have an AppWidget with my App where we let other Android developers publish their App promotion ads on a Cost Per Install basis. So we need to track if App B is being installed on the user's device through App A's referral. Let's also assume Android App B has its advertisement running on Android App A's widget and the link through which we redirect App A's users to App B's user to Google Play is with all referrer

Why is there no test instrumentation for BroadcastReceiver?

痴心易碎 提交于 2019-12-18 11:39:43
问题 Maybe I'm missing something. I want to write test cases for a BroadcastReceiver; specifically, it is for receiving the BOOT_COMPLETED event and setting an alarm for another receiver to handle later; it doesn't seem to be setting it properly, but the point is that I have no obvious way to test it. I can't exactly attach a debugger and wait for BOOT_COMPLETED, and I can't send a fake BOOT_COMPLETED broadcast. Why are there instrumentation classes for Activity, Service, and Provider, but not

BroadcastReceiver for CONNECTIVITY_ACTION always returns null in intent.getExtras()

≯℡__Kan透↙ 提交于 2019-12-18 11:32:04
问题 Im trying to receive BroadcastMessages from CONNECTIVITY_ACTION: // register BroadcastReceiver on network state changes final IntentFilter mIFNetwork = new IntentFilter(); mIFNetwork.addAction(android.net.ConnectivityManager.CONNECTIVITY_ACTION); //"android.net.conn.CONNECTIVITY_CHANGE" registerReceiver(mIRNetwork, mIFNetwork); and receiver is: private BroadcastReceiver mIRNetwork = new BroadcastReceiver() { @Override public void onReceive(final Context context, final Intent intent) { android

How to send data through PendingIntent to Broadcast?

偶尔善良 提交于 2019-12-18 11:24:54
问题 I'm trying to send via PendingIntent some extra data, like: MyMessage message; //... Intent intent; SmsManager sms = SmsManager.getDefault(); intent = new Intent(Constants.SENT_PLAIN); intent.putExtra(Constants.EXTRA_RAW_ID, message.getId()); //putting long id (not -1L) PendingIntent sentPI = PendingIntent.getBroadcast(activity, 0, intent, 0); intent = new Intent(Constants.DELIVERED_PLAIN); intent.putExtra(Constants.EXTRA_RAW_ID, message.getId()); PendingIntent deliveredPI = PendingIntent

PACKAGE_REMOVED & then PACKAGE_ADDED are fired along with PACKAGE_REPLACED Intent Action

蹲街弑〆低调 提交于 2019-12-18 10:35:47
问题 All I am trying to do is update my list on each Install & Uninstall but not on Package Replace .So the main problem is that Install & Uninstall intents are launched on each Replace action. So For this I have implemented a BroadcastReciever as below <receiver android:name =".IntentReceiverTest.AppReciever"> <intent-filter> <action android:name="android.intent.action.PACKAGE_REMOVED"/> <action android:name="android.intent.action.PACKAGE_REPLACED"/> <action android:name="android.intent.action

BroadcastReceiver with multiple filters or multiple BroadcastReceivers?

梦想与她 提交于 2019-12-18 10:01:25
问题 I have an Android Activity that needs to catch two different broadcasts. My current approach is to have a single BroadcastReceiver within the Activity and catch both the broadcasts with it: public class MyActivity extends Activity { private MyActivity.BroadcastListener mBroadcastListener; private boolean mIsActivityPaused = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mylayout); // Create the broadcast

How to include a BroadcastReceiver in a different project Xamarin project?

会有一股神秘感。 提交于 2019-12-18 09:52:57
问题 I'm writing a cross-platform solution in Xamarin, and am about to add a mother project for 3rd-partyu integration (e.g., other Android-parties that want to integrate with my app using intents on Android only). But I'd like to keep my cross-platform setup that I have now "clean" and simply add a new Android class library with the 3rd-party integration code. However, I cannot seem to get my BroadcastReceiver in my 3rd-party integration project to be included in my "main" android app project. I

BroadcastReceivers in ICS

守給你的承諾、 提交于 2019-12-18 08:29:20
问题 I had written a small utility app just for my phone, which stopped the annoying carrier provided jingle which played on boot up. I noticed the sound didn't play if I put the phone into silent mode before powering off, so I wrote this little utility to go silent on power down and restore sound on boot. This worked well for a Galaxy S2 on Gingerbread. The entire code is in two classes: public class OnShutDownReceiver extends BroadcastReceiver { @Override public void onReceive(Context context,