Madhav
February 27, 2023, 5:46pm
19
Hi Evan and Chris, I have figured out a way to solve this Bluetooth Classic Permission Issue.
Build the APK file from your project in MIT APP inventor.
Open the AndroidManifest.xml file to modify the permissions.
Delete all permissions related to BLUETOOTH and add 3 lines.
Save the AndroidManifest.xml file with above changes.
Rebuild the APK file.
NOTE:
How to view the AndroidManifest.xml?
------ Download APK Studio Editor from the link Download APK Editor for PC and Mac β APK Editor Studio
------ Open APK Studio Editor and Open the APK file.
------ Click on the "Open Contents" tab
------ Folder will be opened and "AndroidManifest.xml" file can be seen.
How to Edit AndroidManifest.xml file?
------ Open the AndroidManifest.xml using any of the text editor.
------ Delete the lines related to Bluetooth related permissions.
------ Paste the below lines and save the changes.
How to Rebuild the APK
------ After following the Step1 and Step2, On APK Studio Editor, Click on "SAVE APK"
Now, install the APK on mobile and Check the Bluetooth Permission Error Should be gone
1 Like
Anke
February 27, 2023, 6:08pm
20
Even with the latest version of apktool
it is not possible to set compileSdkVersion=31
:
opened 03:14AM - 20 Dec 22 UTC
closed 10:41AM - 24 Dec 22 UTC
## <div align="center"><ins>Optional CLI Flag to Ignore SDK changes when recompi⦠ling</ins></div>
when we decompile an `.apk` file and change the targeted SDK versions in the `AndroidManifest.xml` and `apktool.yml` files, these changes end up being eliminated because they revert back to their original version before the Recompiling Process is complete (i.e if we make changes to target `sdk 22` instead of `sdk 23`, the changes will revert back to `sdk 23` before the `.apk` file is recompiled) as stated in this [Metasploit Issue](https://github.com/rapid7/metasploit-framework/issues/16208#issuecomment-1050068753)
## <div align="center"><ins>**Describe the solution you'd like**</ins></div>
An option to ignore SDK changes made to the `manifest.xml` and `apktool.yml` files, if this is possible.
So something sort of like the example below;
```bash
java -jar apktool b "decompiled-apk" -o "recompiled.apk" -f --ignore-sdk
```
Not sure if this even doable or if there's an option for this already, I did research on it before posting this but I couldn't really find anything related.
opened 08:51AM - 05 Mar 19 UTC
closed 10:16AM - 17 Jul 23 UTC
### Information issue #1852 #1909
After decompiling and recompiling with apkto⦠ol, the contents of the AndroidManifest.xml file are changed as follows.
0. 2.3.3 version works as normal.
1. **Apktool Version (`apktool -version`)** - 2.3.4 & 2.4.0
2. **Operating System (Mac, Linux, Windows)** -Windows10
3. **APK From? (Playstore, ROM, Other)** - Other
### Steps to Reproduce
0. original : AndroidManifest.xml -> android:compileSdkVersion="28"
1. delete framework(1.apk)
2. 'd' option ->
3. 'b' option ->
4. Check the AndroidManifest.xml file.
AndroidManifest.xml -> android:compileSdkVersion="23"
compileSdkVersion changed
### Frameworks
If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files
(`.apks` that live in `/system/framework` or `/system/priv-app`)
### APK
If this APK can be freely shared, please upload/attach a link to it.
[sample_compilesdkversion.zip](https://github.com/iBotPeaches/Apktool/files/2929902/sample_compilesdkversion.zip)
### Questions to ask before submission
1. Have you tried `apktool d`, `apktool b` without changing anything? Yes.
2. If you are trying to install a modified apk, did you resign it? N/A
3. Are you using the latest apktool version? Yes. 2.3.4 & 2.4.0 version
It seems to be related to aapt2.exe
(aapt.exe
) - I'm not sure...
Please any tip/hint that might help?
Anke
February 27, 2023, 6:20pm
21
Madhav:
Delete all permissions related to BLUETOOTH and add 3 lines.
If you set the targetSdkVersion=29
the app (APK) will not allowed by Google (in the Play Store). The minimum targetSdkVersion has to be 31.
Zivo
March 5, 2023, 10:58am
23
Hi Evan,
Part of this release, what's the chance to fix the AdvertismentData block?
This module return null, seems it was never works.
I need it for some IOT class.
THX
Ziv
Hi Evan, hope your brain is suitably refreshed after your short break
Re my Post#20 in this topic:
Okay, so the solution should be the following: All devices, I want to use, contains "BTG" in the name. So I scan for a specific short period of time, then stop the scan and add all devices that contains "BTG" in the name to a list. Then repeat the process to find more devices with the correct name and add them to my list β if not there yet. Right?
To prevent the BLE Device List becoming so large it slows the Smartphone down or crashes the App, we need a new function that filters devices found and only adds them to the BLE Device List if a specific string exists.
i could use scan with @Anke 's way that set "scan block" dummy for get connect permission in running!
but still "advertising" is not working.
it showing always "false" in result.
can i make it working with any ways??
Anke
March 13, 2023, 3:54am
26
You are using Kodular. (You should ask there.)
Did you try it on AI2 too?
yes and tested with after get "connect" permission.
still giving "false"
i didn't use APK studio. must i?
I've been out for the past week, but I'll try to see if I can get this onto my calendar for this week.
1 Like
then, is it mean no way to use "advertisement" for now? (without APK studio?)
thank you for your support
sorry but i tried with AI2 first, and i hoped its work with kodular and tried. so screenshot was.
whatever both are not working.
Taifun
March 13, 2023, 9:48pm
31
to start scanning and immediately trying to connect to a device does not make much sense, does it?
try to use the DeviceFound event to connect
Taifun
Taifun:
it was just for dummy for get permission when first run.
sometimes its asking permission when the just openned first time(without any actions), but sometimes its not asking. so i made button to activate. i don't know actual condition of these differences but i guess its from minimum SDK level or just AI2<->kodular build conditions.
ofc im using as you shown for event to find devices.
the problem and my purpose is to make permission for "BLUETOOTH_ADVERTISE".
thank you
1 Like
... that should be the Classic BT BluetoothClient block, not the BLE block, as per Anke's post.
Anke
March 16, 2023, 5:14am
35
You should then place a .Connect
block in a way (unobtrusive and separate from your blocks/procedures) that avoids a Connection
error / ConnectionFailed
.
do you mean like perfectly seperated, cannot use?
whatever it worked
maybe ewpatton fixed it
Anke
March 17, 2023, 7:30am
37
Mok_Ryun:
seperated
And this procedure, of course, is not used anywhere.
then it was right. thank you!