
android 通知( notification.sound)声音为什么一直不停的叫?如何只叫两次?
builder.setContentTitle("新任务"+mNotificationNum);//设置通知标题builder.setContentText("不要放孔明...
builder.setContentTitle("新任务"+mNotificationNum);//设置通知标题
builder.setContentText("不要放孔明灯,容易起火"+mNotificationNum);//设置通知内容
// builder.setDefaults(NotificationCompat.DEFAULT_ALL);//设置通知的方式,震动、LED灯、音乐等
//实例化通知管理器
NotificationManager notificationManager= (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
//实例化通知
NotificationCompat.Builder builder=new NotificationCompat.Builder(this);
builder.setAutoCancel(true);//点击通知后,状态栏自动删除通知
builder.setSmallIcon(android.R.drawable.ic_media_play);//设置小图标
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
vibrator.vibrate(new long[] {0,1000,500,2000}, -1);//实现效果:延迟0ms,然后振动1000ms,在延迟500ms,接着在振动2000ms。-1表示不重复, 如果不是-1, 比如改成1,
builder.setDefaults(Notification.DEFAULT_SOUND);//获取默认铃声
// builder.setSound(Uri.parse( "android.resource://" + getPackageName() + "/" + R.raw.notificationsound ));//获取自定义铃声
// builder.setSound( RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
// builder.setSound(Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "0"));//获取Android多媒体库内的铃声
builder.setPriority(Notifi.PRIcationORITY_MAX);
builder.setContentIntent(PendingIntent.getActivity(this,mNotificationNum,new Intent(this,MainActivity.class),PendingIntent.FLAG_CANCEL_CURRENT));//设置点击通知后将要启动的程序组件对应的PendingIntent
Notification notification=builder.build();
notification.flags = Notification.DEFAULT_LIGHTS;// 添加默认三色灯提醒
//发送通知
notificationManager.notify(mNotificationNum,notification); 展开
builder.setContentText("不要放孔明灯,容易起火"+mNotificationNum);//设置通知内容
// builder.setDefaults(NotificationCompat.DEFAULT_ALL);//设置通知的方式,震动、LED灯、音乐等
//实例化通知管理器
NotificationManager notificationManager= (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
//实例化通知
NotificationCompat.Builder builder=new NotificationCompat.Builder(this);
builder.setAutoCancel(true);//点击通知后,状态栏自动删除通知
builder.setSmallIcon(android.R.drawable.ic_media_play);//设置小图标
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
vibrator.vibrate(new long[] {0,1000,500,2000}, -1);//实现效果:延迟0ms,然后振动1000ms,在延迟500ms,接着在振动2000ms。-1表示不重复, 如果不是-1, 比如改成1,
builder.setDefaults(Notification.DEFAULT_SOUND);//获取默认铃声
// builder.setSound(Uri.parse( "android.resource://" + getPackageName() + "/" + R.raw.notificationsound ));//获取自定义铃声
// builder.setSound( RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
// builder.setSound(Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "0"));//获取Android多媒体库内的铃声
builder.setPriority(Notifi.PRIcationORITY_MAX);
builder.setContentIntent(PendingIntent.getActivity(this,mNotificationNum,new Intent(this,MainActivity.class),PendingIntent.FLAG_CANCEL_CURRENT));//设置点击通知后将要启动的程序组件对应的PendingIntent
Notification notification=builder.build();
notification.flags = Notification.DEFAULT_LIGHTS;// 添加默认三色灯提醒
//发送通知
notificationManager.notify(mNotificationNum,notification); 展开
3个回答

2024-11-20 广告
作为深圳市容大彩晶科技有限公司的工作人员,对于公司广告机的功能有一定的了解。公司的广告机是否支持多语言显示,具体需根据产品型号和功能配置来确定。但一般而言,现代广告机通常具备多语言显示的功能,以适应不同国家和地区的需求。建议直接查阅产品说明...
点击进入详情页
本回答由深圳市容大彩晶科技有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |