Resources

MY CLOUD HOME

Working with multiple users

My Cloud Home device is a multi-user device and each user has an individual space that only he/she has access to on the device. Users can invite family and friends to set up their private space in this powerful cloud system.

Each user wanting to use the device app needs to install the app independently. Device app can access only the files and folders that are accessible to the specific user. For example, the signed in User A can only access files and folders of User A when it installs the device app. The User B wanting to use the device app can access only the files and folders of User B. These files will be completely different from User A files in the database.

The following figure explains the multi-user concept with an example of Dropbox app. It shows a typical sequence of events for User A using the numbers keyed to each event.

 

Since many users share the device, the on-device app should be able to handle the multi-user scenario. The My Cloud Home SDK provides you an option to mount the right file system for each user. You can call getMyCloudUserId() of MyCloudUIServer to get the My Cloud Home user-id of the invoking user. Since the device app runs only one instance of the app, and it is your responsibility to handle different users. You can retrieve the user-id in the get() and post() call of MyCloudUIServer.

After retrieving the user-id, it can be used in MyCloudUIServer.getRootFolder() to get the root folder of the given user. The app can then read/write all the files and folders for that particular user. From this point onwards, you can use any standard Android read-write file mechanism to handle file operations.

Startup service should handle multiple onStartcommand() for each user. If multiple users installed and configured the app, the app will get notifications for each user. You can decide whether you want to spawn multiple threads to do the tasks for multiple users simultaneously or do it one by one for each user.

The device app has only one instance for all users. Hence, ensure that you are not saving any user-specific information in class variables or static variables. 

Since Android platform can kill and restart apps when android is out of memory, the application should resume their pending works for each user. For example, when User A and User B initiated a Dropbox sync with their respective accounts, the app should save the user's Dropbox credentials and sync status in non-volatile memory. This way, when the service is killed and restarted, the app can reconnect to the Dropbox and resume the sync operations for each user.

As a general principle, do not spawn too many threads and services, as that can take the My Cloud Home device to a busy state. You should develop apps that are meant to run silently in the background.

 

 

< < Previous   Next >>

Do more with the
My Cloud Home On-Device SDK

Click the buttons below to visit the My Cloud Home On-Device Developer Home & Workflow pages

 

Developer
Home

Get started, access the SDK, build your apps, & learn more


View Home

Developer
Workflow

Register & submit your app for review and contact support


View Workflow