£50 for the first working solution. SDK30 Android/data read/write

aidymp

Well-Known Member
Licensed User
Longtime User
Hi, Im a hobby coder and came accross B4A in 2014 it immediately made me and Android & Windows programmer! I found a niche, and have happily been sat hidden in my niche for the past 6-7 years.

So my apps load other apps with settings and configurations. Obviously Google love making us jump through hoops, And I fully understand the new Google Android/data folder lock out as a way to protect the end user from hacks and data theft.

BUT..... I really need access... (And i can see its clearly possible as lots of apps still have access)

I have been following the hundreds of posts about it, and the possible solutions. For me the closest i get is by following this post...

manage-external-storage-access-internal-external-storage-sdk-30

1# Now I DO get the permission. but the Android/data folder is empty!

2# So I saw people saying target SDK28 and use the rp.checkandrequest. Again i seem to get the permission but the Android/data folder is empty!

Its ODD because on my Huawei P30 Pro Android 11 (SDK 29?!!!) I can get the permission, see and write to the directory using the first method.

But Windows 11WSA (SDK30) I cannot see the folder
Samsung devices (SDK31) I cannot see the folder.

I remembered a few years ago I had a problem and using the android.jar from a lower SDK fixed the problem.

So I have downloaded android 28 sdk set that in paths and am still getting the same results!!!!

On investigating I see the the required resources (are actually SDK28!)

So im stuck my APP WILL NOT BE IN ANY STORES!

Who can solve this?

I Will pay £50 (im a hobby coder) for a solution that I can compile and keep for myself, or if you want to sell the source to other users, I will pay the price your offering it to other users.

Thanks

Adrian
 

agraham

Expert
Licensed User
Longtime User
1# Now I DO get the permission. but the Android/data folder is empty!
Read my link Manage all files on a storage device | Android Developers in the manage external storage first post. There are still limitations and no access to Android/data is one of them.

There is a loophole, that might get closed sometime, used by several File Manager apps that use Storage Access Framework (External Storage class in B4A) and get the user to select the Android folder. They also use manage external storage permission and must have had Google's OK to do that but I don't know if access to Android/data by Storage Access Framework also needs google assent to be in the store. Other than that you are stuck. Google really really doesn't want you to access other apps data.

I have tried myself using the B4A External Storage class on Android 12 but it always tells me that I can't use the Android folder itself and does not offer me Android/data nor Android/obb, but it does let me into Android/media and would let me create my own folder in the Android folder. Look at the first answer "Here is how it works in X-plore:" in the following link. I think the trick is to set the initial folder which the External Storage class requests to the Android folder. It should be possible to mod the B4A External Storage class to do this but I'm afraid that I don't have the motivation to spend my time trying.

 

aidymp

Well-Known Member
Licensed User
Longtime User
Read my link Manage all files on a storage device | Android Developers in the manage external storage first post. There are still limitations and no access to Android/data is one of them.

There is a loophole, that might get closed sometime, used by several File Manager apps that use Storage Access Framework (External Storage class in B4A) and get the user to select the Android folder. They also use manage external storage permission and must have had Google's OK to do that but I don't know if access to Android/data by Storage Access Framework also needs google assent to be in the store. Other than that you are stuck. Google really really doesn't want you to access other apps data.

I have tried myself using the B4A External Storage class on Android 12 but it always tells me that I can't use the Android folder itself and does not offer me Android/data nor Android/obb, but it does let me into Android/media and would let me create my own folder in the Android folder. Look at the first answer "Here is how it works in X-plore:" in the following link. I think the trick is to set the initial folder which the External Storage class requests to the Android folder. It should be possible to mod the B4A External Storage class to do this but I'm afraid that I don't have the motivation to spend my time trying.


Yes I have read this a few times, LOL And your solution is SO CLOSE! I do get the permission. But alas no access to the Android/data folder (Well I can access it, its just empty) that others DO get! Im hoping someone can solve this.
 

agraham

