I am getting notification from GCM
in onMessage() method as intent extraData in json
string given below:-
"data": { "message":"Welcome Message","sound_file":"sound1.mp3"}
And I have same file name sound1.mp3
in my res/raw/sound1.mp3
which i need to assign in Notification.Sound
. So is there any mechanism by which I can convert String
to ResourceId
or access the ResourceId
through Uri
to assign in Notification.Sound
.
I want to do this because there will be multiple files and any random sound_file
name can come in notification message.
Note:- I can use
if else
to checksound_file
with my files stored inraw
folder that i have already implemented. But i just want to know is that can be done what i have asked???