mbest 0 Posted July 14, 2023 I have been using Delphi for a while and decided to take the plunge with Android, specifically BlueTooth. I have an issue and I think it's permissions and linked to BLUETOOTH_SCAN. I have tried several "fixes" out there but, to be brutally honest, I'm not yet familiar with the environment to the point that a) I know what the issue is and b) if it's a case of Android 12 isn't supported (it wasn't 12 months ago)? Any pointers on how to progress (I don't want to throw the towel in yet) would be very welcome. This is the project I am trying to follow https://subscription.packtpub.com/book/programming/9781800203822/14/ch14lvl1sec99/starting-with-bluetooth-classic and it fails as soon as I enable Bluetooth. I am going to borrow an older Android device next week to see if the problem is the changes in security/permissions. Thanks, mb Share this post Link to post
Brian Evans 109 Posted July 15, 2023 Without the error(s) and what you tried it is hard to answer. Would suggest reviewing : Bluetooth permissions | Android Developers to start since you mention permissions issues. Share this post Link to post
mbest 0 Posted July 17, 2023 Hi Thanks for that Brian, the error is black screen if I try and make Bluetooth active on form create and the app loads if I don't :) I have done some more reading over the weekend and will start again basing my approach on one of the sample apps supplied. If it works I will get there in the end. I was expecting "it's a known issue" or similar as I have yet to find a working bluetooth example for Android. All the best, mb Share this post Link to post
mbest 0 Posted July 20, 2023 I have taken another go at this using the demo app C:\Users\Public\Documents\Embarcadero\Studio\22.0\Samples\Object Pascal\Multi-Device Samples\Device Sensors and Services\Bluetooth\Classic Bluetooth Basic app With 11.3 and Android 13 the error is "java.lang.SecurityException: Need android.permission.BLUETOOTH_SCAN permission for android.content.AttributionSource@69f00117: AdapterService isDiscovering." I get that, BT is now on the dangerous list but I can not find a way of fixing it. All the best, mb Share this post Link to post
Dave Nottage 563 Posted July 20, 2023 5 hours ago, mbest said: I get that, BT is now on the dangerous list but I can not find a way of fixing it. Take a look at the ScanFilterServicesAdvData demo in the same folder, specifically TForm6.Button1Click in Unit6.pas. It shows how to request permissions, including the one you need. 1 Share this post Link to post
mbest 0 Posted July 21, 2023 Many thanks for that Dave, I will do that. All the best, mb Share this post Link to post