android-broadcastreceiver

Alarm Manager does not work in background on Android 6.0

霸气de小男生 提交于 2019-11-27 20:45:31
This is my Activity code, Long time = new GregorianCalendar().getTimeInMillis()+20000;//Setting alarm after 20 sec Intent intentAlarm = new Intent("alarm"); intentAlarm.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intentAlarm.putExtra("req_code",10); PendingIntent pendingIntent = PendingIntent.getBroadcast(context,10, intentAlarm, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); alarmManager.set(AlarmManager.RTC_WAKEUP, time, pendingIntent); These are all the permissions that I have in my app, <uses-permission android:name=

Runtime exception Android O with boot_completed

拟墨画扇 提交于 2019-11-27 19:41:57
I'm trying to start an IntentService within my BOOT_COMPLETED receiver, but in Android O (API 26) I get: java.lang.RuntimeException: java.lang.IllegalStateException: Not allowed to start service Intent { act=intent.action.update cmp=packageName.services.OwnService }: app is in background (Message is in one line, but this way it's easier readable) How can I do this the correct way? Here are some options that I outlined in a blog post : Workaround #1: startForegroundService() Your BroadcastReceiver that receives the ACTION_BOOT_COMPLETED broadcast could call startForegroundService() instead of

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

*爱你&永不变心* 提交于 2019-11-27 18:27:10
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 : Exported receiver does not require permission--> <receiver android:name=".receivers.BatteryMonitoringReceiver

Fatal Exception: android.app.RemoteServiceException: can't deliver broadcast at android.os.Handler.dispatchMessage

微笑、不失礼 提交于 2019-11-27 03:55:47
问题 I am using broadcast messages on my android application (From io.socket I am sending broadcast messages to my Activity page). On some devices Samsung SM-G950F and SM-A520F I got an error " Fatal Exception: android.app.RemoteServiceException: can't deliver broadcast ". I got this error on Fabric crashlytics also I was not able to reproduce this issue. Here is the log I got from Fabric, Fatal Exception: android.app.RemoteServiceException: can't deliver broadcast at android.app.ActivityThread$H

CONNECTIVITY_ACTION intent received twice when Wifi connected

风流意气都作罢 提交于 2019-11-27 02:49:41
In my app I have a BroadcastReceiver that is launched as a component through a <receiver> tag, filtering android.net.conn.CONNECTIVITY_CHANGE intents. My goal is simply to know when a Wifi connection was established, so what I am doing in onReceive() is this: NetworkInfo networkInfo = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); if(networkInfo.getType() == ConnectivityManager.TYPE_WIFI && networkInfo.isConnected()) { // Wifi is connected } It works fine, but I always seem to get two identical intents within about one second when a Wifi connection is established. I tried

Broadcast Receiver Not Working After Device Reboot in Android

早过忘川 提交于 2019-11-27 02:42:48
I have already checked all the related questions and have not found any solution for this problem. So this is an absolutely new problem for me. What I Have I have an Android app which registers a few broadcast receivers in its manifest. This is what my manifest looks like. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.app.myapp"> <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" /> <uses-permission android:name="android.permission.RECEIVE_BOOT

BroadcastReceiver dies with app

断了今生、忘了曾经 提交于 2019-11-26 23:41:46
问题 If i let the phone sit for a long time like 15 minutes i lose my receiver but i thought it was to persist like a service after being killed for memory. Manifest: <receiver android:name=".WearableReceiver" android:enabled="false"> <intent-filter> <action android:name="com.example.johnbravado.MESSAGE_PROCESSED"/> </intent-filter> </receiver> In Activity to start receiver ComponentName component = new ComponentName(CounterActivity.this, WearableReceiver.class); getPackageManager()

Background service pause and start again automatically on OREO

走远了吗. 提交于 2019-11-26 23:39:56
问题 I have created a background service for registering SCREEN_ON and SCREEN_OFF intent to catch an event using broadcast receiver but some time due to unknown reason my service does not pass intent to my main application. For testing i have generated log file using ten second timer that it is my background service working or not. Which i have attached below. I got a issue that my background service pause some time and start it automatically. It is my background service public class

Alarm Manager does not work in background on Android 6.0

给你一囗甜甜゛ 提交于 2019-11-26 22:58:27
问题 This is my Activity code, Long time = new GregorianCalendar().getTimeInMillis()+20000;//Setting alarm after 20 sec Intent intentAlarm = new Intent("alarm"); intentAlarm.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intentAlarm.putExtra("req_code",10); PendingIntent pendingIntent = PendingIntent.getBroadcast(context,10, intentAlarm, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); alarmManager.set(AlarmManager.RTC_WAKEUP, time,

Oreo BroadcastReceiver SMS Received not working

巧了我就是萌 提交于 2019-11-26 21:36:20
问题 An app I'm working on allows the user to allow the app to read the contents of a confirmation SMS to input the verification code on its own. For all devices using an OS earlier than Oreo (API 26), the implementation of the BroadcastReceiver works correctly and allows a proper reception of the SMS. By this implementation I mean placing the receiver object in the AndroidManifest. <receiver android:name=".SmsReceiver"> <intent-filter> <action android:name="android.provider.Telephony.SMS_RECEIVED