notificationmanager

Issue with Notification Manager on android

拈花ヽ惹草 提交于 2019-12-08 02:06:37
问题 I'm trying to notify using a button, but both Notification and setLatestEventInfo is deprecated. Two errors: 1.The constructor Notification(int, CharSequence, long) is deprecated Notification notify = new Notification(android.R.drawable.stat_notify_more, "Hello all", System.currentTimeMillis()); 2.The method setLatestEventInfo(Context, CharSequence, CharSequence, PendingIntent) in the type Notification is not applicable for the arguments (Context, CharSequence, CharSequence, Intent) notify

Android : Unable to display multiple lines of text in Notification

橙三吉。 提交于 2019-12-07 06:13:16
问题 I am trying to display multiple lines of Text using BigTextStyle in Notification but unable to do so. I am using the code below. public void sendNotification(View view) { String msgText = "Jeally Bean Notification example!! " + "where you will see three different kind of notification. " + "you can even put the very long string here."; NotificationManager notificationManager = getNotificationManager(); PendingIntent pi = getPendingIntent(); android.app.Notification.Builder builder = new

Issue with Notification Manager on android

拥有回忆 提交于 2019-12-06 10:49:28
I'm trying to notify using a button, but both Notification and setLatestEventInfo is deprecated. Two errors: 1.The constructor Notification(int, CharSequence, long) is deprecated Notification notify = new Notification(android.R.drawable.stat_notify_more, "Hello all", System.currentTimeMillis()); 2.The method setLatestEventInfo(Context, CharSequence, CharSequence, PendingIntent) in the type Notification is not applicable for the arguments (Context, CharSequence, CharSequence, Intent) notify.setLatestEventInfo(context, title, details, intent); public class MainActivity extends Activity {

Android AlarmManager Randomly Scheduling Notifications?

ⅰ亾dé卋堺 提交于 2019-12-06 05:50:51
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 MainActivity which, in the future, will have options to add more reminders, delete them, or whatever. The

Android : Unable to display multiple lines of text in Notification

十年热恋 提交于 2019-12-05 08:29:08
I am trying to display multiple lines of Text using BigTextStyle in Notification but unable to do so. I am using the code below. public void sendNotification(View view) { String msgText = "Jeally Bean Notification example!! " + "where you will see three different kind of notification. " + "you can even put the very long string here."; NotificationManager notificationManager = getNotificationManager(); PendingIntent pi = getPendingIntent(); android.app.Notification.Builder builder = new Notification.Builder( this); builder.setContentTitle("Big text Notofication") .setContentText("Big text

notificationManager get notification by Id

不打扰是莪最后的温柔 提交于 2019-12-05 01:43:31
Anyone know any way to get a notification by id? It's I want when get a new notification if it is still being shown in the status bar of Android want to get the information and add it to a new notification. Thank you. NotificationManager doesn't give you a way to find existing notifications by ID. If you want to update a notification, post a new notification but use the same ID. It will either show it as new or update the existing notification with that ID. hakanbing You can get active notification list from NotificationManager. @RequiresApi(api = Build.VERSION_CODES.M) public Notification

How to detect if a notification has been dismissed?

天大地大妈咪最大 提交于 2019-12-04 22:21:46
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 public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Get the

Android NotificationManager giving me “no valid small icon” error

元气小坏坏 提交于 2019-12-04 15:20:20
问题 I am having a strange error with notification manager. @Override public void onMessageReceived(String from, Bundle data) { Log.i(TAG, "IP : " + (String) data.get("ip")); NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Intent acceptNextIntent = new Intent(MainActivity.BROADCAST_KEY_ACCEPT); // acceptNextIntent.putExtra("ip", (String) data.get("blah")); //add stuff here PendingIntent acceptNextPendingIntent = PendingIntent.getBroadcast

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

怎甘沉沦 提交于 2019-12-04 13:23:01
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. How do I get it so that the notification manager will actually alert the user when the screen is

Android NotificationManager giving me “no valid small icon” error

做~自己de王妃 提交于 2019-12-03 09:33:53
I am having a strange error with notification manager. @Override public void onMessageReceived(String from, Bundle data) { Log.i(TAG, "IP : " + (String) data.get("ip")); NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Intent acceptNextIntent = new Intent(MainActivity.BROADCAST_KEY_ACCEPT); // acceptNextIntent.putExtra("ip", (String) data.get("blah")); //add stuff here PendingIntent acceptNextPendingIntent = PendingIntent.getBroadcast(this, 0, acceptNextIntent, 0); Intent declineNextIntent = new Intent(MainActivity.BROADCAST_KEY_DECLINE);