Hi,
We are having an issue with playing a media file in Rhomobile 4.0 using the notification API call. The wav file exist in our project in a folder called /public/alerts, during the build process it's copied to bin folder and added to the apk.
This is our API call:
Rho::Notification.playFile('/public/alerts/Notify.wav',".wav")
In the rholog from the client we are getting the following:
RhoFileApi| Can not open file descriptor: /public/alerts/Notify.wav: open failed: ENOENT (No such file or directory)
NotificationSingleton| null
java.lang.IllegalArgumentException
at android.media.MediaPlayer.setDataSource(Native Method)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1186)
at com.motorolasolutions.rho.notification.NotificationSingleton.playFile(NotificationSingleton.java:126)
at com.rho.notification.NotificationSingletonBase$playFileTask.run(NotificationSingletonBase.java:93)
at com.rhomobile.rhodes.api.MethodExecutor.run(MethodExecutor.java:11)
at dalvik.system.NativeStart.run(Native Method)
Any ideas why this would not be working?
2 Replies
Hi,
Even though I use the below method, I am getting the below error in android. I am suing 5.0.38 Rhodes.
Code:
playfile = "iphonenotification.mp3"
filepath = Rho::RhoFile.join(Rho::RhoApplication.publicFolder, "alerts/#{playfile}")
if Rho::RhoFile.exists(filepath)
Rho::Notification.playFile(filepath)
end
Error:
2-31 16:04:32.092 13402 13441 I APP : E 12/31/2015 16:04:32:092 00003481 RhoFileApi| Can not open file descriptor: /data/user/0/com.jci.jcinxgenrhoevalutiondev/rhodata/apps/public/alerts/iphonenotification.mp3: open failed: ENOENT (No such file or directory)
12-31 16:04:32.136 13402 13441 I APP : E 12/31/2015 16:04:32:136 00003481 NotificationSingleton| null
I tried to access the directly in adb shell in root. But, after rhodata/apps, I do not see any other directory except rhoconfig.txt file.
Any pointers will be greatly appreciated.
Hi,
Can you try below code,
Rho::Notification.playFile(Rho::RhoFile.join(Rho::Application.publicFolder, 'alerts/Notify.wav'), '.wav')
I think problem with the path you have passed.
Regards
Vinod Shankar