Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Shared Internal Storage

Is there such thing on any Android based device as shared internal storage? I know you can use the SDCard as a shared file location between applications, but for a project I'm working on we dont want the ability for a SD Card to go missing (sensitive material).

The problem is as follows. App1 allows a user to browse (for example) some word documents and download them to the proposed shared storage, the user can then pass this file to Documents 2 Go editing them and saving the change. App 1 then allows an upload of the changed file.

I don't fancy building a document editor word/excel directly into app, unless thats easy?

EDIT:

The second app is "Documents 2 Go" I won't be able to edit its AndroidManifest

like image 349
Andy Davies Avatar asked Nov 13 '22 03:11

Andy Davies


1 Answers

I faced a similar situation now for txt files and did this.

File downloadedFile= new File( context.getFilesDir(), "simple.txt" );
downloadedFile.setReadable( true, false );
downloadedFile.setWritable( true, false ); //set read/write for others
Uri downloadFileUri = Uri.fromFile( downloadedFile );
Intent intentToEditFile = new Intent( Intent.ACTION_EDIT );
intentToEditFile.setDataAndType( downloadFileUri, "text/plain" );
context.startActivity( intentToEditFile );

Now the 'Document 2 Go' editor will be launched to edit the file and will be able to edit simple.txt

Note 1: Uri should be created from same file object that was set with setReadable()/setWritable.
Note 2: Read/Write permission for other users might not be reflected in file system. Some times I cannot see rw-rw-rw- in adb shell

like image 106
kiranpradeep Avatar answered Nov 16 '22 03:11

kiranpradeep