安卓,通知声音虽然应用程序在Android中最小化?

时间:2016-10-12 11:56:57

标签: android android-notifications

PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,
            PendingIntent.FLAG_UPDATE_CURRENT);

Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.mipmap.ic_medico_launcher)
            .setContentTitle(title)
            .setContentText(msgBody)
            .setAutoCancel(true)
            .setGroup(group)
            .setStyle(new NotificationCompat.BigTextStyle().bigText(msgBody))
            .setSound(defaultSoundUri)
            .setContentIntent(pendingIntent);

NotificationManager notificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

notificationManager.notify(notificationId++, notificationBuilder.build());

0 个答案:

没有答案