[Android Apps and Games] PerryGrin:
I think most or all of this can be found elsewhere on this thread !!!

[ But that's the problem with XDA-dev - threads get so large so quickly that even if you dilligently try to RTFM before asking your question it's not always easy to identify if there's already a solution. ]

1. Enable developer options on your device

(Settings/AboutDevice/BuildNumber and tap on BuildNumber 7 times in succession)

see https://www.digitaltrends.com/mobile/how-to-get-developer-options-on-android/

2. In Developer Options, enable USB debugging

3. Install adb on your desky/lappy.

see https://www.xda-developers.com/install-adb-windows-macos-linux/

4. Connect device (powered on and unlocked) via usb cable

5. Checkyour device is accessible from adb

[B]adb devices[/B]
List of devices attached
ZY223W4R8H	device

6. Take a backup of just the MMTracker app data

[B]adb backup -f moto4.ab com.meixi [/B]

7. For how to un-/re-pack adb backup file see https://xdaforums.com/showthread.php?t=2011811

8. I downloaded the android backup toolkit from https://sourceforge.net/projects/android-backup-toolkit/

But read forwards to point 14. to avoid the need to use this toolkit.

Use the backup extractor to get the tar file from the .ab file

[B]ABE_PATH=~/Downloads/android-backup-tookit/android-backup-extractor/android-backup-extractor-20180203-bin
java -jar "$ABE_PATH/abe.jar" pack moto4-new.tar moto4-new.ab [/B]

9. Check you have the right backup contents . . .

[B]tar -tf moto4.tar [/B]
apps/com.meixi/_manifest
apps/com.meixi/db/mapcachedb
apps/com.meixi/db/mapcachedb-journal
apps/com.meixi/sp/MMTrackerActivity.xml
apps/com.meixi/sp/com.meixi_preferences.xml
apps/com.meixi/sp/TrackGraphActivity.xml

10. Unpack the tar file (into a temporary directory)

[B]mkdir tar_contents_folder
cd tar_contents_folder
tar xvf ../moto4.tar [/B]
x apps/com.meixi/_manifest
x apps/com.meixi/db/mapcachedb
x apps/com.meixi/db/mapcachedb-journal
x apps/com.meixi/sp/MMTrackerActivity.xml
x apps/com.meixi/sp/com.meixi_preferences.xml
x apps/com.meixi/sp/TrackGraphActivity.xml

11. Find and edit the fields you need in the preferences file.

Here's what my file currently contains. I can't remember what was there originally after installation.

Anyway, you need these entries for your directory paths.

[B]grep -i Path apps/com.meixi/sp/com.meixi_preferences.xml [/B]
<string name="editWaypointPath">/sdcard/Mapping/TRW/</string>
<string name="editRoutePath">/sdcard/Mapping/TRW/</string>
<string name="editMapPath">/storage/821B-1111/SDMapping/Maps/</string>
<string name="editTrackPath">/sdcard/Mapping/[B][I]TRW[/I][/B]/</string>

Here, I'm just going to change the path to the tracks folder.
[B]nano apps/com.meixi/sp/com.meixi_preferences.xml
grep -i Path apps/com.meixi/sp/com.meixi_preferences.xml [/B]
<string name="editWaypointPath">/sdcard/Mapping/TRW/</string>
<string name="editRoutePath">/sdcard/Mapping/TRW/</string>
<string name="editMapPath">/storage/821B-1111/SDMapping/Maps/</string>
<string name="editTrackPath">/sdcard/Mapping/[B][I]test-new-trw-folder[/I][/B]/</string>

12. Now its a matter of repacking the restoring the backup file. I think the note in the XDA guide on backup packing/unpacking about directory paths and slashes is not relevant here. So create new tar file using the original tar file's contents list to specify which files to tar up .

[B]tar cvf ../moto4-new.tar $(tar tf ../moto4.tar) [/B]
a apps/com.meixi/_manifest
a apps/com.meixi/db/mapcachedb
a apps/com.meixi/db/mapcachedb-journal
a apps/com.meixi/sp/MMTrackerActivity.xml
a apps/com.meixi/sp/com.meixi_preferences.xml
a apps/com.meixi/sp/TrackGraphActivity.xml

Check format of old and new tar file should be the same

[B]cd ..
echo -OLD; tar tf moto4.tar ; echo -NEW; tar tf moto4-new.tar [/B]
-OLD
apps/com.meixi/_manifest
apps/com.meixi/db/mapcachedb
apps/com.meixi/db/mapcachedb-journal
apps/com.meixi/sp/MMTrackerActivity.xml
apps/com.meixi/sp/com.meixi_preferences.xml
apps/com.meixi/sp/TrackGraphActivity.xml
-NEW
apps/com.meixi/_manifest
apps/com.meixi/db/mapcachedb
apps/com.meixi/db/mapcachedb-journal
apps/com.meixi/sp/MMTrackerActivity.xml
apps/com.meixi/sp/com.meixi_preferences.xml
apps/com.meixi/sp/TrackGraphActivity.xml

13. Pack new .ab file

[B]java -jar "$ABE_PATH/abe.jar" pack moto4-new.tar moto4-new.ab
ls -l moto4* [/B]
-rw-r--r-- 1 PG staff 35882 26 Mar 03:41 moto4-new.ab
-rw-r--r-- 1 PG staff 106496 26 Mar 03:37 moto4-new.tar
-rw-r----- 1 PG staff 35831 26 Mar 02:46 moto4.ab
-rw-r--r-- 1 PG staff 106496 26 Mar 02:58 moto4.tar

14. NOTE: there is a quick method for un-/re-packing *unencrypted* .ab files which avoids the need for the the backup extractor tool in steps 8. and 13. above.

Skip the .ab file header to extract and decompress the embedded tar file

[B] dd if=moto4.ab bs=24 skip=1 | openssl zlib -d > moto4.tar
[/B]

Do the above stuff in steps 9. - 12. to unpack, edit and repack the tar file

Then, copy the original .ab file header and compress and append the modified tar file to get a new .ab file

[B]dd if=moto4.ab bs=24 count=1 of=moto4-new.ab
openssl zlib -in moto4-new.tar >> moto4-new.ab [/B]

N.B. On Windows you probably need Cygwin or something to give you 'dd' etc.

N.B. On MacOS this won't work; see https://stackoverflow.com/questions/29830981/error-zlib-is-an-invalid-command. So there do ...

[B]dd if=moto4.ab bs=1 skip=24 \
| python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" \
> moto4.tar [/B]
35807+0 records in
35807+0 records out
35807 bytes transferred in 0.085661 secs (418007 bytes/sec)
[B]tar tf moto4.tar [/B]
apps/com.meixi/_manifest
apps/com.meixi/db/mapcachedb
apps/com.meixi/db/mapcachedb-journal
apps/com.meixi/sp/MMTrackerActivity.xml
apps/com.meixi/sp/com.meixi_preferences.xml
apps/com.meixi/sp/TrackGraphActivity.xml

Yada-yada unpack, edit, repack tar file (steps 9. - 12.)

[B]dd if=moto4.ab bs=24 count=1 of=moto4-new.ab
cat moto4-new.tar \
| python -c "import zlib,sys;sys.stdout.write(zlib.compress(sys.stdin.read()))" \
>> moto4-new.ab [/B]
1+0 records in
1+0 records out
24 bytes transferred in 0.000028 secs (853079 bytes/sec)

[B]ls -l moto4-new.ab [/B]
-rw-r--r-- 1 PG staff 35929 26 Mar 04:10 moto4-new.ab

15. Now you want to restore the modified .ab file

[B]adb restore moto4-new.ab [/B]
Unlock your device and confirm the restore operation.

16. Needless to say, do all the above having first rebooted your device and ensured that MMT is not running. When you've done, open MMT and your directory choices should be the way you want them (might be as well to make sure the directories you want to use exist on the device before you start). I keep my maps on the external μSD card and my Tracks, Routes and Waypoints on the internal SD card because (A) they get written to frequently, so don't stress the μSD and (B) the internal SD is more responsive. Once you've set the directories up in this way, leave them alone - don't attempt to use the Settings/Directories option inside the app to change them - you'll end up in a pickle.

17. Rant! I wish Android would mount the externa μSD card by some logical name rether than by a card-specific volume identifier ( like, in my case, /storage/821B-1111 ). If your card fails or gets replaced for some reason, the new card will get mounted by a different identifier and any references you have anywhere to the original external card will now be wrong and will need to be corrected!!!!