android-notifications

Android - NotificationCompat.Builder stacking notifications with setGroup(group) not working

非 Y 不嫁゛ 提交于 2019-12-08 16:53:30
问题 I want to stack notifications using setGroup (as described here: https://developer.android.com/training/wearables/notifications/stacks.html) Basically, I use 0 as notification id (always the same) and builder.setGroup("test_group_key") but a new notification always replaces the previous one. What could be the problem ? Code: public BasicNotifier(Context context) { super(context); notifManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); mBuilder = new

Android going back to old activity

我怕爱的太早我们不能终老 提交于 2019-12-08 14:52:09
问题 I have a Tab A, B and C. All ofthem contain a ListView called Aa, Bb and Cc. When I click on an item in one of these ListView s I want to show a new activity which will display the information of that clicked item. I have enabled the button in the ActionBar which takes me to the parent Activity . However always when I click that button it does take me to the parent activity but a whole different tab is selected and it loads everything again (data for the listviews). Basically it's the same as

Android 8 notifications setSound not working

馋奶兔 提交于 2019-12-08 14:36:18
问题 I have the following code but everytime I just hear the default android sound. // create channel NotificationChannel channel = new NotificationChannel(ANDROID_CHANNEL_ID, ANDROID_CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT); // Sets whether notifications posted to this channel should display notification lights channel.enableLights(true); // Sets whether notification posted to this channel should vibrate. channel.enableVibration(true); // Sets the notification light color for

How to open pdf from a notification

邮差的信 提交于 2019-12-08 13:04:26
问题 I want to open pdf when i press on the notification i tried to to this: public void addNotification(String path) { createNotificationChannel(); File file = new File(path); // set your audio path Intent intent = new Intent(); intent.setData(Uri.fromFile(file)); intent.setAction(android.content.Intent.ACTION_VIEW); PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0); //Intent landingIntent = new Intent(this, MainActivity.class); // landingIntent.setFlags(Intent.FLAG_ACTIVITY

Android BroadcastReceiver Not being called after app closed from Running App List

一笑奈何 提交于 2019-12-08 11:15:14
问题 In attempting to implement notifications in an android app, I am seeing that the notifications no longer work if a user closes the app from the Running App List (top swipe down and then horizontal swipe - not force quit which properly would shut down all future invocations as per google specs). Using the back button sometimes causes the same behaviour, though not always. My understanding from everything that I have researched is that only a force stop by the user should stop the Broadcast

How to send notification from AsyncTask while main Activity is not started?

 ̄綄美尐妖づ 提交于 2019-12-08 11:03:09
问题 I have an AsyncTask which starts on boot (called by a service). In some cases I would like to send a notification to start the main Activity. My problem comes when I try to call: NotificationManager notManager = (NotificationManager) getSystemService(ns); where eclipse shows me an error because AsyncTask hasn't got getSystemService method. Any idea? Thank you. 回答1: Because getSystemService is a method of Context class. Check it out here. Before you call the function, create a Context variable

Media Notifications using the Media Session Web API doesn't work with Web Audio API

只谈情不闲聊 提交于 2019-12-08 09:31:46
问题 I'm trying to implement custom notifications into my PWA for the currently playing audio content. As the title states; I'm using Android v8.1.0 with the Google Chrome App v68.0.x. According to this article: The Media Session API is supported in Chrome 57 . I assume the version I'm using should be more than up-to-date to work with these notifications. First, a code snipped for the audio content I play: let context = getContext(); await context.resume().catch(console.error); let source =

Group notifications on Android

家住魔仙堡 提交于 2019-12-08 06:45:24
问题 I want to show notifications like on picture. If there is more than one, I want to show a counter too. I didn't find info in official doc. Now I just update my notification by id: ((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE)) .notify(PUSH_NOTIFICATION_ID, notification); How can I do it ? 回答1: NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext()); mBuilder.setSmallIcon(R.mipmap.ic_launcher); mBuilder.setContentTitle(topic

Notification icon on status bar is coming as white box

感情迁移 提交于 2019-12-08 05:57:50
问题 How do i customize the notification icon on the status bar in my phone running Android 5.0. It always comes as a white box(image attached). The notification icon in the notification bar comes colorful as expected but the status bar icon comes as white square box. l 回答1: android 5.0 uses the icon that you give him and puts a color filter on it. If you want to see your icon, you must use an icon with transparency (png). I advice you to set another icon other than the icon of your application

How to open specific activity after clicking on notification?

六月ゝ 毕业季﹏ 提交于 2019-12-08 04:52:40
问题 I want to redirect ShowNotificationActivity after clicking on the notification. but when I click on it the app starts from the begining. how to solve this issue? here is the code. public class MyFirebaseMessagingService extends FirebaseMessagingService { private static final String TAG = MyFirebaseMessagingService.class.getSimpleName(); private NotificationUtils notificationUtils; NotificationDatabaseHandler notificationDatabaseHandler; @Override public void onMessageReceived(RemoteMessage