M ManuelFG Member Licensed User Longtime User Apr 29, 2012 #1 I have created a multimedia application for play/pause/FW/ music and I control it by captured bluetooth buttons. It work very well but... The problem is that bluetooth simultaneously activates both multimedia, which is installed in Android "Music" and my own application. How I can give preference to my application or how I can disable the program "Music" for the bluetooth commands which incorporates Adroid? Thank
I have created a multimedia application for play/pause/FW/ music and I control it by captured bluetooth buttons. It work very well but... The problem is that bluetooth simultaneously activates both multimedia, which is installed in Android "Music" and my own application. How I can give preference to my application or how I can disable the program "Music" for the bluetooth commands which incorporates Adroid? Thank
Erel B4X founder Staff member Licensed User Longtime User Apr 30, 2012 #2 How are you capturing the buttons? Upvote 0
M ManuelFG Member Licensed User Longtime User Apr 30, 2012 #3 This is the way that I get the bluetooth button commands. Please, can you tell me how I can give 1º priority to my applicatión? Or disable the bluetooth events for a specifc application like Android "Music"? Thank. - - - - - - - - - - - - - - - Sub Activity_KeyPress (KeyCode As Int) As Boolean Select KeyCode Case 87 'Forwared Case 88 'Back Case 85 'Play Case 86 'Pause Case 24 '+ Volumen Button Device Case 25 '- Volumen Button Device Case Else End Select Upvote 0
This is the way that I get the bluetooth button commands. Please, can you tell me how I can give 1º priority to my applicatión? Or disable the bluetooth events for a specifc application like Android "Music"? Thank. - - - - - - - - - - - - - - - Sub Activity_KeyPress (KeyCode As Int) As Boolean Select KeyCode Case 87 'Forwared Case 88 'Back Case 85 'Play Case 86 'Pause Case 24 '+ Volumen Button Device Case 25 '- Volumen Button Device Case Else End Select
Erel B4X founder Staff member Licensed User Longtime User Apr 30, 2012 #4 Not sure that it is possible. There was an example which I previously wrote for handling the "Call" bluetooth button. However I don't find it right now and it is not really related. Upvote 0
Not sure that it is possible. There was an example which I previously wrote for handling the "Call" bluetooth button. However I don't find it right now and it is not really related.
M ManuelFG Member Licensed User Longtime User Apr 30, 2012 #5 "media-button-router" Hi Erel I attach a link where is solved this problem, it is "media-button-router" In this link you can see the full code program. / - media-button-router - Nicer Android media button handling by allowing the user to choose the receiver. - Google Project Hosting Please, can you tell me how adapt to B4A or help me with this functionality? It is very important for my next B4A aplication Thank :sign0085: Upvote 0
"media-button-router" Hi Erel I attach a link where is solved this problem, it is "media-button-router" In this link you can see the full code program. / - media-button-router - Nicer Android media button handling by allowing the user to choose the receiver. - Google Project Hosting Please, can you tell me how adapt to B4A or help me with this functionality? It is very important for my next B4A aplication Thank :sign0085:
Erel B4X founder Staff member Licensed User Longtime User May 1, 2012 #6 You should create a service. In the manifest editor you should add: Code: Copy AddReceiverText(serviceName, <intent-filter android:priority="2147483647"> <action android:name="android.intent.action.MEDIA_BUTTON"/> </intent-filter> ) Service_Start will be called each time that a media button will be pressed. The button value should be mapped to an extra with the key: android.intent.extra.KEY_EVENT Upvote 0
You should create a service. In the manifest editor you should add: Code: Copy AddReceiverText(serviceName, <intent-filter android:priority="2147483647"> <action android:name="android.intent.action.MEDIA_BUTTON"/> </intent-filter> ) Service_Start will be called each time that a media button will be pressed. The button value should be mapped to an extra with the key: android.intent.extra.KEY_EVENT
M ManuelFG Member Licensed User Longtime User May 3, 2012 #7 Example Hello Erel Thank for your information but I do not understand very well how do.(I am a B4A novice) Please, can you give a little more information or a small example for this. Thank! Upvote 0
Example Hello Erel Thank for your information but I do not understand very well how do.(I am a B4A novice) Please, can you give a little more information or a small example for this. Thank!
Erel B4X founder Staff member Licensed User Longtime User May 4, 2012 #8 You should add a service and then add the code I posted to the manifest editor (don't forget to change serviceName to the name of the service you added). When you press on the Bluetooth button, Service_Start will be called. You should play with the Intent passed. Upvote 0
You should add a service and then add the code I posted to the manifest editor (don't forget to change serviceName to the name of the service you added). When you press on the Bluetooth button, Service_Start will be called. You should play with the Intent passed.
M ManuelFG Member Licensed User Longtime User May 7, 2012 #9 Erel, you said: "Service_Start will be called each time that a media button will be pressed." "The button value should be mapped to an extra with the key: android.intent.extra.KEY_EVENT" Please, can you give me a example how mapped an extra key: android.intent.extra.KEY_EVENT? Thank, Manuel Upvote 0
Erel, you said: "Service_Start will be called each time that a media button will be pressed." "The button value should be mapped to an extra with the key: android.intent.extra.KEY_EVENT" Please, can you give me a example how mapped an extra key: android.intent.extra.KEY_EVENT? Thank, Manuel
Erel B4X founder Staff member Licensed User Longtime User May 8, 2012 #10 In Service_Start you should get the value from StartingIntent parameter. Code: Copy StartingIntent.GetExtra("android.intent.extra.KEY_EVENT") Upvote 0
In Service_Start you should get the value from StartingIntent parameter. Code: Copy StartingIntent.GetExtra("android.intent.extra.KEY_EVENT")