R raye New Member Licensed User Longtime User Jul 14, 2013 #1 Hi All im a newbie here. I am trying to get to grips with B4A and i am using some code from the following thread.................. http://www.b4x.com/forum/basic4andr...oid-bluetooth-bluetoothadmin-tutorial-11.html This is the code in question............... Sub btnAllowConnection_Click 'this intent makes the device discoverable for 300 seconds. Dim i As Intent i.Initialize("android.bluetooth.adapter.action.REQUEST_DISCOVERABLE", "") i.PutExtra("android.bluetooth.adapter.extra.DISCOVERABLE_DURATION", 300) StartActivity(i) serial1.Listen End Sub What i would like to happen is when the "allow connection" button is pressed then NO pop up screen (bluetooth permission request) appears asking the user to make the phone discoverable. Insead the phone becomes discoverable for x seconds WITHOUT user intervention. Any help would be great. Cheers Ray
Hi All im a newbie here. I am trying to get to grips with B4A and i am using some code from the following thread.................. http://www.b4x.com/forum/basic4andr...oid-bluetooth-bluetoothadmin-tutorial-11.html This is the code in question............... Sub btnAllowConnection_Click 'this intent makes the device discoverable for 300 seconds. Dim i As Intent i.Initialize("android.bluetooth.adapter.action.REQUEST_DISCOVERABLE", "") i.PutExtra("android.bluetooth.adapter.extra.DISCOVERABLE_DURATION", 300) StartActivity(i) serial1.Listen End Sub What i would like to happen is when the "allow connection" button is pressed then NO pop up screen (bluetooth permission request) appears asking the user to make the phone discoverable. Insead the phone becomes discoverable for x seconds WITHOUT user intervention. Any help would be great. Cheers Ray
R raye New Member Licensed User Longtime User Jul 15, 2013 #2 OK after a bit of searching around it would seem that there is no way to avoid the "bluetooth permission request" pop up message that appears when you do the following. Code: Copy Dim i As Intent i.Initialize("android.bluetooth.adapter.action.REQUEST_DISCOVERABLE", "") i.PutExtra("android.bluetooth.adapter.extra.", 0) StartActivity(i) serial1.Listen Seems a bit strange but im guessing it has something to do with bluetooth security...............or is there some work around? HELP! I did learn that putting a 0 in DISCOVERABLE_DURATION keeps the app in an "always discoverable" state. Ray Upvote 0
OK after a bit of searching around it would seem that there is no way to avoid the "bluetooth permission request" pop up message that appears when you do the following. Code: Copy Dim i As Intent i.Initialize("android.bluetooth.adapter.action.REQUEST_DISCOVERABLE", "") i.PutExtra("android.bluetooth.adapter.extra.", 0) StartActivity(i) serial1.Listen Seems a bit strange but im guessing it has something to do with bluetooth security...............or is there some work around? HELP! I did learn that putting a 0 in DISCOVERABLE_DURATION keeps the app in an "always discoverable" state. Ray
R raye New Member Licensed User Longtime User Jul 15, 2013 #3 OOPS...........typo on the last post :0 Code: Copy Dim i As Intent i.Initialize("android.bluetooth.adapter.action.REQUEST_DISCOVERABLE", "") i.PutExtra("android.bluetooth.adapter.extra.DISCOVERABLE_DURATION", 0) Upvote 0
OOPS...........typo on the last post :0 Code: Copy Dim i As Intent i.Initialize("android.bluetooth.adapter.action.REQUEST_DISCOVERABLE", "") i.PutExtra("android.bluetooth.adapter.extra.DISCOVERABLE_DURATION", 0)
Erel B4X founder Staff member Licensed User Longtime User Jul 15, 2013 #4 Seems a bit strange but im guessing it has something to do with bluetooth security Click to expand... This is a security feature of Android. You cannot remove it. Upvote 0
Seems a bit strange but im guessing it has something to do with bluetooth security Click to expand... This is a security feature of Android. You cannot remove it.