broadcastreceiver

Notification does not get cancelled in Android 10

試著忘記壹切 提交于 2020-05-05 05:35:49
问题 The bounty expires in 3 days . Answers to this question are eligible for a +50 reputation bounty. Maulik Dodia wants to draw more attention to this question. Problem: I want to cancel a Notification when I directly reply to that Notification. It works in Android N but doesn't work on Android 10. My Code is like below: MainActivity.java public class MainActivity extends AppCompatActivity { public static final int NOTIFICATION_ID = 1256; public static final String CHANNEL_1_ID = "channel1";

Unable to start receiver : Not allowed to start service Intent ; App is in background

廉价感情. 提交于 2020-04-30 08:46:28
问题 So I made an app that upon a button click sets up a repeating task using an Alarm Manager. In on create: Intent alarmIntent = new Intent(this, AlarmReceiver.class); servicePendingIntent = PendingIntent.getBroadcast(this, 0, alarmIntent, 0); On the button click: alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE); firingCal= Calendar.getInstance(); firingCal.setTimeInMillis(System.currentTimeMillis()); firingCal.set(Calendar.HOUR_OF_DAY, 1); // At the hour you want to fire the

Unable to start receiver : Not allowed to start service Intent ; App is in background

馋奶兔 提交于 2020-04-30 08:46:22
问题 So I made an app that upon a button click sets up a repeating task using an Alarm Manager. In on create: Intent alarmIntent = new Intent(this, AlarmReceiver.class); servicePendingIntent = PendingIntent.getBroadcast(this, 0, alarmIntent, 0); On the button click: alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE); firingCal= Calendar.getInstance(); firingCal.setTimeInMillis(System.currentTimeMillis()); firingCal.set(Calendar.HOUR_OF_DAY, 1); // At the hour you want to fire the

Kotlin: Call a function to update UI from BroadcastReceiver onReceive

不羁的心 提交于 2020-04-14 08:14:09
问题 I am new to Kotlin, and it seems awesome! Though today, I've been trying to do something that in Java was super simple, but I've got totally stuck. I am using a broadcast receiver to determine when the device is connected/ disconnected from a power source. And all I need to do it update my UI accordingly. My Code Here's my BroadcastReceiver classs, and it seems to work fine. class PlugInReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { val action =

Full screen intent not starting the activity but do show a notification on android 10

有些话、适合烂在心里 提交于 2020-04-10 03:21:18
问题 I try to launch activity for a broadcastReceiver by using the next code Intent i = new Intent(context, AlarmNotification.class); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { // This is at least android 10... NotificationManager mgr = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); if (mgr.getNotificationChannel(CHANNEL_WHATEVER)==null) { mgr.createNotificationChannel(new

how to broadcast Receiver and MVVM?

本小妞迷上赌 提交于 2020-04-07 08:00:07
问题 my manifest <receiver android:name=".ui.receiver.NetworkChangeReceiver" > <intent-filter> <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> <action android:name="android.net.wifi.WIFI_STATE_CHANGED" /> </intent-filter> </receiver> and NetworkChangeReceiver Class class NetworkChangeReceiver : BroadcastReceiver() { override fun onReceive(context: Context?, intent: Intent?) { val connMgr = context?.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager val

Android mistake with Broadcast / Receivers

二次信任 提交于 2020-03-23 12:33:13
问题 I'm using two receivers. One declared in the manifest like this : <receiver android:name="com.app.receivertest" android:exported="false" android:enabled="true" android:permission="MY_PERMISSION"> <intent-filter android:priority="0"> <action android:name="NAME_ACTION" /> </intent-filter> </receiver> And one declared in my activity A, declared with priority 1. When I start my service on this activity A, on Android 4.4.2, both receivers are called, in the "correct order" whereas in Android 5 > 0

Youtube Api Crashed, YouTubeService has leaked IntentReceiver

别说谁变了你拦得住时间么 提交于 2020-03-14 18:23:30
问题 I have built a native android app using YoutubeApi. Sometimes when I backpress from another activity to the activity with the youtubePlayer fragment (YouTubePlayerSupportFragment) it crashes with the following message: 05-19 15:43:10.869 4009-4009/? E/ActivityThread: Service com.google.android.youtube.api.service.YouTubeService has leaked IntentReceiver vsi@26900cf that was originally registered here. Are you missing a call to unregisterReceiver()? android.app.IntentReceiverLeaked: Service

BroadcastReceiver is not getting called after killing the app

ぐ巨炮叔叔 提交于 2020-02-27 03:52:43
问题 I made an app that must be running in the background. The app basically register incoming calls and send timestamp to my server. Problem is that app is not working properly when it's killed after some time. I assume that OS simply kills my app however I don't know why. Here's how I register my app in AndroidManifest.xml file <receiver android:enabled="true" android:name=".receiver.CallReceiver"> <intent-filter android:priority="99"> <action android:name="android.intent.action.PHONE_STATE"/> <

BroadcastReceiver is not getting called after killing the app

半世苍凉 提交于 2020-02-27 03:52:27
问题 I made an app that must be running in the background. The app basically register incoming calls and send timestamp to my server. Problem is that app is not working properly when it's killed after some time. I assume that OS simply kills my app however I don't know why. Here's how I register my app in AndroidManifest.xml file <receiver android:enabled="true" android:name=".receiver.CallReceiver"> <intent-filter android:priority="99"> <action android:name="android.intent.action.PHONE_STATE"/> <