Android Question Pause Spotify

TheSketchees

Member
Licensed User
Longtime User
I have tried using SendInput(V0.2) and using MediaController(V1.00)

B4X:
Sub YelOn()
Si.SendKeyCode(KeyCodes.KEYCODE_MEDIA_PLAY_PAUSE)
'YelEnt.Play
Timer3.Enabled = True
End Sub

This is one of my subs. I cant understand why it isnt working.

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim Timer2 As Timer
    Dim Si As SendInput
    Dim sNotif As Notification
    Dim Timer3 As Timer
    'Media Players
    Dim GreEnt As MediaPlayer
    Dim GreLea As MediaPlayer
    Dim OraEnt As MediaPlayer
    Dim OraLea As MediaPlayer
    Dim PurEnt As MediaPlayer
    Dim PurLea As MediaPlayer
    Dim RedEnt As MediaPlayer
    Dim RedLea As MediaPlayer
    Dim YelEnt As MediaPlayer
    Dim YelLea As MediaPlayer
   
End Sub

I have dimmed it in my process globals.
 

TheSketchees

Member
Licensed User
Longtime User
I just found out that it only works when i have the app open. Is there anyway to change this. I have got the service running in foreground but only when the activity is open it works :/

Basically what i want to do is pause/unpause while the phone is locked or off the app. The service won't let me :/
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…