zoukankan      html  css  js  c++  java
  • android Notification 学习

     1             Notification notification = new Notification(com.android.internal.R.drawable.stat_sys_warning,"notification.",System.currentTimeMillis());
    2 notification.defaults = Notification.DEFAULT_SOUND;
    3 notification.flags = Notification.FLAG_AUTO_CANCEL;
    4 notification.tickerText="miss sdCard";
    5 NotificationManager notificationManager = (NotificationManager)mContext.getSystemService(Context.NOTIFICATION_SERVICE);
    6
    7 Intent mIntent = new Intent();
    8 mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    9 PendingIntent mContentIntent =PendingIntent.getActivity(mContext,0, mIntent, 0);  
            //这里必需要用setLatestEventInfo(上下文,标题,内容,PendingIntent)不然会报错.10           
            notification.setLatestEventInfo(mContext, "10086", "holle, merci.", mContentIntent); 11 
    12
    13 notificationManager.notify(0, notification);









      

  • 相关阅读:
    2020软件工程作业04
    2020软件工程作业02
    第一周作业
    2019春总结作业
    12周作业
    第十一周作业
    第十周阅读
    第9周编程总结
    编程总结模版
    第8周编程总结
  • 原文地址:https://www.cnblogs.com/wanqieddy/p/2134941.html
Copyright © 2011-2022 走看看