Я настраиваю звук динамического уведомления и хочу установить его из файла расширения в Android. так возможно ли это ?, если да, то как мне установить или получить доступ к файлу расширения (.wav) для кода (построитель уведомлений), пожалуйста, поделитесь кодом для того же
Моя попытка:
Код FCM:
val AUTHORITY = "com.example.provider.SampleZipFileProvider"
val CONTENT_URI = Uri.parse("content://$AUTHORITY")
val defaultSoundUri = Uri.parse("$CONTENT_URI/${appNotification.sound_name}")
val notificationBuilder = NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.icon)
.setContentTitle(getString(R.string.app_name))
.setStyle(NotificationCompat.BigTextStyle().bigText(appNotification.message))
.setWhen(0)
.setChannelId(Constants.NOTIFICATION_CHNANEL_ID)
.setContentText(appNotification.message.decodeUnicode())
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent)
SampleZipFileProvider.class
public class SampleZipFileProvider extends APEZProvider {
// main content provider URI
private static final String CONTENT_PREFIX = "content://";
// must match what is declared in the Zip content provider in
// the AndroidManifest.xml file
private static final String AUTHORITY = "com.example";
public static final Uri ASSET_URI = Uri.parse(CONTENT_PREFIX + AUTHORITY);
public String getAuthority() {
return AUTHORITY;
}
}
Манифест:
<provider android:name=".zipfile.SampleZipFileProvider"
android:authorities="com.example"
android:exported="false"
android:grantUriPermissions="true"
android:multiprocess="true">
<meta-data android:name="mainVersion"
android:value="1"/>
</provider>