android-notifications

Open Gallery Folder By Click On Notification

偶尔善良 提交于 2019-12-14 02:55:06
问题 I used this code to send notification. public static void sendNotificationPhoto(Context context, Class<?> activityTarget) { Log.i( TAG , "Send Photo Notification"); NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Notification notifyDetails = new Notification(R.drawable.ic_plusone_standard_off_client, "New Alert!", System.currentTimeMillis()); Intent intent = new Intent(context, activityTarget); int id = NOTIFICATION_ID

How to preserve current back stack (or task) when notification is clicked?

断了今生、忘了曾经 提交于 2019-12-14 00:45:03
问题 In my application, I create a notification which starts Details Activity . I want to add this activity to top of current task (or back stack). For example I expect application task (back stack) to behave like this: but I get this: I have not used FLAG_ACTIVITY_CLEAR_TASK and FLAG_ACTIVITY_NEW_TASK flags. What should I do? Edit: First picture is just an example. I think the the question's title is completely explicit. I want to add Details Activity on top of current stack, and not to start

Custom notification with two action button

心已入冬 提交于 2019-12-13 19:30:46
问题 I am using following code to generate notifications with two action button and some details. Please help me, why i am not able to see action button in notification? public static void sendNotification(Context mContext, int mode, String title, String message) { try { RemoteViews remoteViews = new RemoteViews(mContext.getPackageName(), R.layout.custom_notification); // Set Notification Title String strtitle = "Instevent"; // Set Notification Text String strtext = "Event has created"; // Open

Set android notifications from SQLite DB

為{幸葍}努か 提交于 2019-12-13 19:27:27
问题 I am building a reminder application where the user enters an event into an SQLite DB. The main screen lists the title of each reminder and clicking an item shows the details of it. All of this works fine. Now I want to allow the user to set up notifications for each item, being given an option to set a reminder for 15 mins, 30 mins, or 1hr before the event is scheduled. I have no clue how to go about this and can't find any good tutorial on it. Can anyone give me some idea as to how I might

Vibrate Not working with Notification

送分小仙女□ 提交于 2019-12-13 14:52:20
问题 I am trying to set vibrate and sound for notification. For some reason its not working for me :( Here is the code what I am trying NotificationManager notificationManager = getNotificationManager(); NotificationCompat.Builder builder = new NotificationCompat.Builder( context); builder.setSound(alarmSound); builder.setVibrate(new long[] { 1000, 1000, 1000 }); Notification notification = builder.setContentIntent(contentIntent) .setSmallIcon(icon).setTicker(title).setWhen(0) .setAutoCancel(true)

Android: Notification stops updating once it has updated for a certain number of times on Kit-Kat

∥☆過路亽.° 提交于 2019-12-13 12:53:16
问题 So I have a notification in my app. The notification has some text and an image which I fetch from a LruCache which I populate at the start. The problem is that on Kit-Kat devices (Moto E, XIomi) in my case, the notification stops updating if it has already updated a fixed number of times, lets say n (this n is usually fixed for each device, and is <10). This is my code for updating String title = CommonUtils.getTitleFromID(id, context); Bitmap bitmap = DataProvider.getInstance(context)

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

放肆的年华 提交于 2019-12-13 12:23:39
问题 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

NotificationListenerService stopping and can't be restarted without a reboot

自闭症网瘾萝莉.ら 提交于 2019-12-13 11:37:01
问题 With android 4.4 I'm finding that some users are having the notificationListenerService I've implemented will just stop working. I've actually seen this myself too. I've never managed to capture any logcats around the time of it happening, but even going into the notification access section and switching off and back on the notification access doesn't help. Is there something that can cause this to happen. I'm not sure if my app is crashing and causing this, but even if so it seems the only

Start multiple activities from Notification via PendingIntent

ⅰ亾dé卋堺 提交于 2019-12-13 11:09:38
问题 I'd like to start multiple activities when press on Notification. I didn't find any docs about how to set multiple intents in a single PendingIntent . One solution could be to start next activity in the first one's onCreate() and so forth, but I don't like this, maybe there is something else. 回答1: Finally, I got the answer for this - it's pretty trivial, just using method getActivities() to the PendingIntent like so: Intent myIntent1= new Intent(ctx, MyActivity1.class); myIntent1.setFlags

Android MediaStyle NotificationCompat displays 3 actions maximum

前提是你 提交于 2019-12-13 06:47:21
问题 I have 2 problems with my NotificationCompat.Builder set up as MediaStyle : 1) I set up 5 actions and only 3 are displayed in the expanded notification. (The first 3 displayed actions are working fine). 2) None action is displayed in the compact notification though I set up 1 action. I'm testing on a Samsung S4 on Lollipop 5.1.1 (Cyanogen) and my app uses support library 23.2.1 Below is my NotificationCompat.Builder : notificationBuilder = new NotificationCompat.Builder(act) .setPriority