How to Make ring and vibrate?

jeronimovilar2

Member
Licensed User
Longtime User
vibrate is working fine:
Dim Vibrate As PhoneVibrate ' For phone vibration
Vibrate.Vibrate (50) ' Vibrate phone for 50 ms

I need the vibrate and RING a alarm, bell or ringtone with the vibration. How can i do?

mp.play(alarm)??
 

jeronimovilar2

Member
Licensed User
Longtime User
Nothing

HI,
the vibrate is ok, but i want a bell too. i´m trying with a mp3 file
Code:
Vibrate.Vibrate (50) ' Vibrate phone for 50 ms - it´s OK
mp.Load(File.DirAssets, "Bbell.mp3") ' Bbell is my ringtone
mp.Play

error:
java.io.FileNotFoundException: bbell.mp3
at android.content.res.AssetManager.openAssetFd(Native Method)
at android.content.res.AssetManager.openFd(AssetManager.java:330)
at anywheresoftware.b4a.objects.MediaPlayerWrapper.Load(MediaPlayerWrapper.java:61)
at teste.teclado.main._btncamisa1_click(main.java:355)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:158)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:154)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:54)
at android.view.View.performClick(View.java:2485)
at android.view.View$PerformClick.run(View.java:9080)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
java.io.FileNotFoundException: bbell.mp3
 
Upvote 0

Djembefola

Active Member
Licensed User
Longtime User
As far as i know it's not possible to use the mediaplayer .load method with a file from file.dirassets.

Copy the file from file.dirAssets to file.DirDefaultExternal before you play it with mediaplayer.
 
Upvote 0

jeronimovilar2

Member
Licensed User
Longtime User
nothing again

Dim som As String
som = "bbell.mp3"
If File.exists(File.DirDefaultExternal,som)=False Then
File.Copy (File.dirassets, som,File.DirDefaultExternal, som)
End If
mp.Stop
mp.Load(File.DirDefaultExternal,som)
mp.Play

error same


sorry my english
 
Upvote 0
Top