Cordova-Plugin-BTPrinter icon indicating copy to clipboard operation
Cordova-Plugin-BTPrinter copied to clipboard

target version 32 needs permission

Open Tushar-Kanvinde opened this issue 2 years ago • 11 comments

Android 11.0.0 Cordova 11.0.0 plugin 0.1.0-dev

I had to add

to AndroidManifest.xml

And also request permission for BLUETOOTH_SCAN and BLUETOOTH_CONNECT

Tushar-Kanvinde avatar Nov 25 '22 05:11 Tushar-Kanvinde

The tag hid what i added. Putting them here. uses-permission android:name="android.permission.BLUETOOTH_SCAN" uses-permission android:name="android.permission.BLUETOOTH_CONNECT" uses-feature android:name="android.hardware.bluetooth" android:required="false" uses-feature android:name="android.hardware.bluetooth_le" android:required="false"

Tushar-Kanvinde avatar Nov 25 '22 05:11 Tushar-Kanvinde

Hello @Tushar-Kanvinde , did you add that to the config.xml?

gsusalvarado avatar Nov 26 '22 00:11 gsusalvarado

any solution?

lapisanlangit avatar Nov 27 '22 02:11 lapisanlangit

@gsusalvarado

I am not familiar about how to add things to the AndroidManifest via config.xml

I added it to AndroidManifest.xml and then gave the gradlew bundleRelease command rather than the cordova build command.

I also have cordova.plugins.permissions.requestPermission(cordova.plugins.permissions.BLUETOOTH_SCAN, and cordova.plugins.permissions.requestPermission(cordova.plugins.permissions.BLUETOOTH_CONNECT); in javascript

Tushar-Kanvinde avatar Nov 27 '22 10:11 Tushar-Kanvinde

@gsusalvarado

I am not familiar about how to add things to the AndroidManifest via config.xml

I added it to AndroidManifest.xml and then gave the gradlew bundleRelease command rather than the cordova build command.

I also have cordova.plugins.permissions.requestPermission(cordova.plugins.permissions.BLUETOOTH_SCAN, and cordova.plugins.permissions.requestPermission(cordova.plugins.permissions.BLUETOOTH_CONNECT); in javascript

this is working or not?

lapisanlangit avatar Dec 03 '22 09:12 lapisanlangit

@lapisanlangi

Yes. It is working for me.

I already had the permissions plugin in my project. You may need to add that.

Tushar-Kanvinde avatar Dec 04 '22 12:12 Tushar-Kanvinde

@lapisanlangi

Yes. It is working for me.

I already had the permissions plugin in my project. You may need to add that.

ok nice info..I will try it again.. I am remember I already add that but still failed.. can you gave us full sample code in AndroidManifest.xml? I don't understand what do you mean about gradlew bundleRelease command... how to use it?

lapisanlangit avatar Dec 05 '22 03:12 lapisanlangit

edit the file platforms/android/app/src/main/AndroidManifest.xml search for uses-permission make a copy of that tag below it and then change android.permission.whatever to android.permission.BLUETOOTH_SCAN and again same with android.permission.BLUETOOTH_CONNECT

below that add tags uses-feature android:name="android.hardware.bluetooth" android:required="false" / uses-feature android:name="android.hardware.bluetooth_le" android:required="false" /

Then cd to the folder platforms/android

you will have a file named gradlew and another called gradlew.bat there

so the command ./gradlew bundleRelease
will give you aab file to upload to store

instead of bundleRelease use packageDebug for apk to debug

I am building on a linux machine. Things should be the same on windows.

Tushar-Kanvinde avatar Dec 05 '22 04:12 Tushar-Kanvinde

edit the file platforms/android/app/src/main/AndroidManifest.xml search for uses-permission make a copy of that tag below it and then change android.permission.whatever to android.permission.BLUETOOTH_SCAN and again same with android.permission.BLUETOOTH_CONNECT

below that add tags uses-feature android:name="android.hardware.bluetooth" android:required="false" / uses-feature android:name="android.hardware.bluetooth_le" android:required="false" /

Then cd to the folder platforms/android

you will have a file named gradlew and another called gradlew.bat there

so the command ./gradlew bundleRelease will give you aab file to upload to store

instead of bundleRelease use packageDebug for apk to debug

I am building on a linux machine. Things should be the same on windows.

ok thanks @Tushar-Kanvinde I will try soon

lapisanlangit avatar Dec 05 '22 04:12 lapisanlangit

Any update?

LimSieKuang avatar Oct 21 '23 03:10 LimSieKuang

@gsusalvarado

I am not familiar about how to add things to the AndroidManifest via config.xml

I added it to AndroidManifest.xml and then gave the gradlew bundleRelease command rather than the cordova build command.

I also have cordova.plugins.permissions.requestPermission(cordova.plugins.permissions.BLUETOOTH_SCAN, and cordova.plugins.permissions.requestPermission(cordova.plugins.permissions.BLUETOOTH_CONNECT); in javascript

thank sir!

perry1100 avatar Mar 26 '24 16:03 perry1100