android-notifications

Doze mode on Oreo

谁都会走 提交于 2020-01-03 03:56:09
问题 I am facing issue in my app regarding doze mode. I am making a chat application and when app is in backgroud during doze mode and receive any message . Device does not show notification in orea. I have followed the proper procedure for OREO notification by building channel for it. I need to find if there is a way to whiteList my app from doze mode so that I can have notifications. Or any other process to optimize notification building. 回答1: I do not need to whitelist my application to get

Android - Set notification to never go away

风格不统一 提交于 2020-01-02 16:22:48
问题 I have this code that works great: Notification n = builder.build(); n.flags = Notification.FLAG_NO_CLEAR; But when I restart the phone, the notification goes away. Is there any flag that make that happen? 回答1: If you want to print notification when the device boots up, you can create a receiver that is invoked when the system boot is completed, for this, first create a receiver, public class MyReciever extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent)

Android - GCM push notification that sends user to Activity does not result in onCreate call

a 夏天 提交于 2020-01-02 11:03:14
问题 I am able to create push notifications, and to send the user to whichever Activity I want, but I notice that whenever the user lands on that Activity, the onCreate function does not get called. Is that supposed to be the case? How do I set it so that the onCreate of the Activity is called? Here is my Activity: public class QuestionActivity extends BaseListActivity { @Override public void onCreate(Bundle savedInstanceState) and here is how the notification is generated: Intent

Android - GCM push notification that sends user to Activity does not result in onCreate call

巧了我就是萌 提交于 2020-01-02 11:00:12
问题 I am able to create push notifications, and to send the user to whichever Activity I want, but I notice that whenever the user lands on that Activity, the onCreate function does not get called. Is that supposed to be the case? How do I set it so that the onCreate of the Activity is called? Here is my Activity: public class QuestionActivity extends BaseListActivity { @Override public void onCreate(Bundle savedInstanceState) and here is how the notification is generated: Intent

Urban Airship: custom icon for default status bar notification

a 夏天 提交于 2020-01-02 05:34:09
问题 Urban Airship recommends creating a custom notification with CustomPushNotificationBuilder if you want to make any modifications to the status bar notification, including trivially changing the icon. Unfortunately, using a RemoteView for notifications carries many unwanted implications with it related to custom manufacturer and/or platform-specific skins, including text colors and references to private resources (for instance @*android:drawable/notify_panel_notification_icon_bg_tile on

Why NotificationManager works so slow during the update progress?

半世苍凉 提交于 2020-01-02 04:44:11
问题 I publish file upload progress via NotificationManager, but while updating its progress UI freezes. I use NotificationCompat.Builder, which cached in the class field. So progress publishing is a very simple: manager.notify(id, uploader. setProgress(MAX_PROGRESS, (int) (progress * 100), false). build() ); Update progress is guaranteed to execute from the main thread(wrapped in Handler decorator). this.request.setCallback(new UploaderDecorator(this.request.getCallback())); The very publication

NotificationManager.cancel() doesn't work: Notification isn't removed

本秂侑毒 提交于 2020-01-02 02:51:28
问题 I've been trying to remove a persistent Notification set by a Service using: startForeground(1337, notification); The code I'm using to cancel it: NotificationManager nManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); nManager.cancel(1337); // cancel existing service notification, doesn't take effect nManager.cancelAll(); //surpluous, but also doesn't take effect To clarify why I am doing this: the Service starts with a default persistent Notification.

How to make a count down timer in Notification's view?

对着背影说爱祢 提交于 2020-01-02 01:45:38
问题 I figured out how to make custom views using RemoteViews class. I also know how to use Chronometer and ProgressBar inside of RemoteViews. But how to make a count down View, almost exactly the same as Chronometer but with the difference that it will be counting down instead of up? I tried to copy the source of Chronometer class and modify it so it will fit my needs, but there are annotations like @android.view.RemotableViewMethod , which i can not import to my project. Unfortunately, without

how get message body when FCM notification message is tap?

旧城冷巷雨未停 提交于 2020-01-01 10:28:17
问题 When app is in background, the notification message is deliver by Notification, when the notification is tap, app is launch, how can i get the message body? the intent is this: Bundle[{google.sent_time=1470813025421, from=568540028909, google.message_id=0:1470813025865549%31bd1c9631bd1c96, collapse_key=com.google.firebase.quickstart.fcm}] no message body in intent, only message id! Thanks! 回答1: try this @Override public void onMessageReceived(RemoteMessage remoteMessage) { // TODO(developer):

how to set NAVIGATION_MODE_LIST on Toolbar new appcompat v7 21

风格不统一 提交于 2020-01-01 08:34:10
问题 Now all methods related to navigation modes in the ActionBar class, such as setNavigationMode() ... are now deprecated. The documentation explains: Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead. In my current application, there is a spinner on ActionBar. How do I apply NAVIGATION_MODE_LIST on the new widget Toolbar in the new version appcompat v7 21. Thanks in advance. 回答1: With the API 21