Sub Activity_Create(FirstTime As Boolean)
SendMediaButton(127) 'KEYCODE_MEDIA_PAUSE, 126 = KEYCODE_MEDIA_PLAY
End Sub
Sub SendMediaButton (Keycode As Int)
Dim keyEvent As JavaObject
keyEvent.InitializeNewInstance("android.view.KeyEvent", Array(0, Keycode)) 'ACTION_DOWN
Dim in As Intent
in.Initialize("android.intent.action.MEDIA_BUTTON", "")
in.PutExtra("android.intent.extra.KEY_EVENT", keyEvent)
Dim p As Phone
p.SendBroadcastIntent(in)
keyEvent.InitializeNewInstance("android.view.KeyEvent", Array(1, Keycode)) 'ACTION_UP
in.Initialize("android.intent.action.MEDIA_BUTTON", "")
in.PutExtra("android.intent.extra.KEY_EVENT", keyEvent)
p.SendBroadcastIntent(in)
End Sub