Expert
Licensed User
Longtime User
If you install apk manual and give all permisions by settings ---> app / setup... do you see the files ?
Sorry - I don't understand but the answer will be no - it won't work if you target SDK 30 as required by a store app. It's not just permissions - the file access is blocked by Android except for this Storage Access Framework loophole I described.
 

aidymp

Well-Known Member
Licensed User
Longtime User
If you install apk manual and give all permisions by settings ---> app / setup... do you see the files ?

As opposed to b4a bridge?

Currently my Samsung tab has just gone for repair, so Im trying in windows, and have installed the apk with ADB run it, it asked to grant permission, and then showed the same empty directory...... :-(
 

agraham

Expert
Licensed User
Longtime User
But alas no access to the Android/data folder (Well I can access it, its just empty)
That's probably using the PERMISSION_WRITE_EXTERNAL_STORAGE and normal file access. Storage Access Framework as presently implemented in the External Storage class won't let you select Android/Data.
 

aidymp

Well-Known Member
Licensed User
Longtime User
My App will not need to target SDK30 as it wont be in any stores...
 

aidymp

Well-Known Member
Licensed User
Longtime User
That's probably using the PERMISSION_WRITE_EXTERNAL_STORAGE and normal file access. Storage Access Framework as presently implemented in the External Storage class won't let you select Android/Data.

So forgetting manage-external-storage-access-internal-external-storage-sdk-30 totally,

And using the old rp.checkandrequest for PERMISSION_WRITE_EXTERNAL_STORAGE targetting SDK 28 sideloaded may work??

As it didnt work so far.... lol
 

aidymp

Well-Known Member
Licensed User
Longtime User
@aidymp it will be only for specific devices (and specific brand+model) + you will install it manually ?
how do you mean manually? i have another app that downloads and installs apks, using pm install

i sometimes use ADB

or sometimes i download with a browser and install via the browser
 

agraham

Expert
Licensed User
Longtime User
My App will not need to target SDK30 as it wont be in any stores...

But you said o_O
So im stuck my APP WILL NOT BE IN ANY STORES!

And using the old rp.checkandrequest for PERMISSION_WRITE_EXTERNAL_STORAGE targetting SDK 28 sideloaded may work??
Yes but only on Android version 10 or earlier. Android 11 and later block access to the contents of Android/data.
 

aidymp

Well-Known Member
Licensed User
Longtime User
@aidymp it will be only for specific devices (and specific brand+model) + you will install it manually ?
sorry i didnt see it as a question, the app is mainly for TV devices, nvidia shields, fire tv (old android os so far...) so any device really
 

aidymp

Well-Known Member
Licensed User
Longtime User
if no store... and android ...9... 10 (??.. maybe)... and go with sideloading/manual/installed by user ...may be worked as agraham said
Yeah, but whatabout 11 lol Shield is currently on Android 11
 

agraham

Expert
Licensed User
Longtime User
Yeah, but whatabout 11 lol Shield is currently on Android 11
Nothing about it. Android 11 won't allow it as I keep repeating. You are barking at the moon. The only way on Android 11 and later, regardless of the target SDK, would be the Storage Access Framework loophole.
 

aidymp

Well-Known Member
Licensed User
Longtime User
Nothing about it. Android 11 won't allow it as I keep repeating. You are barking at the moon. The only way on Android 11 and later, regardless of the target SDK, would be the Storage Access Framework loophole.


So just to clarify before we go round in circles again...

Some android apps that are not written in B4A can use some loophole (for now)

NOTHING written in B4A will ever be able to access the Android/data folder on android 11>

Is that correct??
 

agraham

Expert
Licensed User
Longtime User
NOTHING written in B4A will ever be able to access the Android/data folder on android 11>

Is that correct??
No! As I said above.
I think the trick is to set the initial folder which the External Storage class requests to the Android folder. It should be possible to mod the B4A External Storage class to do this but I'm afraid that I don't have the motivation to spend my time trying.
 
Top