android-notifications

How to find which apps are allowed under “Priority app notifications” within Do Not Disturb setting?

三世轮回 提交于 2021-02-07 11:59:19
问题 I am trying to programmatically find out for which apps the Do Not Disturb setting is bypassed exceptionally. So far, I am using the following code to check whether the phone is set in Do not Disturb mode or not : public static boolean isDnDModeEnabled(Context context) { if(Build.VERSION.SDK_INT <23) return false; try { NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); int filterValue = notificationManager

NavDeepLinkBuilder destination ignored when app not in foreground

拈花ヽ惹草 提交于 2021-02-07 06:51:19
问题 I am using NavDeepLinkBuilder to generate a pending intent for a push notification to open the app at a particular destination. return NavDeepLinkBuilder(this) .setComponentName(MainActivity::class.java) .setGraph(R.navigation.main_navigation) .setDestination(destinationId) .setArguments(args) .createPendingIntent() When the app is in the foreground, the notification will navigate to the destination set in the pending intent built by the NavDeepLinkBuilder. 👍 However when the app is not in

Android Repeated Notifications not working When App is Closed

和自甴很熟 提交于 2021-02-05 09:14:25
问题 I want to send notification everyday on a particular time. The code is working when the app is opened. But when it closed and remove, the notifications are not showing. I have used broadcast receiver and service to this. The code is given below. Can anyone help to clear this issue. Manifest File <receiver android:name=".MyReceiver" android:enabled="true" android:exported="true" /> <service android:name=".MyService" android:enabled="true" android:exported="true" /> MyReceiver.java public class

Bad notification for startForeground error

吃可爱长大的小学妹 提交于 2021-01-29 21:21:52
问题 I tried to background services like this code, but after first alert app crashed. And gave this error: android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=null pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x40 color=0x00000000 vis=PRIVATE) My code : if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { mNotification = Notification.Builder(this, CHANNEL_ID) //

AlarmManager with Notification in Android does not show any notifications

早过忘川 提交于 2021-01-29 19:03:05
问题 I try to create daily notification for my application. In order to test the application I set the interval for the notifications to 15 minutes. Unfortunately, no notification is shown. Neither when the application is running nor when it is closed. I tried to inspire myself with these solutions: https://stackoverflow.com/questions/33055129/how-to-show-a-notification-everyday-at-a-certain-time-even-when-the-app-is-close https://developer.android.com/codelabs/android-training-alarm-manager#0

FullScreenIntent only appears if I clear the notification

こ雲淡風輕ζ 提交于 2021-01-28 22:06:58
问题 I'm trying to launch a FullScreenIntent from a service working in the background, but I realised that the intent would not be shown another time if I do not clear the notification from the task bar. I have tried removing the notification by removing .setSmallIcon(R.drawable.ic_launcher) .setContentTitle("Notification") .setContentText("A client is calling") but that just removes my option of clearing the notification. Can somebody help? My code is as shown: NotificationCompat.Builder mBuilder

FullScreenIntent only appears if I clear the notification

泄露秘密 提交于 2021-01-28 21:42:43
问题 I'm trying to launch a FullScreenIntent from a service working in the background, but I realised that the intent would not be shown another time if I do not clear the notification from the task bar. I have tried removing the notification by removing .setSmallIcon(R.drawable.ic_launcher) .setContentTitle("Notification") .setContentText("A client is calling") but that just removes my option of clearing the notification. Can somebody help? My code is as shown: NotificationCompat.Builder mBuilder

Chronometer start from specific value in Notification RemoteViews

有些话、适合烂在心里 提交于 2021-01-28 11:41:11
问题 I'm trying to start the chronometer in a new notification but from a paused(elapsed) "the elapsed time is got from another chronometer", not from zero The start base in Notification RemoteViews.class of chronometer is different from the start base in Chronometer.class it has different calculations Notification notification = new NotificationCompat.Builder(getApplicationContext()) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle(songName).build(); notification.contentView =

How to create notification after listview receives new data from an online JSON file?

北城余情 提交于 2021-01-28 02:00:27
问题 I have an online JSON file that shows the latest country earthquakes, the listView adapter in my app receives data from this JSON file and the refresh is manually by user`s swipe, but now I am adding an automatic and timely basis refresh mode to my list, the questions is: How can I create a system notification after a new quake is detected? 回答1: Write this below code for sending System notification in your app while your data is loaded from network request. Intent intent = new Intent

MediaStyle Notification to Show Button in Compact View

断了今生、忘了曾经 提交于 2021-01-27 16:33:02
问题 I'm using the MediaStyle for my push notification so that I can show currently playing song meta data as well as include a pause button. The issue I'm seeing is that my notification is not automatically expanding to show the pause button, even though I've included the setShowActionsInCompactView(). If I pull down on my notification while on the lock screen, it expands and then shows the pause button. But I would like it to show the button without expanding. Screenshot of how notification is