Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

feat(android): Added playback with the schema "SCHEME_CONTENT" on Android #2790

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/android/com/adobe/phonegap/push/FCMService.java
Original file line number Diff line number Diff line change
Expand Up @@ -735,11 +735,15 @@ private void setNotificationSound(Context context, Bundle extras, NotificationCo
}
if (SOUND_RINGTONE.equals(soundname)) {
mBuilder.setSound(android.provider.Settings.System.DEFAULT_RINGTONE_URI);
} else if (soundname != null && !soundname.contentEquals(SOUND_DEFAULT)) {
} else if (soundname != null && !soundname.contentEquals(SOUND_DEFAULT) && !soundname.contains(ContentResolver.SCHEME_CONTENT + ":")) {
Uri sound = Uri
.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + context.getPackageName() + "/raw/" + soundname);
Log.d(LOG_TAG, sound.toString());
mBuilder.setSound(sound);
} else if (soundname.contains(ContentResolver.SCHEME_CONTENT + ":")){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soundname can be null in this case, risk of NPE, needs refactor I think.

Uri sound = Uri.parse(soundname);
Log.d(LOG_TAG, sound.toString());
mBuilder.setSound(sound);
} else {
mBuilder.setSound(android.provider.Settings.System.DEFAULT_NOTIFICATION_URI);
}
Expand Down