zoukankan      html  css  js  c++  java
  • 37、pendingIntent 点击通知栏进入页面

     转载:

    http://blog.csdn.net/yuzhiboyi/article/details/8484771

    https://my.oschina.net/youranhongcha/blog/196933

     1 new Thread() {
     2 
     3             @Override
     4             public void run() {
     5                 // TODO Auto-generated method stub
     6                 super.run();
     7                 NotificationManager manager = (NotificationManager) 
    getSystemService(
    NOTIFICATION_SERVICE); 9 Notification notification = new Notification(); 10 // 不会被清除 11 notification.flags = Notification.FLAG_NO_CLEAR; 12 notification.icon = R.drawable.main_icon_notification; 13 notification.tickerText = "XXX正在保护您的手机"; 14 // 远程的view 我们的view对象 是要显示在另外一个进程里面 另外一个程序里面 所以就需要一个remote view 15 RemoteViews rv = new RemoteViews(getPackageName(), 16 R.layout.monitor_app); 17 rv.setTextViewText(R.id.textView1, "XXX正在保护您的手机"); 18 rv.setProgressBar(R.id.progressBar1, 100, 0, false); 19 notification.contentView = rv; 20 Intent intent = new Intent(MonitorService.this, 21 SplashActivity.class); 22 PendingIntent pendingIntent = PendingIntent.getActivity( 23 MonitorService.this, 0, intent, 24 Intent.FLAG_ACTIVITY_NEW_TASK); 25 notification.contentIntent = pendingIntent; 26 27 manager.notify(2, notification); 28 } 29 30 }.start();
  • 相关阅读:
    跨域 CORS 详解 (转)
    手机自动化(一)
    Appium Desktop-Permission to start activity denied.
    webview元素定位
    电商网站测试点 还需要整理
    性能测试第三天
    性能测试第二天
    DDD
    ATDD
    BDD
  • 原文地址:https://www.cnblogs.com/androidsj/p/3996512.html
Copyright © 2011-2022 走看看