从昨天起我在Android 4.2上遇到问题,当我收到推送通知时,即使我没有将其设置为振动,也需要获得许可
Notification notification = new Notification(icon, notificationItem.message, when);
notification.setLatestEventInfo(context, "App", notificationItem.message,
PendingIntent.getActivity(context, 0, intent, 0));
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.defaults |= Notification.DEFAULT_SOUND;
NotificationManager nm =
(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(notificationItem.notificationID, notification);
Run Code Online (Sandbox Code Playgroud)
nm.notify引发了异常
我在两个不同的应用程序中遇到此问题,我从不修改代码