private void showNotification2(Context context, int iid, String title, String text) {    String id = "my_channel_01";    String name = "我是渠道名字";    NotificationManager notificationManager = (NotificationManager) MyApplication.mContext.getSystemService(NOTIFICATION_SERVICE);    Notification notification = null;    Toast.makeText(this, "qweqweqwewqewq", Toast.LENGTH_SHORT).show();    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {        NotificationChannel mChannel = new NotificationChannel(id, name, NotificationManager.IMPORTANCE_LOW);        Log.i("log", mChannel.toString());        notificationManager.createNotificationChannel(mChannel);        notification = new Notification.Builder(this)                .setChannelId(id)                .setContentTitle("5 new messages")                .setContentText("hahaha")                .setSmallIcon(R.mipmap.ic_launcher).build();    } else {        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(MyApplication.mContext)                .setContentTitle("5 new messages")                .setContentText("hahaha")                .setSmallIcon(R.mipmap.ic_launcher)                .setOngoing(true)                .setChannel(id);//无效        notification = notificationBuilder.build();    }    notificationManager.notify(iid, notification);}

更多相关文章

  1. Android通过图片名字获得ID
  2. Android 多版本多渠道打包
  3. App应用之提交到各大市场渠道
  4. Android Studio 友盟多渠道打包
  5. android stadio多渠道打包(一分钟搞定)
  6. android studio 0.80多渠道打包
  7. Android应用程序中应用图标和名字的设置
  8. Android的多渠道打包|SquirrelNote
  9. Android Studio Gradle多渠道打包(动态设定App名称,应用图标,背景

随机推荐

  1. 前端PDF文件转图片方法
  2. File、Blob、dataURL 和 canvas 的应用与
  3. 思索 p5.js 的最佳实践
  4. 移动端适配的实现
  5. 组织和管理CSS
  6. js事件,线程,定时器
  7. js数值进制
  8. #makedown第二节 个人笔记
  9. TS vs JS基础类型
  10. TS 变量声明