我使用Notification.Builder来构建通知.现在我想使用默认声音通知:
builder.setSound(Uri sound)
Run Code Online (Sandbox Code Playgroud)
但是Uri在默认通知中的位置是什么?
使用Firebase云消息传递在后台接收通知时是否可以使Android设备振动?从语法参考我已经看到并测试过支持声音,但没有关于振动的信息.或者是否有可能为此通知提供自定义实现,我将直接设置振动?
我创建通知通道,以在Android 8.0中显示通知,如下所示
NotificationChannel uploadChannel = new NotificationChannel(Constants.NOTIFICATION_CHANNEL_UPLOAD_ID,"Uploads", NotificationManager.IMPORTANCE_LOW);
uploadChannel.enableLights(false);
uploadChannel.setDescription("Uploads Channel");
notificationManager.createNotificationChannel(uploadChannel);
Run Code Online (Sandbox Code Playgroud)
每当我显示通知手机振动很多次.我从通知通道禁用振动,如下所示
uploadChannel.enableVibration(false);
Run Code Online (Sandbox Code Playgroud)
我创建如下通知
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context, Constants.NOTIFICATION_CHANNEL_UPLOAD_ID);
Run Code Online (Sandbox Code Playgroud)
但它不工作电话随着每个通知振动.