android-notifications

android system notification limit per app

╄→尐↘猪︶ㄣ 提交于 2019-12-05 05:58:36
This may be off topic , but I couldn't found anything for it. Is there any limit on the number of notifications android app can display ?I am facing issue after 100 notifications. There is no documentation which states this clearly. Note: This is not really a good idea to show 100 notifications but It is required for certain reasons. Any help would be good. In API23 package com.android.server.notification; NotificationManagerService.java static final int MAX_PACKAGE_NOTIFICATIONS = 50; The limit for notifications and toasts is per app 50 According to @Nirel's answer. 1) I tried to run the code

How to be notified when screen pinning is turned off in Android 5.0 Lollipop?

孤街醉人 提交于 2019-12-05 05:52:26
问题 I have an app that runs in the background and starts an activity when a certain event occurs on the phone. I'm finding with Android 5.0 that when the user has screen pinning turned on with another app, the startActivity(intent) call is ignored completely. My app doesn't know that the activity didn't start, so the user then won't have another chance to see the activity until they manually reopen my app. Is there any sort of event I can register for to be notified when screen pinning is turned

Correct way to create Notification Channels from Android O Api

﹥>﹥吖頭↗ 提交于 2019-12-05 03:38:31
The notification channels which introduced from Android O (API 26) version.I read about it from the following links: Managing notification channels Google Sample for Creating Channel Questions: If I have multiple numbers of notification then Is it a good idea to create notification channels when the application starts and keep it at ApplicationScope ? public void addNotificationChannels(Context context) { List<NotificationChannel> channels = new ArrayList<>(); channels.add("channel_1"); channels.add("channel_2"); . . channels.add("channel_7"); NotificationManager notificationManager =

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

六眼飞鱼酱① 提交于 2019-12-05 03:28:20
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 annotations it is not working, because RemoteViews is using them to pass values. My second idea was to

Putting controls inside a notification in Android

我只是一个虾纸丫 提交于 2019-12-05 02:34:52
问题 The Spotify Android app has music controls put in the notification (play/pause, next song). I would like to let the user control a Service from a controls inside notification. How do I do that? 回答1: For this you need to make your own layout for Notification. Can you try with below code. First create an xml for your notification. custom_notification.xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layout" android:layout_width="fill_parent"

Is there a way an app can check if it is allowed to access notifications?

核能气质少年 提交于 2019-12-04 23:33:38
I want to implement an NotificationListenerService to get access to all notifications that are posted to the notification bar. I understand that I need to enable access to the Notifications in the Settings with this call: startActivity(new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS")); Is there a way to check if the user activated Notification access for my app? Ricardo I managed to find a slight hack to solve this. If you check the source of Settings.Secure , you will see that ENABLED_NOTIFICATION_LISTENERS is annotated with @hide . I don't know if this is intentional or

Cannot disable notification vibration in Android 8

时间秒杀一切 提交于 2019-12-04 23:28:23
问题 I try to disable vibration when showing a notification. Func: public static Notification buildNotifForUploaderService(Context ctx, String title, String message) { Notification notification; NotificationCompat.Builder notificationBuilder; //If device is Android 8+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH); //setting pattern to disable vibrating

Display Notification Text in Status Bar - Android

三世轮回 提交于 2019-12-04 23:19:58
问题 In my application I need to display notification to the user. The following code snippet worked great by display the icon and content title in the Android device title bar. var notificationManager = GetSystemService(Context.NotificationService) as NotificationManager; var uiIntent = new Intent(this, typeof(MainActivity)); var notification = new Notification(Resource.Drawable.AppIcon, title); notification.Flags = NotificationFlags.AutoCancel; notification.SetLatestEventInfo(this, title, desc,

Why does the “download completed” notification disappear on Gingerbread devices?

自作多情 提交于 2019-12-04 23:05:45
I'm using the DownloadManager class to programatically download a file. All works fine but I can't get the download completed notifcation to persist. It disappears immediately once the download has completed. Here's my code: Request rqtRequest = new Request(Uri.parse(((URI) vewView.getTag()).toString())); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { rqtRequest.setShowRunningNotification(true); } else { rqtRequest.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); } ((DownloadManager) getSystemService(DOWNLOAD_SERVICE)).enqueue(rqtRequest); I've

java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.lang.Iterable.iterator()' when starting a notification

▼魔方 西西 提交于 2019-12-04 22:30:56
I noticed some of my users are getting this exception. I don't know how to reproduce it, I only have the reports on Crashlytics. Seems to be deep inside Google's code. Out of thousands who have used this code only 39 have had the exception. Any idea what might be wrong? Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.lang.Iterable.iterator()' on a null object reference at android.app.ApplicationPackageManager.getUserIfProfile(ApplicationPackageManager.java:2141) at android.app.ApplicationPackageManager.getUserBadgeForDensity