android-notifications

How to send a notification with sound and vibration in do not disturb(DND) mode in android

我只是一个虾纸丫 提交于 2020-05-27 12:20:57
问题 How can I send a notification with sound and vibration when phone is in do not disturb mode on Android Devices. I use the following code, and it is working when my application is currently in foreground. PendingIntent contentIntent = PendingIntent.getActivity(this, NOTIFICATION_ID, resultIntent, 0); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_notification) .setContentTitle("Notification") .setStyle(new NotificationCompat.BigTextStyle(

How to send a notification with sound and vibration in do not disturb(DND) mode in android

隐身守侯 提交于 2020-05-27 12:20:56
问题 How can I send a notification with sound and vibration when phone is in do not disturb mode on Android Devices. I use the following code, and it is working when my application is currently in foreground. PendingIntent contentIntent = PendingIntent.getActivity(this, NOTIFICATION_ID, resultIntent, 0); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_notification) .setContentTitle("Notification") .setStyle(new NotificationCompat.BigTextStyle(

Notification does not get cancelled in Android 10

試著忘記壹切 提交于 2020-05-05 05:35:49
问题 The bounty expires in 3 days . Answers to this question are eligible for a +50 reputation bounty. Maulik Dodia wants to draw more attention to this question. Problem: I want to cancel a Notification when I directly reply to that Notification. It works in Android N but doesn't work on Android 10. My Code is like below: MainActivity.java public class MainActivity extends AppCompatActivity { public static final int NOTIFICATION_ID = 1256; public static final String CHANNEL_1_ID = "channel1";

Android - Launching Activity from Notification

守給你的承諾、 提交于 2020-04-30 07:07:43
问题 I'm writing a time tracker app that starts an unbound foreground service to keep the user informed about the elapsed time. The service runs smoothly and everything works like a charm... EXCEPT for one thing! When the user clicks on the notification the apps main activity should start. According to Androids documentation (https://developer.android.com/training/notify-user/navigation) this code should work, but it just starts the Android Settings Activity for the app. override fun

Android - Launching Activity from Notification

你离开我真会死。 提交于 2020-04-30 07:04:06
问题 I'm writing a time tracker app that starts an unbound foreground service to keep the user informed about the elapsed time. The service runs smoothly and everything works like a charm... EXCEPT for one thing! When the user clicks on the notification the apps main activity should start. According to Androids documentation (https://developer.android.com/training/notify-user/navigation) this code should work, but it just starts the Android Settings Activity for the app. override fun

MediaStyle : RemoteServiceException: Bad notification posted from package

浪子不回头ぞ 提交于 2020-04-07 06:28:05
问题 I'm trying to create a notification media controller in my app using the code below which is working fine on all devices expect Huawei P8 Lite with Android 5.0 , I get this error log from Firebase Test Lab : android.app.RemoteServiceException: Bad notification posted from package maa.app_app: Couldn't expand RemoteViews for: StatusBarNotification(pkg=maa.app_app user=UserHandle{0} id=555 tag=null score=10 key=0|maa.app_app|555|null|10108: Notification(pri=1 contentView=maa.app_app/0x109007f

Xamarin Android Cancel Task from Notification

不问归期 提交于 2020-03-05 04:23:28
问题 I have a method that will send a user a local notification once per TimeSpan interval: public async void GetVehiclePositionRepeatAsync(TimeSpan interval, CancellationToken cancellationToken) { while (true) { var task = new Task(() => { cancellationToken.ThrowIfCancellationRequested(); var not = new PushNotificationGenerator(this, "Hooray!", "yay", "STOP_NOTIFICATIONS"); not.Push(); }); task.Start(); await Task.Delay(interval, cancellationToken); } } What I'm shooting for is to have two

Why does the notification not show up in API 28?

二次信任 提交于 2020-02-14 21:36:49
问题 I have looked at android documentation and I have seen all the answers in StackOverflow, however, I cannot seem to understand why the notification I am trying to show not show up. Whenever I click the button, instead of notification showing up, the app crashes, can someone please give me insight as to why this is occurring? notify_me.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

Firebase scheduled notification in android

会有一股神秘感。 提交于 2020-02-14 13:23:47
问题 I'm developing an android app using firebase, this app should push notifications twice a day by hours user should set in app settings. I saw a similar question was asked at least 2 years ago, but no answer, maybe now there is an option to do it. Is there anyway I can achieve this using Firebase ? If no, how can I achieve it ? 回答1: You can schedule sending notifications from the Firebase console. But that is limited to notifications you manually enter. There is no way to schedule "twice a day"

Firebase scheduled notification in android

社会主义新天地 提交于 2020-02-14 13:23:26
问题 I'm developing an android app using firebase, this app should push notifications twice a day by hours user should set in app settings. I saw a similar question was asked at least 2 years ago, but no answer, maybe now there is an option to do it. Is there anyway I can achieve this using Firebase ? If no, how can I achieve it ? 回答1: You can schedule sending notifications from the Firebase console. But that is limited to notifications you manually enter. There is no way to schedule "twice a day"