broadcastreceiver

LocationManager.PROVIDERS_CHANGED_ACTION will not work on API 26 and higher

丶灬走出姿态 提交于 2019-12-01 03:13:49
I am using following code to get location on/off event. <receiver android:name=".receivers.GpsReceiver" android:enabled="true"> <intent-filter> <action android:name="android.location.PROVIDERS_CHANGED" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </receiver> I am developing geofence based app. Based on Re-register geofences only when required we have to re register the geofences after the app has received a GEOFENCE_NOT_AVAILABLE alert. This typically happens after NLP (Android's Network Location Provider) is disabled. By using this broadcast receiver I re

How to launch activity on BroadcastReceiver when boot complete on Android

旧巷老猫 提交于 2019-12-01 03:13:03
问题 I use below code to let my app can be auto-launch after boot complete 10 seconds: public class BootActivity extends BroadcastReceiver { static final String ACTION = "android.intent.action.BOOT_COMPLETED"; public void onReceive(Context context, Intent intent) { if(intent.getAction().equals(ACTION)) { context.startService(new Intent(context, BootActivity.class)); try { Thread.sleep(10000); Intent newAct = new Intent(); newAct.setClass(BootActivity.this, NewActivity.class); startActivity( newAct

GCM push notifications on android 3.1 : disable broadcast receiver

夙愿已清 提交于 2019-12-01 03:03:57
问题 There is the problem with android push notifications (GCM) on android 3.1 : when my app is CLOSED - broadcast receiver which should handle GCM push messages (Intents) is never called. In lower versions of android everything works just fine. Broadcast reciever is always called (even when app is closed). I know that from Android 3.1 there is new concept: when application is not running it is in "stopped" state: http://developer.android.com/about/versions/android-3.1.html#launchcontrols So if

Receiving broadcast from notification on Android Oreo

吃可爱长大的小学妹 提交于 2019-12-01 02:59:31
I have a custom button in a sticky notification. I used to attach a PendingIntent to it for receiving button clicks: Intent intent = new Intent(); intent.setAction("com.example.app.intent.action.BUTTON_CLICK"); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 2000, intent, PendingIntent.FLAG_UPDATE_CURRENT); contentViewExpanded.setOnClickPendingIntent(R.id.button, pendingIntent); When i run this code on Oreo , i get BroadcastQueue: Background execution not allowed in logcat and don't receive button click. I registered receiver with manifest: <receiver android:name="

BroadcastReceiver not working after BOOT_COMPLETED

百般思念 提交于 2019-12-01 02:51:19
I'm trying to intercept incoming SMS right after boot_completed but i'm having a problem with a NullPointerException in this line: Object[] rawMsgs=(Object[])intent.getExtras().get("pdus"); Here's my manifest: <uses-permission android:name="android.permission.SEND_SMS"></uses-permission> <uses-permission android:name="android.permission.RECEIVE_SMS"></uses-permission> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses- permission> <uses-permission android:name="android.permission.INTERNET"></uses-permission> <uses-permission android:name="android.permission.READ

system wallpaper should change through service

橙三吉。 提交于 2019-12-01 02:00:59
my application requires a service that changes the system wallpaper in a particular time interval how should I implement this, please help??? Yahor10 Create your service class class WallpaperService extends IntentService { @Override protected void onHandleIntent(Intent intent) { Timer progressTimer = new Timer(); timeTask = new ProgressTimerTask(); progressTimer.scheduleAtFixedRate(timeTask, 0, 1000); } private class ProgressTimerTask extends TimerTask { @Override public void run() { runOnUiThread(new Runnable() { @Override public void run() { int currenMinutes = 0; // set your time here

Android Broadcast receiver not executed on application close

你。 提交于 2019-12-01 02:00:40
问题 I have an android application, where I schedule to an event (location update) to be executed in the future using Alarm manager. The scheduled event executes as expected as long as the application runs in the foreground or in the background. But once I force close the application under task manager or when android system kills the application due to memory issue when the app is at background, I am no longer able to receive the broadcast from the alarm manager. As suggested by various posts and

Call activity method from broadcast receiver android?

你说的曾经没有我的故事 提交于 2019-12-01 01:45:49
In my application I am sending a port SMS to the mobile. And when the message is recieved I need to perform some task in my activity and update the UI. Manifest Declaration of receiver <receiver android:name="com.vfi.BinarySMSReceiver" > <intent-filter android:priority="10" > <action android:name="android.intent.action.DATA_SMS_RECEIVED" /> <data android:host="*" android:port="9512" android:scheme="sms" /> </intent-filter> </receiver> Receiver class public class BinarySMSReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Bundle bundle =

BroadcastReceiver (TIME_TICK) dies every night?

放肆的年华 提交于 2019-12-01 01:33:28
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 stop the Receiver every day... Is there any posibility to keep the app alive on Android 4.x? The Reveiver

what is the right way to clear background activity/activites from stack?

旧时模样 提交于 2019-12-01 01:08:49
as the questions title says - I need to know what is the best way to "remove"/destroy/finish an activity that are somewhere in the middle of stack and currently on pause mode (not specific instances - but specific derived classes). for example: if the current state of the stack looks like this: ActivityD <-- top of the stack, currently forground ActivityC ActivityA ActivityC ActivityA a request to "clear" all ActivityC instances would cause the stack to be like: ActivityD <-- still top of the stack, currently forground. ActivityA ActivityA I don't want to do that depends on activity launch