通知

作者: 嗣音_96bc | 来源:发表于2019-03-14 20:02 被阅读0次

    ```

    NotificationManager mManager = (NotificationManager) getSystemService(this.NOTIFICATION_SERVICE);

    String id ="ss";

    String name ="aa";

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

    NotificationChannel channel =new NotificationChannel(id, name, NotificationManager.IMPORTANCE_DEFAULT);

    mManager.createNotificationChannel(channel);

    }

    Intent intent1 =new Intent();

    PendingIntent intent = PendingIntent.getActivity(this,1,intent1,PendingIntent.FLAG_UPDATE_CURRENT);

    Notification build =new NotificationCompat.Builder(this,id)

    .setSmallIcon(R.mipmap.ic_launcher)

    .setContentTitle("界面")

    .setContentText("000")

    .setAutoCancel(true)

    .setContentIntent(intent)

    .build();

    mManager.notify(100,build);

    ```

    相关文章

      网友评论

          本文标题:通知

          本文链接:https://www.haomeiwen.com/subject/elzrmqtx.html