List of usage examples for android.media AudioAttributes CONTENT_TYPE_SPEECH
int CONTENT_TYPE_SPEECH
To view the source code for android.media AudioAttributes CONTENT_TYPE_SPEECH.
Click Source Link
From source file:com.sxt.chat.utils.NotificationHelper.java
/** * ?/*from w ww . j a v a 2s . com*/ * <p> * note : notify() ? ???,?? so, Create? */ public NotificationHelper(Context ctx) { super(ctx); context = ctx; soundUri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.notify_message); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { AudioAttributes att = new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_NOTIFICATION) .setContentType(AudioAttributes.CONTENT_TYPE_SPEECH).build(); NotificationChannel channel = new NotificationChannel(DEFAULT_CHANNEL, "Channel", NotificationManager.IMPORTANCE_HIGH); channel.setSound(soundUri, att); channel.setLightColor(Color.YELLOW); channel.setShowBadge(true); channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC); getManager().createNotificationChannel(channel); NotificationChannel chanCustom = new NotificationChannel(CUSTOM_NOTIFY_CHANNEL, "Custom Layout Channel", NotificationManager.IMPORTANCE_HIGH); channel.setSound(soundUri, att); chanCustom.setLightColor(Color.RED); chanCustom.setShowBadge(true); chanCustom.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC); getManager().createNotificationChannel(chanCustom); } }