android 8.0 Notification

阅读更多
private void updateSuccessNotification(boolean isPass){
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
            String id = "update_success";
            String name = "update_success_notification";
            NotificationManager notificationManager = (NotificationManager) mSystemContext.getSystem
Service(NOTIFICATION_SERVICE);
            Notification notification = null;
            NotificationChannel mChannel = null;
            mChannel = new NotificationChannel(id, name, NotificationManager.IMPORTANCE_LOW);
            notificationManager.createNotificationChannel(mChannel);
            if(isPass) {
                notification = new Notification.Builder(mSystemContext)
                        .setChannelId(id)
                        .setContentTitle(mSystemContext.getString(R.string.global_update_success))
                        .setContentText(mSystemContext.getString(R.string.global_current_version)+Bu
ild.VERSION.INCREMENTAL)
                        .setSmallIcon(R.drawable.btn_default).build();
                notificationManager.notify(111123, notification);
            }else{	
                notificationManager.createNotificationChannel(mChannel);
                notification = new Notification.Builder(mSystemContext)
                        .setChannelId(id)
                        .setContentTitle(mSystemContext.getString(R.string.global_update_fail))
                        .setContentText(mSystemContext.getString(R.string.global_current_version)+Bu
ild.VERSION.INCREMENTAL)
                        .setSmallIcon(R.drawable.btn_default).build();
                notificationManager.notify(111123, notification);
            }	
			        }	
    }

 

你可能感兴趣的:(andrid,notification)