如何把通知声音之间的间隔,当我收到通知然后,我必须在环之间放0.5秒的间隙, 这里1代表环(.mp3格式)和 .5代表差距。 1 + 0.5 + 1 + 0.5 + 1 = 4秒
代码:我正在使用FCM,在收到的消息中我有以下代码,我的coins.mp3,哔哔1秒钟,我想要发出3次哔声,间隔为0.5秒,每次发出哔哔声
Uri defaultSoundUri= Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.coins);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.splash_logo)
.setContentTitle("Logizo")
.setContentText("Order Status Changed to "+messageBody)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationBuilder.getNotification().flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(NOTIFICATION_ID/* ID of notification */, notificationBuilder.build());
try {
foreground = new ForegroundCheckTask().execute(this).get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
MainActivity.removeNotificationsFromStatusBar(NOTIFICATION_ID,this,foreground);