broadcastreceiver

Android Broadcast Receiver Error: Class not found exception

我的未来我决定 提交于 2019-11-30 21:06:03
I have a Broadcast receiver setup so that a pop-up message is displayed to the user after each upgrade of my app, or if this is the first time the package is installed. I tested this on my Droid running Android 2.2 both as a fresh install and after upgrading my app, as well in the Emulator running 1.5 and 1.6, and I see everything run fine. However, I received an error report from a user that lists the following exception: java.lang.RuntimeException: Unable to instantiate receiver com.name.pkg.FirstRunBroadcastReceiver: java.lang.ClassNotFoundException: com.name.pkg.app_name

BroadcastReceiver (TIME_TICK) dies every night?

女生的网名这么多〃 提交于 2019-11-30 20:50:12
问题 I want to write some kind of background-live-ticker app for sports-web-services... I would like my app to be able to call the TIME_TICK all the time. Btw: I also tried to use the AlarmManager, but the problem is the same. But now my problem... I use a Receiver with a Service for the execution part. The Receiver is called every minute correctly after register. But every night the service is terminated and will never be called again. On Android 2.x everything works fine but Android 4.x will

Implement Broadcast receiver inside a Service

那年仲夏 提交于 2019-11-30 20:27:21
I want to check Internet connection throughout the run time of my Android application. I tried using services but seems like it is not the best option. Is there any possible way for me to implement a broadcast receiver with in a service? Or do I have to give up the service and use broadcast receivers alone? I now show how to create SMS receiver in a service: public class MyService extends Service { @Override public void onCreate() { BwlLog.begin(TAG); super.onCreate(); SMSreceiver mSmsReceiver = new SMSreceiver(); IntentFilter filter = new IntentFilter(); filter.setPriority(IntentFilter.SYSTEM

Android widget stops working after a while?

心不动则不痛 提交于 2019-11-30 19:49:51
I have a flashlight app with a widget. The widget is used to turn the flashlight on and off and does not display main activity or anything. After a few hours, however, the widget does nothing. I mean if you click it, nothing happens. I have two classes to accomplish this a Provider and a Receiver . Provider: public class WidgetProvider extends AppWidgetProvider { @ Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { Intent receiver = new Intent(context, FlashlightWidgetReceiver.class); receiver.setAction("COM_FLASHLIGHT"); receiver.putExtra

Background execution not allowed. Android O pendingintent

一世执手 提交于 2019-11-30 19:07:42
I have a service that schedules a pendingintent which starts my notification. However, since Android O I am getting this error. I did some research, and stumbled upon context.registerReceiver , but that does not seem to fix the problem. Error: W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:my.great.package flg=0x4000010 (has extras) } to com.google.android.googlequicksearchbox/com.google.android.apps.gsa.googlequicksearchbox.GelStubAppWatcher ``` My pendingintent: Intent myNotification = new Intent("services

Android Application object life cycle

爷,独闯天下 提交于 2019-11-30 18:54:12
I can't find the Application's object (extend Application) life cycle. For example, what happens if I have a broadcast receiver which is called through Alarm. Will methods in Application being called? Or is everything independent from the Application? If I have a datahelper instantiated in the Application and I call it from broadcast receiver, will it available? Which is the Application object life cycle, when it is destroyed? when is it called when using Alarms? What happens when the activity is not in foreground with the Application object? Thanks in advance. Guillermo. Look at it this way:

how to get broadcast for screen lock in android

╄→尐↘猪︶ㄣ 提交于 2019-11-30 18:14:32
问题 How to get trigger that screen is locked or on in android?? i tried using SCREEN_OFF & SCREEN_ON action in broadcast receiver but it's not working. public void onReceive(Context context, Intent intent) { Log.d("XYZ", "Screen ON/OFF"); Toast.makeText(context, "screen",10000).show(); if(intent.getAction().equals(Intent.ACTION_SCREEN_ON)) { ....... } } in activity i have registered broadcast like- screen is object of my broadcast receiver IntentFilter filter = new IntentFilter(Intent.ACTION

Android: is there any additional information from Intent.ACTION_TIME_CHANGED?

和自甴很熟 提交于 2019-11-30 17:59:13
问题 Is there any additional information available from Intent.ACTION_TIME_CHANGED? There's nothing in getData() or getExtras(). I would like to know: The time phone had before setting new time; Who has changed the time: the user (manually) or the phone carrier? Any other way to get those informations are welcome! 回答1: I looked into source code of Android and this broadcast doesn't have any extras. So, there is no way to learn this info. 回答2: You can do one thing if the accuracy of previous time

Oreo: Broadcast receiver Not working

允我心安 提交于 2019-11-30 17:54:37
问题 I was trying to get notification trigger on my application whenever the user makes a new call. I'm registering receiver in my activity and destroying it in onDestroy() method. Following is the code snippets for registering registerReceiver(inComingCall = new IncomingCall(),new IntentFilter("android.intent.action.PHONE_STATE")); The issue I'm facing is I'm not getting any trigger in override onReceive() method for the Broadcast receiver. Kindly let me know whether any new implementations or

AlarmManager, BroadcastReceiver and Service not working

心已入冬 提交于 2019-11-30 17:41:01
I'm refactoring some code so that my app will pull data from a website once a day at a given time. From my research, it seems like AlarmManager is the most appropriate approach. The tutorial I have been following is: http://mobile.tutsplus.com/tutorials/android/android-fundamentals-downloading-data-with-services/ So far, AlarmManager and the BroadcastReceiver seem to be working, however the Service never seems to start (ie. onStartCommand doesn't seem to be called) Here are the important snippets of the code I have so far: MyActivity.java private void setRecurringAlarm(Context context) {