小编han*_*ama的帖子

如何使用特定声音制作推送通知?

我正在开发带有通知系统的 android 应用程序,我需要 android 设备使用我存储在资产文件夹中的特定声音推送通知,这是我的通知 java 代码:

Notification noti = new Notification.Builder(MainActivity.this)
    .setTicker("Calcupital")
    .setContentTitle("Calcupital")
    .setContentText("User Information has been updated successfully")
    .setSmallIcon(R.drawable.login)
    .setContentIntent(pIntent).getNotification();

noti.flags = Notification.FLAG_AUTO_CANCEL;

NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0, noti);
Run Code Online (Sandbox Code Playgroud)

假设我的声音是这样存储的:(\assets\hopo.mp3)

如何通过更改 Android 设备提供的列表中的声音,在不更改其他应用程序的推送通知系统的情况下,使用此声音推送此通知!!

我希望我的问题对你来说很清楚:)

audio notifications android

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

android ×1

audio ×1

notifications ×1