Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to allow another app to access my app's data directory?

Tags:

android

Suppose I have an app named A with this data directory: com.example.test Now I want to make another app named B to modify something in com.example.test.

Of course I know both have to share the same signature. But what else do I have to have?

Basically I am trying to design an app to which users can plug in new components. Any idea?

like image 412
Joseph_Marzbani Avatar asked Jan 19 '26 13:01

Joseph_Marzbani


1 Answers

I believe the safest approach would be to use a Content Provider. Then to access a file in application A from application B, you can declare a ContentProvider in application A and override the public ParcelFileDescriptor openFile(Uri uri, String mode) method. Then application B can access a file located in data directory of application A through an appropriate uri using the getContentResolver().openInputStream(...) method. For more information see:

http://www.grokkingandroid.com/handling-binary-data-with-contentproviders/

https://stackoverflow.com/a/4336013/1482726

like image 122
Angelo Avatar answered Jan 21 '26 01:01

Angelo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!