Exchange between users on multi-user Android (4.2 or later)

Android introduced the Multiple Users feature in 4.2 (Jelly Bean MR1), and its documentation states:

From the point of view of your applications, each user runs on a completely separate device.

And here is a quote from the methods Environment.getExternalsStorageDirectory () and getExternalStoragePublicDirectory () doc:

On devices with multiple users (as described by the UserManager), each user has their own isolated external storage. Applications have access only to external storage for the user they run as.

Could it be true that there really is no reliable way to transfer data between users on the same device without using the network as an intermediary? I am looking for solutions that do not depend on the features of how the file system of the device is set by the manufacturer. In addition, for security purposes, sharing should be internal to my application.

Even if file sharing is really not possible, is communication possible through intentions?

There are use cases for this. Use example 1: let's say I'm writing an application with an input method that requires a 100 MB dictionary file. I would like to encode things so that if User A downloads this file, then User B can access it also without having to download it again. Use example 2: let's say I write fun “Leave my wife” note application, which allows user “A” to enter messages that will appear next time user B logs in (without using the network).

This thread on a separate site offers a solution, but their method seems undocumented and possibly unreliable. And there are a few more SO questions that have a name similar to this, but actually discuss different topics.

+7
android
source share
2 answers

OBB files (stored in /sdcard/Android/obb ) and used as extension files on Google Play, are distributed among all users by design, because they are quite large. If the input method uses extension files, the downloaded data will be shared. You can send broadcasts to other users, but this requires the INTERACT_ACROSS_USERS permission, which is reserved for system applications.

+5
source share

The OBB folder (/ sdcard / Android / obb) is used to exchange files and folders between multiple users. But the OBB folder is not displayed by my second user (One plus 5 mobile). So I tried to create the OBB folder in the Android folder (/ sdcard / Android /) for the second user and "BOOM". Now I can access the shared files of the second user. Try this trick if your second user does not display the OBB folder.

+4
source share

All Articles