notificationmanager

Android: Placing a random item from a String Array in to Notifications

混江龙づ霸主 提交于 2019-12-12 03:58:21
问题 I want my app to be able to pick a random item from this string array: <string-array name="quote_list"> <item>Quote 1 </item> <item>Quote 2 </item> <item>Quote 3</item> </string-array> And send the item off in a notification to the user. (Will be at a time chosen by user, using alarmmanager) I believe I can generate a random item using the following method. How to get a random value from a string array in android? Would I start off with something like this? NotificationCompat.Builder mBuilder

android AlarmManager behavior when application is forced to close

拥有回忆 提交于 2019-12-12 00:50:18
问题 I use AlarmManager to issue local notifications to user. But if I kill my application using Settings->Apps->Stop, alarm manager seems to be destroyed and all the notification icons disappears from status bar. It it normal? The idea of local notifications is to persuade user to start my great app if it's closed. And it seems odd for me that they are being wiped out if I kill the app. 回答1: If you KILL your application you also kill the AlarmManager. There is nothing odd about it. You close the

Android notification, vibrates but no sound

≡放荡痞女 提交于 2019-12-11 11:06:19
问题 I've read some of the other posts on this subject and I think my code should be sounding an alarm, but it's not. It does vibrate, but no sound. Any suggestions on how to get this to convey sound ? Another part of the program is able to play a ringtone so the problem seems to be specific this routine. This is in a class that extends Service @Override public int onStartCommand(Intent intent, int flags, int startId) { Uri sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

Android notification displays wrong icon

懵懂的女人 提交于 2019-12-11 06:09:56
问题 I have a static Array with Icon ids: public static final int[][] ICON_IDS = { {R.drawable.ic_access_alarm_black_24dp, R.drawable.ic_access_time_black_24dp, R.drawable.ic_account_box_black_24dp, R.drawable.ic_add_black_24dp, R.drawable.ic_android_black_24dp, R.drawable.ic_clear_black_24dp, R.drawable.ic_delete_black_24dp }, { R.drawable.ic_settings_black_24dp, R.drawable.ic_airplanemode_active_black_24dp, R.drawable.ic_filter_list_black_24dp, R.drawable.ic_account_box_black_24dp, R.drawable.ic

Android Seek Bar in Status Bar

不羁的心 提交于 2019-12-10 17:16:32
问题 I'm developing an android application where i want to add the volume control in Status Bar. Can i add a seek bar inside the Status Bar. I have worked with NotificationManager and i've found that adding animation is difficult in Notification bar. But can anyone please suggest if i can add a seek bar in my Status Bar(Notification bar). 回答1: Short answer: No. Long answer: You can't add listeners to the widgets placed on the NotificationBar . You can't try adding an Intent to call an Activity

Android: new information replace old information in notification

北慕城南 提交于 2019-12-10 10:32:46
问题 From the documenation of the NotificationManager in Android: public void notify (int id, Notification notification) Post a notification to be shown in the status bar. If a notification with the same id has already been posted by your application and has not yet been canceled, it will be replaced by the updated information. it will be replaced by the updated information. I don't want the old information to be replaced, I want both notifications. NB: each notification has its own id:

How to detect if a notification has been dismissed?

蹲街弑〆低调 提交于 2019-12-10 01:06:42
问题 Is there any way in Android to detect when a user swipes a notification to the left and deletes it? I'm using an alarmmanager to set a repeating alert and I need my repeating alert to stop when the notification is cancelled by the user. Here's my code: Setting the repeating alert: AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), repeatFrequency, displayIntent); My notification code: @Override

Android notification manager doesn't work with the screen is off

天涯浪子 提交于 2019-12-09 20:56:37
问题 I have a count down timer that when it goes off (to zero) it checks to see if the app has focus. If not it launches a notification in the notification bar. When you click on the notification is re-opens the app. Now all of this works fine but if the screen happens to go off, the timer keeps going and the notification is available at the right time but never actually vibrates or rings until i turn the screen back on. Then it displays the notification like it was waiting in a queue or something

In Android how can i know the current notification id to clear the notification

放肆的年华 提交于 2019-12-09 06:37:56
问题 Now in android i put this code in one activity to show notification when a button pressed. static int notificationCount = 0; then btnNotification.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent notificationIntent = new Intent(AlertsActivity.this,NotificationActivitty.class); PendingIntent pIntent = PendingIntent.getActivity(AlertsActivity.this,notificationCount,notificationIntent,Intent.FLAG_ACTIVITY_NEW_TASK); // Construct the notification

Android AlarmManager Randomly Scheduling Notifications?

本小妞迷上赌 提交于 2019-12-08 03:02:28
问题 I'm trying to create a reminder application that pops up a reminder in the status bar. As I understand, the Android NotificationManager is the standard tool to use to schedule notifications however a BootService is needed in order to re-schedule notifications as scheduled events do not survive across boots. I've pieced together an application below which schedules a single reminder at boot time, and pops up a notification in the status bar. If you click the notification, it launches