broadcastreceiver

Unable to instantiate receiver in BroadcastReceiver SMS

会有一股神秘感。 提交于 2019-12-17 16:35:30
问题 Why I have this error : ERROR/AndroidRuntime(854): Uncaught handler: thread main exiting due to uncaught exception ERROR/AndroidRuntime(854): java.lang.RuntimeException: Unable to instantiate receiver com.android.GPS21.SmsReceiver: java.lang.ClassNotFoundException: com.android.GPS21.SmsReceiver in loader dalvik.system.PathClassLoader@43d02ef0 ERROR/AndroidRuntime(854): Caused by: java.lang.ClassNotFoundException: com.android.GPS21.SmsReceiver in loader dalvik.system.PathClassLoader@43d02ef0

Listen for app installed / upgraded broadcast message in Android

你。 提交于 2019-12-17 16:28:13
问题 Using Lookout app (https://play.google.com/store/apps/details?id=com.lookout), I see every time I install or upgrade app, it'll automatically scan this app to ensure it's not malicious. Follow Lookout, I write a simple app which listen broadcast message whenever each app is installed or upgraded. AFAIK, there are some type of IntentFilter for broadcast message, it is: Intent.ACTION_PACKAGE_ADDED Intent.ACTION_PACKAGE_CHANGED Intent.ACTION_PACKAGE_INSTALL I hope Intent.ACTION_PACKAGE_ADDED is

Android - Trying to test a service on boot (java.lang.SecurityException: Permission Denial)

风格不统一 提交于 2019-12-17 16:27:27
问题 I've been trying to test a service when a device boots up on android, but I cannot get it to work. I'm trying to start it with this command from CMD: (in ..\AppData\Local\Android\sdk\platform-tools) adb shell am broadcast -a android.intent.action.BOOT_COMPLETED or adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n net.fstab.checkit_android/.MyReceiver AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http:/

java.lang.InstantiationException: class has no zero argument constructor

筅森魡賤 提交于 2019-12-17 16:12:32
问题 I am trying to use a BroadcastReceiver as an inner class to track the network state but I got the exception in the title. What should I do to fix this problem? public class NetworkChangeReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { final ConnectivityManager connMgr = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); final android.net.NetworkInfo wifi = connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI);

How to use registerReceiver method?

 ̄綄美尐妖づ 提交于 2019-12-17 15:35:38
问题 I want to use dynamically registered BroadcastReceiver that has a reference to an Activity so it can modify its UI. I am using Context.registerReceiver() method but receiver's onReceive() method is never called. Here is the sample code showing the problem: package com.example; import android.app.Activity; import android.app.IntentService; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android

android - “Exported receiver does not require permission” on receivers meant to receive from system services

最后都变了- 提交于 2019-12-17 15:34:56
问题 I have some receivers declared in my AndroidManifest : <!-- no warning --> <receiver android:name=".receivers.TriggerMonitoringBootReceiver" android:enabled="false"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> <!-- no warning --> <receiver android:name=".receivers.ScanResultsReceiver" android:enabled="false"> <intent-filter> <action android:name="android.net.wifi.SCAN_RESULTS" /> </intent-filter> </receiver> <!-- warning :

cannot cancel the current alarm in Android

倾然丶 夕夏残阳落幕 提交于 2019-12-17 14:58:58
问题 I am new to Android. Here, I am not getting any errors ,While debugging the stopAlarm() method debugger crossed all the lines but the AlarmReceiver is not get called . can anyone help me to fix it . Update : AlarmActivity.java public void stopAlarm(Context context) { Intent intent = new Intent(context,AlarmReceiver.class); intent.setAction("ALARM_OFF"); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, mAlarmId, intent,0); AlarmManager alarmManager = (AlarmManager) context

Android ACTION_DATE_CHANGED broadcast

ε祈祈猫儿з 提交于 2019-12-17 10:58:06
问题 I have a Nexus S, and when I change the date manually on the phone, ACTION_DATE_CHANGED is not always broadcasted. If I change the date from Feb 13, 2014 to Feb 14, 2014, I have not gotten an ACTION_DATE_CHANGED to work, but if I set it to several years in the future, I sometimes get it to fire. I can (99%) assure you I'm not misusing IntentFilters, BroadcastReceivers, etc. I'm just curious as to why this broadcast is so poorly documented. A quick scan through SO & Google shows that people

How do I pass data from a BroadcastReceiver through to an Activity being started?

强颜欢笑 提交于 2019-12-17 10:47:10
问题 I've got an Android application which needs to be woken up sporadically throughout the day. To do this, I'm using the AlarmManager to set up a PendingIntent and have this trigger a BroadcastReceiver. This BroadcastReceiver then starts an Activity to bring the UI to the foreground. All of the above seems to work, in that the Activity launches itself correctly; but I'd like the BroadcastReceiver to notify the Activity that it was started by the alarm (as opposed to being started by the user).

How can I display a dialog from an Android broadcast receiver?

喜夏-厌秋 提交于 2019-12-17 10:09:07
问题 Ideally, I do not want to start an activity to do this. When the WiFi connection is lost, my app needs to close because this is a fatal error for us. I want to display an error message and have the user press an Ok button and then exit the app. What is the best way to go about this? Thanks! 回答1: AFAIK, only activities can display dialogs. If so, and if your BroadcastReceiver is registered by an activity via registerReceiver() , you're set -- just use that activity. If, however, your