No response using Notifaction in Android

Source: Internet
Author: User

Time: 2016-4-20-11:07:29
No response when using Notifaction.builder (), do you want to set icons icon?
 
   
  
  1. builder.setSmallIcon(R.drawable.ic_launcher);
If the icon is not set, there will be no response when the trigger occurs.
Full code style:
  
 
  1. Intent intent = new Intent(context, XXActivity.class);
  2. intent.putExtra("recFile", recName);
  3. pendingintent Span class= "PLN" > pendingintent = Pendingintent getactivity ( context Span class= "lit" >0 intent Span class= "PLN" > pendingintent flag_update_current
  4. notificationmanager manager = ( notificationmanager ) context getsystemservice context notification_service
  5. Notification.Builder builder = new Notification.Builder(context);
  6. builder.setTicker("新的通知");
  7. builder.setSmallIcon(R.drawable.ic_launcher);
  8. builder.setContentTitle("收到新的通知");
  9. builder.setContentText("您有一条新的通知");
  10. builder.setContentIntent(pendingIntent);
  11. Notification notification = builder.build();
  12. notification.flags = Notification.FLAG_AUTO_CANCEL;
  13. manager.notify(NOTIFACTION_FLAG_CODE, notification);



From for notes (Wiz)

No response using Notifaction in Android

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.