CesarBalzer / Cordova-Plugin-BTPrinter

A cordova plugin for bluetooth printer for android platform
Apache License 2.0
81 stars 64 forks source link

target version 32 needs permission #65

Open Tushar-Kanvinde opened 2 years ago

Tushar-Kanvinde commented 2 years ago

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 commented 2 years ago

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"

gsusalvarado commented 2 years ago

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

lapisanlangit commented 2 years ago

any solution?

Tushar-Kanvinde commented 2 years ago

@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

lapisanlangit commented 2 years ago

@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?

Tushar-Kanvinde commented 2 years ago

@lapisanlangi

Yes. It is working for me.

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

lapisanlangit commented 1 year ago

@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?

Tushar-Kanvinde commented 1 year ago

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.

lapisanlangit commented 1 year ago

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

LimSieKuang commented 1 year ago

Any update?

perry1100 commented 8 months ago

@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!