Get Specific folder access/permission only in react native - android

I have published the app on the Google play store with MANAGE_EXTERNAL_STORAGE permission. Google rejected the app and said to remove this permission and get access to a specific folder (related to your app, not the entire storage permission)
I have used the react-native-scoped-storage for this purpose and followed the documentation. With this line:
let dir = await ScopedStorage.openDocumentTree(true);
The file manager opened and I granted permission, but still, I am unable to get files.
I do get files with this same package with this line:
const files = await ScopedStorage.listFiles(dir.uri);
But the format is not correct, I get data in this format:
"uri": "content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2Fmedia%2F.Statuses/document/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2Fmedia%2F.Statuses"
Can anyone help me with this problem? I would really appreciate it. Thank you.

Related

Kotlin File(path).walkTopDown() does not find files

I'm trying to read a given directory recursively and find all folders and files. The directory and subdirectory is found, but no files.
The storage structure on my virtual device:
The code used to "walk through the given directory"
import android.util.Log
import java.io.File
// path = "/storage/1B10-1D17/ReadTest/"
class FileHelper {
fun walkTest(path: String){
File(path).walkTopDown().forEach {
// println(it)
Log.e("walkTest extension", it.extension)
if(it.isDirectory){
Log.e("walkTest", "Directory: ${it.name}")
}else{
Log.e("walkTest", "File: ${it.name}")
}
}
}
}
This will output the following:
E/walkTest extension:
E/walkTest: Directory: ReadTest
E/walkTest extension:
E/walkTest: Directory: SubFolder
In my android manifest file I have the following line and the permission is granted:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
What is the flaw in my code, how can I find the three pdf files stored in these directories?
Update 1/2
As can be seen in the screenshot below, the media access is granted:
If I run the following command (as suggested by dan1st), I get the following output, which shows that pdf file in place:
> adb shell ls /storage/1B10-1D17/ReadTest/
File_1.pdf
SubFolder
You generally have no access to arbitrary files on removable storage. This is not changed by READ_EXTERNAL_STORAGE.
Your proposed solution is to use MANAGE_EXTERNAL_STORAGE. Technically, this works, and it is a fine solution for personal-use apps. If your intention is to distribute this app, you will need to file paperwork with Google (and perhaps other app stores) justifying your use of this permission. Stores that disagree with your justification may elect to not distribute your app.
Alternatively, you can use the Storage Access Framework. Use ACTION_OPEN_DOCUMENT_TREE / ActivityResultContracts.OpenDocumentTree and let the user decide where on the user's device (or in the user's cloud storage) the user wants your app to access the user's content. You can then use DocumentFile to walk the document tree to find sub-trees and documents.

Github actions with Google playstore Api Error: The caller does not have permission

I'm trying to configure github actions to upload my .aab file to the PlayStore but been stuck on a permission issue which doesn't get fixed event though I've tried all the suggestions online:
I get:
I've been looking at the following issue which seems to be identical https://github.com/r0adkll/upload-google-play/issues/11
Was able to create an account and generate the json along with adding permissions. The google cloud api has an owner permission also the API Manager Permission but still I get this error. Any ideas what else I could try?
After much digging I found out that the problem wasn't with permissions, what was happening was that I had incorrect packageName in the script, after fixing the package name I had incorrect custom track name, so any typo in those fields will show permission error.
After fixing those the upload completed smoothly. Make sure you have correct values in the below fields since the permission error is misleading.
...
packageName: com.yourapp
releaseFiles: app/build/outputs/bundle/release/app-release.aab
track: alpha
status: completed
...

Android 11 not showing WhatsApp status in app. /storage/emulated/0/Android/media/com.whatsapp/WhatsApp/Media/.Statuses/ folder shows empty result

In my app, i am fetching WhatsApp status from /storage/emulated/0/Android/media/com.whatsapp/WhatsApp/Media/.Statuses/ folder everything working fine till Android 10, but in android 11 it shows nothing. Please guild me for this.
app showing status till 29 when change tp 30 folder show nothing.
The Status directory has changed to /Android/media/com.whatsapp/.Statuses due to the new changes of Android 11 which do not give access to External Storage as freely as before Android versions
You can read about the changes here in
detail
To summarise the exact cause of this change, is the WhatsApp was previously using the External Storage by creating it's own folder and that is not possible with the new scoped storage without requesting the MANAGE_EXTERNAL_STORAGE permission. Google will usually reject your app on the playstore if you request this permission. So WhatsApp has moved all of its required stuff in the above directory since the Android/data/ directory is no longer accessible and they want the user to access all of this data
There is an Android App which accesses the WhatsApp status directory and you can find it here
Let the user pick the directory with ACTION_OPEN_DOCUMENT_TREE.

Grant permission to everyone with Amazon S3 upload

After uploading a file with the TransferUtility for Amazon S3, I can't use the file.
Request failed 403: Forbidden
When I go to my bucket and check Permissions on the right, it only shows me.
When I add everyone, I can access the file without problems.
I was searching for a way to grant permission while uploading, but could find one for Android.
I found an answer for C# which leads me to this:
CannedAccessControlList cannedAccessControlList = CannedAccessControlList.BucketOwnerFullControl;
but I don't know where to add this..
The easiest method is to define a Bucket Policy that grants public access to a bucket, or a path within a bucket. That way, you do not need to specify the permissions on each individual object.
See: Using Bucket Policies and User Policies
For example, this bucket policy would allow public access to any object stored in the uploads path:
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"AddPerm",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::examplebucket/uploads/*"]
}
]
}
transferManager.upload(new PutObjectRequest("bucket name", "file name", "file path object").withCannedAcl(CannedAccessControlList.PublicRead));

About android market to upload an application

When my app upload to android market,Upload assets have a warnig message about this:
This apk requests 1 permissions that users will be warned about
android.permission.INTERNET
I check the app of manifest.xml,I'm sure there are manifest.xml to join the line
uses-permission android:name="android.permission.INTERNET
so...Why are there warning message about android.permission.INTERNET?
And another question,the Upload assets of "Localized to" appear unknown,
how to set this field about "Localized to"?
thanks~
Your application end users will be notified before installation the application have full access to Internet, something like this (there are 3 permissions, in your case only "Network communication" will appear):
you need to add localized strings first and market will automatically recognizes them.
see developer.android.com reference

Categories

Resources