android-notifications

Possible to make an Android Notification that does not call an Intent? [closed]

最后都变了- 提交于 2019-12-02 10:56:09
I need to put a Notification in the Status bar while my app is running, but I don't want it to call back to my Activity if selected. Its meant to just be info to the user that the app is running - basically a reminder in case they press the home button and minimize it. Ideas? I have the same desired behavior. My solution was: Intent intent = new Intent(this, YourActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP); mPendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0); Also, to make the notification automatically

Group Firebase FCM on Android Device

怎甘沉沦 提交于 2019-12-02 10:40:38
I am trying to send cloud messages using the Firebase console. I am doing this for android device. The push notifications do appear on the device fine along with the data sent with it. But each notification shows up on its own. Meaning if I send 3 notifications three items show up in the notification bar. What I want to achieve is that all the notifications to be grouped under one heading. As you have in WhatsApp or Facebook. How can this be achieved using the Firebase Console? By grouping the notification, do you mean stacking or bundling notifications ? If so, this is actually depends on how

Broadcast receiver, check a checkbox preference state on bootup then send a notification

不羁的心 提交于 2019-12-02 09:52:05
My problem is that when I try to read a checkbox preference state from a different activity on bootup then send a status bar notification. Then when the device boots the I get a force close error message popup then when I go into the error log I don't understand what happens. The code for the broadcast receiver is shown below: @Override public void onReceive(Context context, Intent intent) { if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){ //this creates a reference to my preferences activity Prefs prefsC = new Prefs(); SharedPreferences prefs = context.getSharedPreferences("Prefs"

Update android notification with new line is removing previous lines

落花浮王杯 提交于 2019-12-02 07:03:30
问题 I want to group notifications into a summary. I achieve this by having a single ID for all notifications. This way android will not create new notifications but update the existing one (reduced code): Notification summaryNotification = new NotificationCompat.Builder(this) .setGroupSummary(true) .setDefaults(Notification.DEFAULT_ALL) .setStyle(new NotificationCompat.InboxStyle() .addLine(msg) .setBigContentTitle("My App") .setSummaryText("FooBar")) .build(); mNotificationManager.notify(uuid,

A notification of the foreground service doesn't show on Android 8.+

家住魔仙堡 提交于 2019-12-02 05:57:28
My foreground service doesn't show a notification when it works on Android Oreo. It works perfectly on Android versions from 15 to 25. When I do targetSdkVersion from 26 to 25 this issue disappears. But this solution seems not good. I prepared test project with this issue. What should I do for fixing it on Android Oreo with targetSdkVersion 26 ? My foreground service, SoundService.java( full source ): public class SoundService extends Service implements MediaPlayer.OnErrorListener, MediaPlayer.OnPreparedListener, MediaPlayer.OnBufferingUpdateListener { private final static String TAG =

Android multiple notification avoid blinking while updating

谁说胖子不能爱 提交于 2019-12-02 05:46:52
问题 I am working on such application which is using multiple notification.where each notification have playpause icon which perform play/pause of music player. but there is odd behavior with updating that notifications which keep blinking while updating it. My Code is below @SuppressLint("NewApi") public void UpdateNotificationfunction(int currentNotificationNo) { PendingIntent pendingIntent = null; PendingIntent pendingIntent1 = null; PendingIntent pendingIntent2 = null; PendingIntent

Notification: Sony devices do not show any notification

不羁岁月 提交于 2019-12-02 03:10:30
I use these lines of code for showing notification in my app but sony devices(xperia p, sola, acro s) does not show any notification. I dont have any problem with other android devices. Intent notificationIntent = new Intent(context, ActivityShowQuestion.class); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent contentIntent = PendingIntent.getActivity(context, Integer.parseInt(id), notificationIntent, PendingIntent.FLAG_ONE_SHOT); NotificationManager nm = (NotificationManager) context .getSystemService

How to collapse multiple notifications into a single one using Firebase?

倾然丶 夕夏残阳落幕 提交于 2019-12-02 02:50:01
I have function in Firebase Cloud Functions which is used to send notifications to specific users within my app and has as the notificationContent the following code: const notificationContent = { notification: { title: "My Notification Title", body: "My Notification Body", icon: "default", sound : "default" } }; I have tried to use collapse_key: "unique_key" but it has no effect. I read the has an effect only when the device is offline. I also have used a tag: "unique" but every time a new notification arrives, it will override the oldest one. I there any way in which I can achieve this with

Up Navigation not launching parent activity

感情迁移 提交于 2019-12-01 23:51:50
问题 I have two activities A and B where A is the parent of B. Now I show a notification that launches B. when I tap on the notification, B launches. Then I click on the up button. It works finr when activity A is in the backstack but otherwise the app Just closes and does not launch activity A. My Setup. I have declared A as Parent of B in Manifest with A in SingleTop launchMode <activity android:name=".A" android:label="@string/app_name" android:screenOrientation="portrait" android:launchMode=

Android Notification Channel sounds stop working when using sound URIs that reference resource ids

ぐ巨炮叔叔 提交于 2019-12-01 23:09:45
问题 We have created notification channels for devices running on Oreo and above, that use a custom notification sound that is located in our /res/raw folder. Recently, when users upgraded our app, the notification sound just stopped working and the notification only vibrates the device. We have confirmed that uninstall/reinstall or clearing app data resolves the issue. However, in order to get notification sounds to work for everyone again without having to reinstall, we need to essentially