android-notifications

Android: Grouped notifications and summary still shown separately on 4.4 and below

被刻印的时光 ゝ 提交于 2019-12-18 11:17:18
问题 I want to implement stacked notifications on Android Wear To do that I create 1 summary notification and N individual notifications for each "item". I want only the summary to be shown on the phone. Here's my code: private void showNotifications() { NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); showNotification1(notificationManager); showNotification2(notificationManager); showGroupSummaryNotification(notificationManager); }

Android push notification: Get data, store and display on new activity on click of notification

折月煮酒 提交于 2019-12-18 10:57:26
问题 I am developing an application which is having push notification functionality. I followed the following link as Android Push Notification I tried and successfully send URL and open the web page on click of notification by doing the following change in code of generateNotification(). /** * Issues a notification to inform the user that server has sent a message. */ private static void generateNotification(Context context, String message) { NotificationManager notificationManager =

Failed to post notification on channel “null” Target Api is 26

ぃ、小莉子 提交于 2019-12-18 10:40:12
问题 Two log showing 1: Use of stream types is deprecated for operations other than volume control 2: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case 回答1: From the developer documentation: When you target Android 8.0 (API level 26), you must implement one or more notification channels to display notifications to your users. int NOTIFICATION_ID = 234; NotificationManager notificationManager = (NotificationManager) ctx

PendingIntent not opening Activity in Android 4.3

↘锁芯ラ 提交于 2019-12-18 10:39:59
问题 In my Service , I open up a notification on normal run, using this code: private final static NOTIFICATION_ID = 412434; private void startNotification() { NotificationCompat.Builder builder = new NotificationCompat.Builder( this); builder.setSmallIcon(R.drawable.notification); builder.setContentTitle("Running"); final Intent intent = new Intent(this, MainActivity.class); intent.setAction(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);

How to send notification from handheld to wear to open Activity on wear device

为君一笑 提交于 2019-12-18 10:10:10
问题 I'm wondering if it is possible to send notification from handheld (android phone) to wear device to open Activity on wear device? What I want to do is as following. So far, I checked the following documents, but it's different from what I want to do. Adding Wearable Features to Notifications What is described here is sending notification from phone to wear, then open activity on the phone (I want to open activity on the wear) Create Custom Notifications What is described here is sending

Android: is it possible to remove a system-managed notification programmatically?

与世无争的帅哥 提交于 2019-12-18 08:59:13
问题 I've made an application that configure a vpn profile and connects to it. When I'm connected, I want just my notification to be shown, but android provides its own notification that is shown during the lifetime of a VPN connection. Is there anyway to "delete" that notification, or, at least, to delete the corresponding icon from the top of the screen? 回答1: This is not possible on Android, sorry. You cannot control notifications outside of your own app, regardless of whether they belong to

FCM showing duplicate notification when app is in background

空扰寡人 提交于 2019-12-18 08:25:48
问题 I implemented FCM in my project. Push notification is working as expected, onMessageReceived is called when a notification is received. This is true when app is in the foreground. However, when the app is in the background, the system tray always display a duplicate notification when one arrives (e.g. when Notification A is received, system tray display 2 Notification A) How to fix this? EDIT: added code I extended FirebaseMessagingService class and have this in the onMessageReceived method

Android Wear - start wear activity from handheld action

佐手、 提交于 2019-12-18 06:38:18
问题 I'm sending a notification from an android handheld device to an android wear device. I'd like to include an action with the notification that starts an activity on the android wear device. How do I set the pending intent to an activity on the wear device? I'm able to launch the activity if the notification is created on the wearable, but not if the notification is created on the phone and then sent to the wearable. // creating action for push notification created on handheld public

Android Wear - start wear activity from handheld action

家住魔仙堡 提交于 2019-12-18 06:37:25
问题 I'm sending a notification from an android handheld device to an android wear device. I'd like to include an action with the notification that starts an activity on the android wear device. How do I set the pending intent to an activity on the wear device? I'm able to launch the activity if the notification is created on the wearable, but not if the notification is created on the phone and then sent to the wearable. // creating action for push notification created on handheld public

How to get text of Stacked Notifications in Android

為{幸葍}努か 提交于 2019-12-18 04:03:13
问题 The question is how to get the TEXT (not title) field of all incoming notifications when they get stacked (like in Whatsapp). public class NLService extends NotificationListenerService { public void onNotificationPosted(StatusBarNotification sbn) { Log.v(Constants.TAG_notifs, "------------------------- in onNotificationPosted(), Notification Text = " + sbn.getNotification().tickerText); Bundle extras = sbn.getNotification().extras; if (extras.containsKey("android.text")) { if (extras