[Android General] Aleq:
Hello Everybody,

I have been surprised nobody addressed the need for backup and restore app data of secondary user accounts in Android 4.2+ Jelly Bean/KitKat yet. I present you a back up/restore solution for the apps and data in all accounts. It is laborious but it works. Until we get proper support from Titanium or Carbon, this is the only way AFAIK.

Disclaimer:

I provide no warranty for this procedure. It just worked for me, but I haven't tested it extensively with many devices nor apps.

Requirements:

Titanium Backup and Titanium Backup PRO Key ★ root

Total Commander for Android (you can use any file manager which suits you, I prefer TC because it preserves the permissions and UID/GID of overwritten files).

Intermediate knowledge of Android file system, root etc. You need to understand all these steps (they are not that complicated).

__________________________________________________

Backup:

1) Activate Multiple profiles in Titanium Backup (Overview tab, bottom of the screen, above the free space progress bars) and add profiles - as many as you need/want (one for every device User Accounts). Let's say "Main User, "User2", ... Activate one (the one you'll use for your own data ("Main User" for instance)).

1.5) Backup in Titanium the app you want to backup - just in case something goes wrong in next steps. However, this will preserve only your main user data at this moment.

2) Activate the profiles for the app you want to backup - in the tab Backup/Restore, tap on the Application, scroll the window to the right and click 'Enable "multiple profiles" for this app'. Confirm assignment of "Main User" to the current data profile.

3) Switch the Titanium Backup profile into another one (pick one you want to use to hold the data for the secondary user, let's say "User2") - again, on the Overview tab, at the bottom of the screen.

4) Now the difficult part - run the Total Commander, open in the left panel: Root /, /data/data/com.ironhidegames.android.kingdomrush (use namespace of the app you want to backup)

You should see .data_profile directory there. If you don't, you haven't activated the profiles properly, don't proceed further until you do!

5) Switch to the right panel, open Root /, /data/user

You'll see a subdirectory "0" (linked -> /data/data, that's the main User Account BTW) and some other number(s) (10, ...), one for every other device User Account account. If you have only one secondary account, you'll see only "0" (mentioned above) and "10". If you have more accounts, I don't know how to find out which number is which account at the moment. You'll have to experiment here.

Navigate into the user's subdirectory (let's say "10"), find the same package (for instance /data/user/10/com.ironhidegames.android.kingdomrush) and then copy the content (select the files and folders by tapping their icons) to the panel on the left (simply click copy and that's it)

6) Repeat the steps 3) 4) 5) for all the users you want to backup

7) Repeat steps 1.5) 2) 3) 4) 5) 6) for all the apps you want to backup

8) TEST - Switch profiles on the Overview tab in Titanium and run the app(s) in every profile. Check, if the app/game really has different data in different profiles and that it matches the data from the other accounts. If they don't or the app crashes, the copying went wrong (or the permissions / UID/GIDs of the target are wrong - switch to the main account, check the permissions, UID, GID of files in /data/data/com.ironhidegames.android.kingdomrush by long tapping them, selecting properties. These are the values that should be set to the copied files from step 5) - repeat the steps and override them. Are you using Total Commander?)

9) Backup the app using Titanium (it includes all profiles this time)

__________________________________________________

Restore:

1) Restore the app using Titanium and check that all the Titanium profiles are working (switch the profiles and run the app/game with them to see if the data differ)

2) Create the user account in the system (Preferrably one at a time, create more (another one) after successfull restore - this will help you find out what is the user account number (/data/user/10/...) of which Device User Account)

3) Activate the Titanium Backup Data Profile of the user you want to restore from.

4) Install the app in the secondary account(s) - optionally you can use Multi-User App Share

5) Switch to the secondary account first and run the app (the one you want to restore) once, to recreate all the configuration files etc.

6) Switch back to the main account, run Total Commander

7) Open in the left panel: Root /, /data/user/10 (again, experiment with the account numbers here, 10 is usually the first secondary account; if you are creating secondary account one by one as recommended in step 1), you should know which one is the new one (0 is always the main user, BTW)). Navigate to the directory of the app you want to restore, /data/user/10/com.ironhidegames.android.kingdomrush for instance. Check some of the files here with long tap, properties - remember the UID and GID and permissions (just to be safe).

8) Open in the right panel: Root /, /data/data/com.ironhidegames.android.kingdomrush (again, use namespace of the app you want to restore)

9) Select all the files there and copy them to the left panel (again, simply mark all files by tapping their icons followed by clicking copy at the bottom)

10) Check the files in the left panel with long tap, Properties - check if the permissions, UID and GID match the values from step 7). Should be. If not, change it to match values from 7).

11) Repeat 2) 3) 4) 5) 6) 7) 8) 9) 10) for every User Account

12) Repeat all steps for all the applications you want to restore. Of course you won't be adding the Device User Accounts again (nevertheless you should know the Account numbers by now).

Hope this helps, good luck.