android-notifications

Notification passes old Intent Extras

老子叫甜甜 提交于 2019-11-27 06:31:04
i am creating a notification inside a BroadcastReceiver via this code: String ns = Context.NOTIFICATION_SERVICE; NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(ns); int icon = R.drawable.ic_stat_notification; CharSequence tickerText = "New Notification"; long when = System.currentTimeMillis(); Notification notification = new Notification(icon, tickerText, when); notification.defaults |= Notification.DEFAULT_VIBRATE; long[] vibrate = {0,100,200,200,200,200}; notification.vibrate = vibrate; notification.flags |= Notification.FLAG_AUTO_CANCEL;

How to display multiple notifications in android

半城伤御伤魂 提交于 2019-11-27 06:28:30
I am receiving only one notification and if there is another notification comes, it replaces the previous one and here is my code private static void generateNotification(Context context, String message, String key) { int icon = R.drawable.ic_launcher; long when = System.currentTimeMillis(); NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification(icon, message, when); String title = context.getString(R.string.app_name); Intent notificationIntent = new Intent(context,

Music player control in notification

喜你入骨 提交于 2019-11-27 06:25:32
how to set notification with play/pause, next and previous button in android.! I am new with Android & also at stack overflow. So please bear with me. I set notification when song is start to play like below : ` @SuppressLint("NewApi") public void setNotification(String songName){ String ns = Context.NOTIFICATION_SERVICE; NotificationManager notificationManager = (NotificationManager) getSystemService(ns); @SuppressWarnings("deprecation") Notification notification = new Notification(R.drawable.god_img, null, System.currentTimeMillis()); RemoteViews notificationView = new RemoteViews

Android 4: can't dismiss notification by swiping

試著忘記壹切 提交于 2019-11-27 06:04:39
问题 I have some code that creates some notifications, it's really basic. int icon = R.drawable.notification; CharSequence tickerText = "Text"; long when = System.currentTimeMillis(); Notification notification = new Notification(icon, tickerText, when); Context context = getApplicationContext(); CharSequence contentTitle = "Text"; CharSequence contentText = "Text"; Intent notificationIntent = new Intent(this, RequestActivity.class); PendingIntent contentIntent = PendingIntent.getActivity(this, 0,

Resume an activity when clicked on a notification

坚强是说给别人听的谎言 提交于 2019-11-27 05:55:18
问题 I've made an app which manage sms, I've created the notifications but when I click on them it starts another activity, I would like to know how to check if an activity has been stopped and resume it. Here is the code used to create the pendingintent: private void createNotification(SmsMessage sms, Context context){ final NotificationManager nm = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); String contentTitle = ""; // construct the Notification object. final

Can I detect if Android has killed the application (task process) from a Notification Intent / PendingIntent?

有些话、适合烂在心里 提交于 2019-11-27 05:43:58
问题 The Android OS kills processes when it's low on memory. Scenario: Android kills the app process and I re-open it through either the Android launcher or the recent-task list (long press home button). I can check if Android killed my app process in the onCreate() method of the most recently viewed activity using: @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); if (savedInstanceState != null) { // Re-initialise things that killing the app would

How to open fragment page, when pressed a notification in android

♀尐吖头ヾ 提交于 2019-11-27 05:24:49
问题 I am trying to open a fragment when I press a notification in the notification bar. My app structure is: a base activity with a nav drawer menu some fragment that are opened from menu b.setOnClickListener(new OnClickListener() { @SuppressWarnings({ "deprecation", "static-access" }) public void onClick(View v) { w_nm=(NotificationManager) getActivity().getSystemService(getActivity().NOTIFICATION_SERVICE); Notification notify=new Notification(R.drawable.notnificationlogo,waternoti,System

Clicking on Notification is not starting intended activity?

不羁岁月 提交于 2019-11-27 04:36:39
I am using GCM in my application and also using NotificationManager to Create a Notification whenever GCM message is received.Till now everything is working perfectly and GCM message is showing correctly in Notification area, but when I click on the notification it should start an activity of my application which will display the message detail which is not happening. Every-time I click on notification it does not start any activity and it remains as is.My code for creating Notification is : private void sendNotification(String msg) { SharedPreferences prefs = getSharedPreferences(

Android - use external profile image in notification bar like Facebook

随声附和 提交于 2019-11-27 04:24:58
I know you can send info in the push notification parameters like message, title, image URL, etc. How does Facebook show your profile pic with your message in the notification area? I want to use an external image in the notification area, so when you pull it down you see the profile image with the message. Right now, mine just shows the default icon from the drawable folder. I figured this might be a common question but couldn't find anything. Any help would be nice. This statement will use a method to convert a URL (naturally, one that points to an image) into a Bitmap . Bitmap bitmap =

Intent from notification does not have extras

六月ゝ 毕业季﹏ 提交于 2019-11-27 04:17:16
问题 This seem to be a common problem and I went through all the related questions I could find already: Activity isn't picking up new intent, Why extra data (integer) is not sent in android notification intent?, Notification passes old Intent Extras, Can't put extras for an intent in notification, android pending intent notification problem; but still cannot figure this out. Problem is the same. I set a notification with a PendingIntent carrying some extra information and I don't get it on the