android-notifications

Android notification setSound is not working

五迷三道 提交于 2019-12-03 17:02:57
问题 In my hybrid Cordova Android app targeting API 23+ I want to use a custom sound for notifications. To that end I have done the following In plugin.xml file for the single custom plugin I use in the app I declare <resource-file src="src/android/res/unysound.mp3" target="res/raw/mysound.mp3" />' . Opening the APK as a zip archive I see that the mp3 file has in fact ended up in `res/raw/mysound.mp3'. - When building the notification I do the following Notification notification = new Notification

Cannot disable notification vibration in Android 8

你离开我真会死。 提交于 2019-12-03 16:56:25
I try to disable vibration when showing a notification. Func: public static Notification buildNotifForUploaderService(Context ctx, String title, String message) { Notification notification; NotificationCompat.Builder notificationBuilder; //If device is Android 8+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH); //setting pattern to disable vibrating notificationChannel.setVibrationPattern(new long[]{0L}); notificationBuilder = new NotificationCompat.Builder(ctx

Adding a terminate playback button using Android L Notification.MediaStyle

十年热恋 提交于 2019-12-03 15:42:12
问题 I want to create a Media Playback notification using the new Android L MediaStyle template. Now, I succeeded doing so perfectly well for actions like previous, play, pause, next (by using addAction() , but I couldn't find a way to add a "close" button like in the Android Notifications Documentation screenshot: Is there a neat way to achieve this? I want the "close" button to terminate the currently playing playback, clear the playback notification, and be located as in the attached screenshot

How to get Ringtone name in Android?

自古美人都是妖i 提交于 2019-12-03 15:41:47
问题 I'm allowing my user to pick a ringtone for notifications in my app. I want to store the URI of the sound along with the human readable title of the sound. So far the URI code works great: Uri uri = intent.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); But when I try to get the title, and set it as a button text, I don't get anything. Seems to have no title? String title = intent.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_TITLE); button.setText(title); But my button

Display Notification Text in Status Bar - Android

瘦欲@ 提交于 2019-12-03 15:03:18
In my application I need to display notification to the user. The following code snippet worked great by display the icon and content title in the Android device title bar. var notificationManager = GetSystemService(Context.NotificationService) as NotificationManager; var uiIntent = new Intent(this, typeof(MainActivity)); var notification = new Notification(Resource.Drawable.AppIcon, title); notification.Flags = NotificationFlags.AutoCancel; notification.SetLatestEventInfo(this, title, desc, PendingIntent.GetActivity(this, 0, uiIntent, 0)); notificationManager.Notify(1, notification); When I

Remove all notifications from notification bar

我们两清 提交于 2019-12-03 14:44:00
I want to remove all cancelable notifications from status bar. I know how to remove my app notifications I have seen this post before, butI want to remove other apps notifications. There is a "Clear" button in notifications in all android versions which clears all notifications with this flag: Notification.FLAG_AUTO_CANCEL That means it's possible to cancel all notifications. But I haven't found any document about how to do that. Is there anybody guide me how to do that? Thanks Alejandro Casanova Starting with API Level 18 you can cancel Notifications posted by other apps different than your

Notifications not received on Android

*爱你&永不变心* 提交于 2019-12-03 14:39:40
I am developing an android-application which main usage is displaying notifications at a set time (some specific calendar app). One of the main complaints is that users do not (always) receive notifications , and I am at wits end. We have internally tested the code below against Android 4.4, 6, 7.0, 7.1, 8.0, 8.1 on emulators and used about 10 real devices (6 to 8.1), and all devices received their notifications on time. Even across reboots, the notifications were all received on time. One of the things we have ran into was the SecurityException on Samsung devices (>500 registered alarms),

Can FCM notification on Android overwrite previous one?

ⅰ亾dé卋堺 提交于 2019-12-03 13:04:00
问题 I'm using FCM to send notifications to Android devices. When the app is in background, if I send 10 notifications, the devices will show up 10 entries on the notification bar. I want FCM to make only one entry on notification bar, i.e. the newer one will overwrite old ones. I don't find a key to set this at https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream. Is there a way to do, or it is impossible? Thanks. 回答1: To achieve this, in your notification payload, use the

DP5 7.0 - Does adding extras to a pending intent fail?

那年仲夏 提交于 2019-12-03 13:01:05
Adding the linked issue on tracker: https://code.google.com/p/android/issues/detail?id=216581&thanks=216581&ts=1468962325 So I installed the DP5 Android 7.0 release onto my Nexus 5X today. I've been working on an app that schedules local notifications at specific times using Android's AlarmManager class. Up until this release, the code has been working great on devices running KitKat, Lollipop, and Marshmallow. Below is how I'm scheduling the alarms: Intent intent = new Intent(context, AlarmManagerUtil.class); intent.setAction(AlarmManagerUtil.SET_NOTIFICATION_INTENT); intent.putExtra

startForegroundService() did not call startForeground(), but it did

旧巷老猫 提交于 2019-12-03 13:00:20
I'm having the Context.startForegroundService() did not then call Service.startForeground() in my Android service, but I cannot figure out why it is happening. My application is for media streaming, and this error only occurs when you pause from the foreground notification (turning it into a regular notification), and you then swipe the notification away, which is intended to stop my service. Here is the only method where the startForegroundService , startForeground and stopForeground methods are called: private void configureServiceState(long action) { if (action == PlaybackStateCompat.ACTION