Constants.channelId = "JPush";//这个是接入默认的极光推送之后(不是自定义的),通过pc端推送,在android端打印获取到的极光推送的channelId 。打印方法如下。 NotificationManager notificationManager = (NotificationManager) context.getSystemService( Context.NOTIFICATION_SERVICE); for (int i = 0; i < notificationManager.getNotificationChannels().size(); i++) { Logs.e(notificationManager.getNotificationChannels().get(i).getId()); } /** * 检查有没有开启通知权限 */ public static boolean checkNotifaction(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { //通过这个判断相应类别的权限是否打开 NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); //初次创建,解决安装App之后第一次进入通知权限页无类别选择 NotificationChannel channelfirst = new NotificationChannel(Constants.channelId, context.getString(R.string.app_name) + "通知", NotificationManager.IMPORTANCE_HIGH); manager.c
android8.0极光推送通知权限检测和修改通知名字
最新推荐文章于 2024-06-18 10:09:47 发布
本文介绍了如何在Android 8.0系统中检测应用程序的通知权限状态,并详细说明了当检测到未开启通知权限时,如何引导用户跳转至通知管理页面进行设置,以确保应用能够正确接收和显示推送通知。
摘要由CSDN通过智能技术生成