Enable Android App to Write to External SD Card with Magisk

Since the change in Android storage permissions that came with Marshmallow (6.0) not all apps are able to write and in some cases read the external storage. In particular are old apps that haven't been updated for years.

With that said a good number of apps that are in active development also have problems writing to the external SD card. This is either due to the developer not enabling this option or due to some device specific issue.

It would seem therefore that the only "solution" is for one to get a device with a generous internal storage or better yet a device that has dispensed with the SD Card slot altogether.

Fortunately, this doesn't have to be the case. Provided you have root permission this is something that you can resolve relatively quickly and have both newer or legacy apps write to the SD Card.



Enable Magisk ExSDCard Access Enabler (Oreo and Nougat)

1. To get started flash Magisk and install Magisk Manager if you haven't yet. Your phone will require a custom recovery like TWRP to accomplish this.

2. Open Magisk Manager and in the menu go to Downloads and search for the ExSDCard Access Enabler module. Install then reboot to finish installation.
install module

That's it, no additional settings are required. After rebooting your external SD card will now be mounted in a new location: /mnt/media_rw/[SDCARDNUMBER]/



Define Path for App

Depending which app you're using you now have to follow this path when selecting a directory (e.g. a download folder) in the SD Card. In some apps you may have to enter the path manually.
storage path in fora
SD path in an old version of Fora Dictionary

To ensure this setting works properly keep the module enabled at all times.

How I Fixed No Internet on a Safaricom Wi-Fi Hotspot

Rarely do I use Safaricom for internet but somehow I recently came by one of their generous data bundles. Naturally I decided to make use of it on my desktop to at least get some work done.

Usually I just tether my phone to my desktop's Wi-Fi adapter rather than using my trusty unlocked Safaricom modem. It is much faster not to mention I don't have to fret about missing any calls, though I can cumbersomely answer them using the modem.

Unfortunately, this particular Wi-Fi hotspot became quite problematic unlike what I'm used to when using Telkom or Airtel Kenya bundles. The problem: the computer successfully connects to the Wi-Fi hotspot but reports it has no Internet.
hotspot no internet

Thinking something might be wrong with the hotspot I tried both USB and Bluetooth tethering both of which resulted with the same error.

Next I tried running Windows Network Diagnostics which reported the following:
Your computer appears to be correctly configured but the device or resource (dns server) is not responding.

Thinking I had found the problem, I tried changing the DNS servers for the hotspot on my computer including to those of Google DNS, Open DNS and CloudFlare DNS none of which worked. I even went as far as changing the DNS server on my rooted Android phone which of course failed spectacularly.

Meanwhile I could still use the data bundle normally on my phone. A hotspot made with my Telkom line on the second SIM slot however worked perfectly regardless of which DNS server I used.

At this point I started suspecting foul play by Safaricom, after all some network operators are known to block tethering for end users. Nevertheless, I could not find evidence of this.

So after trying different public DNS servers with no actual change I decided to search for alternative DNS servers from Safaricom.

The first place I landed was on a forum discussing Your Freedom VPN. While completely unrelated to this, somewhere in that thread someone suggested to use a different DNS server: 196.216.201.21.

All this time my Safaricom internet had been using the DNS Server: 196.201.217.7. So I changed it to 196.216.201.21 and what do you know, the hotspot started working.

Now I'm not implying that this specific DNS Server will always solve this error for you. Safaricom uses different DNS servers and this happens to be just one of them.

Nevertheless, one thing is clear form this: should you encounter such an issue the first place you should go looking is in your DNS server settings. Try different public DNS and should those fail too, try different Safaricom DNS servers.

Now I should mention few moments later after making the change the new DNS server started acting up - it would lose internet for a while then recover on its own.

I suppose it wouldn't be farfetched to just conclude Safaricom has unreliable DNS servers, which is rather amusing as I've never before experienced this kind of issue with their "unreliable" competitors.

How to Add an End of Call Tone or Vibration in Android

Typically, when a call ends, be it after hanging up or having been unanswered, the phone signals the termination of the call with a tone or a beep if you like. This has been common to all the phones I've had the pleasure of using, that is from feature phones running Symbian, Android and not forgetting Windows Phone.

My current and relatively new Android device, a Xiaomi Redmi Go to be specific, however seems to be the exception to the rule so far. The issue is quite peculiar though as it seems to beep on some calls while on others it's just, well silent.

While at first this seems like a minor issue, the consequence of not having that beep is that on several occasions I've been left stupidly talking to myself because my caller run out of airtime, a rather common occurrence in a country where the overwhelming majority of mobile subscribers use prepaid plans.

The turning point however came when I recently lent out the phone to my dad to make an urgent call only for me to realize that he had held onto it for an inordinately long period without talking.

As it turned out the call had gone unanswered, and while it was no longer ringing, he never got the cue that the call had ended since he was still waiting for the beep. That's the extent to which this beep has conditioned us! Anyway after that experience I knew I had to find a solution.



Adding the End of Call Tone without Root

Initially I had thought this would at the very least require root to fix and so for a few months I shelved the idea of getting a fix for this issue. That's until recently when I took a gamble and ended up successfully rooting the Redmi Go. I was now ready to dive in.

So as usual I checked for fixes online and went through the Xposed and Magisk Modules but came empty. Ironically what I could find was quite the opposite; that is, people complaining that the beep was too loud and looking for ways to get rid of it.

My search however did eventually lead me to the Play Store where I found one app that somewhat could accomplish what I was looking for but only through vibration.

The app, On Call End (not call log), had last been updated in 2013 though it did install and run well on the Redmi running Oreo. Unfortunately, the app did not leave up to its expectations though you may want to give a try.

A google search for a similar app luckily unearthed another a similar app called Call End Tone Free. This app was however no longer available on the Play Store instead I could only find it from third party stores, top of the search results being the rather ubiquitous Uptodown.

With no better options, I ended downloading the app from this site. I took their word for it that their apks are safe; apparently they've a tight partnership with Virus Total to back this claim.

Fortunately, the risk was well worth it. The app though outdated and with an interface straight from the days of Gingerbread did surprisingly fix the issue for me. Even better it allows you to select a tone of your liking or to use a vibration instead.
end call tone settings
End Tone Options

I ended going with the latter which I've found to be more effective as it cannot be drowned out by surrounding noise.

Firefox Spell Checker and the Tale of a Missed Dictionary

For the past few weeks I was under the impression that there was something wrong with Firefox's spell checker.

The only reason however I was bothering with installing the spell checker in the first place was because pedantic Firefox couldn’t help but add red squiggly lines to my foreign queen's English in this blog's post editor. Mind you this after I've just finished doing another spell and grammar check in Microsoft Word.

Well I guess I'm partly to blame for misguiding it since the last time I capitulated to its annoying update notifications, I ended up downloading the first installer I could find online, which as it turns out was the US installer.

Anyway I realize I could easily disable the spell checker however it does come in handy in some unplanned situations like when editing emails online.

So rather than disable it altogether, I opted to do the reasonable thing and install the UK spelling dictionary. Thankfully, I only had to right-click inside the post editor and in the context menu select Languages > Add Dictionaries...
add dictionary

That obviously took me to the Firefox Language Add-on page and naturally, as anybody else aching to do away with such a minor issue, I saw the first link there nicely titled English (something) Language Pack and without a thought wasted no time clicking it. 
english us language pack

"Feels nice when they read your mind like that..." so I thought to myself as I distractedly watched it download and install the pack.  Yet to my utter shock, the dictionary never did install, and this is after I had generously given up my few precious tabs to that bully of a restart. Ugh! Guess I'll have to redo it.

So after numerous tries of downloading and installing what I thought was a spelling dictionary add-on, I randomly decided today, that is after being prompted by unsightly aftermath of red squiggly lines on another post, to find out just where that language pack was disappearing to.

Just as I had thought, the bloody thing had settled quite nicely in the Language settings playing second fiddle to its buddy, English (United States). Clearly I wasn't liking this music so I put it in first fiddle and strolled back to the post editor.

To my amazement, no change. Might as well be trying to install a High Valyrian Language pack! Anyway, I went back to the Language Add-on site and of course I couldn't find even Low Valyrian there, but I did one thing: my stupid senses.

All this time I had been missing the proverbial trees for the forest, the silent dictionaries for the rowdy packs of languages.
english uk language pack

With that said, not all my efforts were to nought. Thanks to changing the locale to English (UK) in the settings meant now that the recommended dictionary would be the UK one instead of the US one. Without that little change I'm afraid you wouldn't even be reading this.

To my defense, the countless more like me that have had to question their sanity to the point of espying chromy pastures, the few unwarily readying themselves to frolic into the groves of this red panda and that damned lot that silently suffers at the foot of that towering babel of an add-on page, it barely registers to an untrained eye that there could be a world of difference between a language pack and a dictionary, more so when the first link is to a language pack.

In other words, the dictionaries are sorely in need of their own page!

How to Root Xiaomi Redmi Go and Install TWRP Recovery

The Xiaomi Redmi Go is a budget entry level android phone from Xiaomi that runs the Go edition of Android 8.0 (Oreo). While specs are not its strong points, it looks and handles reasonably well for its price.

I've been using one for the past 3 months as my daily driver and overall I'm pleased with its performance and battery life. The only complain I have is on the paltry 8 GB storage though a 32GB SD card does a good job lessening its downsides.

Now the only thing that has been missing on the device up until now is root permissions. I had avoided rooting the device not so much because it voids my warranty but mostly because I had no use for it. With the right apps, the phone serves my needs well.

The way android handles external storage however is the straw that broke the camel’s back for me. From some apps not being able to write or store data in the SD to MTP just being a pain in the neck to use, I realized I had to root sooner or later.



Before Rooting

So first things first: I will not be held responsible should you end up damaging your device in the process. With that said, I'll endeavour to make this post as detailed as possible to ensure we minimize chances of that happening.

Secondly, after unlocking your bootloader you'll no longer be able to receive Android system updates and your warranty will be voided.

The particular version of Redmi Go I used is as follows:
  • Global Edition
  • Model Name: M1903C3GG
  • Android Version: 8.1.0
  • Android security patch level: 1 May 2019




Step 1: Enable Developer Options

1. On your Redmi Go to your Settings > About Phone and tap the Build Number until you get the notification that you're now a developer.

2. Next go to Settings > System > Developer Options and toggle the ON button then scroll down to the Debugging section and turn on the USB debugging toggle.


Step 2: Set Up ADB and FastBoot

The steps outlined here apply to those on Windows though the rooting can be done on both Linux or Mac.

1. Download the Android Platforms tools for Windows. This package contains ADB and Fastboot tools that we'll need for making the backups, unlocking the bootloader and flashing the recovery.

2. Extract the package on a drive on your computer e.g. in C:\adb\platform-tools. To minimize the likelihood of errors, don't extract to a folder in a long path or with spaces in it.

3. Install the Universal ADB driver for Windows (if you haven't before) then reboot your computer.

4. Connect the Redmi GO to your computer via USB then on your computer open a command window (Win Key + R > type CMD > OK) and navigate to the path of the ADB folder we extracted by typing the command:
cd C:\adb\platform-tools
Next type the following command:
adb devices
You'll get a prompt on your phone with your computer's RSA key fingerprint asking you whether to allow USB debugging. Check the Always allow from this computer then tap OK.

ADB and Fastboot is now set up and ready to use.


Step 3: Back Up Data (Optional)

Unlocking the bootloader may factory reset the phone and thus erase all the installed user apps along with any data in the internal storage. Even if it does not, its always a good idea to have a back up just in case of any unforeseen mishaps.

To avoid losing these data, you'll need to do a backup of your apps that you can restore back after we've done the rooting. Depending on your needs, you can do a backup using one or a combination of the following:

Option 1: Manual Backup

As the name suggests this implies doing the backup by yourself provided the apps allow for it. A few options you may consider include:
  • Copy all your personal data (photos, videos, music, documents etc.) in your internal storage to your computer. You can then copy them back after rooting.
  • Some apps allow you to export backups of settings or data to your storage that you can import after reinstalling the app (e.g. K-9 mail, BlackPlayer). 
  • Other apps will allow you to sync your data in the cloud to a linked account that can be restored by simply logging in to this account (e.g. Firefox).
  • Sync your contacts to your Google Account in the Contacts app or export to a VCF you can import later.
  • Backup your WhatsApp chats to Google Drive or locally. If you choose the latter make sure you back up the WhatsApp folder in the internal storage to your computer or SD Card.
  • Use the SMS Backup & Restore app to back up your SMS and Call History locally or in the cloud. After the reset, reinstall the app and restore the data backup.

Option 2: Stock Backup

This is the default backup option available in the phone settings which backups data to your Google account. To carry it out:

1. Go to Settings > System > Backup, ennable the option to Back up to Google Drive then add or choose a Google account to assign the backup.

2. Finally choose what to backup:
  • Apps and their data
  • Call History
  • Contacts
  • Device Settings (including Wi-Fi passwords and permissions)
  • SMS.

Note however that some apps and data may not be backed up. To restore this data, during the initial setup after resetting your phone just login into this account and Google will do the rest.

Option 3: ADB Backup

The ADB backup will allow you to back up app data without root. You have two options here:

a. Using the Helium app

Helium will allow you to do the backup straight from your phone though you'll still required to install the desktop app or use the Helium Chrome app in Chrome Browser to complete the backup.

In my case Helium failed to complete the backup on account of the Redmi Go being encrypted. You could try on yours though I doubt it will work. This leaves us with the second option.

b. Using ADB

This will export the ADB backup to a file in your computer.

1. Connect your phone to the PC and open a command window and navigate to the path of the ADB folder we extracted by typing the command:
cd C:\adb\platform-tools
Next run the following command to confirm that your phone is attached:
adb devices

2. ADB allows you to backup various things while excluding others. For most people however one of the following commands should suffice (where C:\Backup\ is the folder to export the backup):

To back up the data of your apps without including the apps themselves (apks) run:
adb backup -all -f C:\Backup\data.ab
To back up the data of your apps including the APKs run:
adb backup -apk -all -f C:\Backup\data.ab
To back up the data of your apps including the APKs and the data inside the internal storage run:
adb backup -apk -all -shared -f C:\Backup\data.ab

For more backup options read this reference or run adb shell bu help to see a list of commands

3. After running any of these commands your phone will immediately open a page called Full backup. In it enter a password to encrypt the backup then click tap the BACK UP MY DATA button (if your phone is not encrypted you don't have to enter a password).

Now just leave it to complete the backup. It may take anything from a few minutes if you've chosen the app only backup to over an hour if you chose to include apks and shared storage.

Below in Step 9 I've explained how to restore this backup. Now onto the good stuff.

Note:
  • Data for some apps may still be not be backed up even when using this method. Developers decide whether an adb backup is allowed for their app so unfortunately this something outside our control without root.




Step 4: Unlock the Redmi Go Bootloader

According to the tutorials online I was led to believe that to unlock the bootloader I needed to apply for an Unlock request, open a Mi Account and install the Mi Unlock tool to unlock the bootloader.. Apparently this is the standard procedure for all other Xiaomi devices.

I did exactly that but at the end of it I was greeted with a Couldn't unlock error:
mi unlock
Mi Unlock Error

Later on after some inspired searching online it turned out I could unlock it using fastboot as follows:

1. First go to Developer options in your phone and turn on the OEM unlocking toggle. If you've a pattern / security method set up, you'll be prompted to complete it.

2. Turn off your phone then get it into FASTBOOT mode by pressing the Lock + Volume Down buttons together.

3. Connect your phone to your computer and from our ADB folder run the following commands.

To confirm that your phone iscorrectly attached:
fastboot devices
To check whether the bootloader is locked or unlocked:
fastboot oem device-info
At this point it should output: <bootloader> Device unlocked: false

To unlock the bootloader.
fastboot oem unlock-go
You should get an OKAY response after running it as shown below:
fastboot commands
Bootloader Unlock Commands
The bootloader is now unlocked. To confirm, while still in FASTBOOT mode run the command fastboot oem device-info and you should get the following output: <bootloader> Device unlocked: true
bootloader unlocked
Bootloader Unlocked!

The boot screen will also now read unlocked just below the Mi logo before the Android Go logo displays. We can now proceed to flash TWRP recovery that will allow us to root the device.


Step 5: Flash TWRP Recovery

1. Get the Redmi Go TWRP Recovery from SourceForge that's provided by XDA's YasiR Siddiqui (please check this thread for updates or if the recovery link is dead).

2. Copy the recovery.img file inside the platform-tools folder

3. Get your phone in FASTBOOT mode, connect it your computer then run the following command:
fastboot flash recovery recovery.img

4. After doing this don't reboot otherwise the stock recovery will overwrite TWRP as it happened my case. Instead, run the following command to boot the TWRP recovery you've just flashed:
fastboot boot recovery.img
In TWRP go to Reboot and select Power off your device.

5. Now try getting into recovery by powering your device by pressing Lock + Volume Up button. If everything went as planned it should load TWRP Recovery.


Step 6: Fix TWRP Mount Data Partition Error

In TWRP recovery go to Backup and you may notice that the Data (excl. storage) partition reads 0 MB. If you try doing a backup in this state it will fail with the following errors while nearing the end:
could not mount /data and unable to find crypto footer
failed to mount '/data' (invalid argument)
unable to mount storage
unable to mount /data/media /TWRP/.twrps
From what I've gathered this happens because the internal storage of the Redmi Go is encrypted. To fix this:

1. Go to YasiR Siddiqui project in SourceForge and download the decrypt fix zip.

2. Put the decrypt zip file in your internal storage or inside the SD Card and boot your phone into TWRP Recovery.

3. In TWRP go to Install, select the ZIP file and tap the Install image button. After it has been flashed power off your device.

4. Boot into TWRP recovery again and check the Backup page. The Data partition size should now be listed and a backup completes successfully.


Step 7: Fix Encryption Unsuccessful Error

This happened in my case prior to knowing of the above fix. From what I had gathered at the time the only way I could get TWRP to see the Data Partition was to format the internal storage.

So I took the gamble and in TWRP went to the Wipe page and selected Format Data. Sure enough that fixed the Data partition error however on booting to System I was greeted with Encryption Unsuccessful message instructing me to reset the phone.

Hitting that reset button however only rebooted the device into TWRP before booting back again to the Encryption Unsuccessful message.

If you happen to be in the same spot, download the same decrypt zip from the previous step and put it in an SD Card. Flash it in TWRP as explained in the previous step then Reboot into System. The encryption error should now be gone.



Step 8: Root by Flashing Magisk

1. Download the latest stable Magisk Installer along with Magisk Manager APK from the official page on GitHub.

2. Copy the Magisk installer zip in your storage and boot into TWRP recovery.

3. Go to Install, select the Magisk ZIP file from your storage then tap the Install image button.

4. Reboot your phone and install the Magisk Manager apk. Finally launch the app and allow it to check for updates. You're now rooted!

From its menu you can access Superuser to manage apps given root permissions and install and manage modules to tweak your phone.


Step 9: Restore ADB Backup

If you did an ADB backup as outlined ins Step 3 (c), you can restore it by simply connecting the phone to computer and running the following adb command (where C:\backup\data is the path to the data backup) :
adb restore C:\backup\data.ab
Run this command ONLY after having installed all the apps that were installed during the backup and wish to restore their data.

To batch install apps using ADB, put their apks in one folder and ensure none of them has spaces in their name, then run the following command (where C:\apk\ is the folder with the APKs):
for %f in (C:\apk\*.apk) do adb install "%f"
After doing this, run the restore the command and your apps' data (including contacts, call history and SMS) will be restored.

This likewise applies to those that included apks in their backup as in my case the restore did not reinstall the apps from the backup as I had expected. The shared data will however be restored into the internal storage as it was before.


Step 10: Create a Nandroid Backup

Now that your phone is rooted and has all the apps you want in it, go to TWRP > Backup and do a full backup of your phones partitions (System, Data, Boot). You can then rest assured that you've a backup that you can always restore should anything happen to your Redmi Go.

This backup however doesn't include any of your personal data (such as photos, videos, music) inside the internal storage. For these you'll have to backup manually by either copying them to an external storage (e.g. your PC) or uploading/syncing them to a cloud storage (e.g. Google Drive).

And so this marks the end of this rather long tutorial. Good luck to you!

How to Unlfip Mirrored Videos using VirtualDub

Not long ago I covered on how to unflip videos using various Windows video players. That was however only a temporary measure as the players merely flip horizontally the decoded video. A permanent solution requires the video to be encoded (converted) with an appropriate video setting applied to unflip the image.

Most run of the mill free video converters out there however don't usually support such a setting save for clipping, cropping and some simple video effects to adjust brightness and contrast.

As a result, you may be forced to use a commercial alternative or full blown video editor suites such as Sony Vegas for this simple task. This is however unnecessary as you can use the free open source VirtualDub (VDub) with its filters to do this in a couple of minutes. Let me show you how.


Step 1: Install VirtualDub

1. Download the latest version of VirtualDub from the homepage. If you're on Linux, you may be able to run VDub in your distribution using Wine.

2. To install it just extract the package to a folder somewhere in your computer.



Step 2: Install VirtualDub FFMpeg Input Plugin

VDub doesn't support some modern video file formats such as MP4, MOV and WebM. The only common format it supports out of the box is AVI however you may also run into problems with this format if it's using some unsupported codecs such H.264/AVC, VP8/VP9 etc.

To get past this limitation we need to install a plugin such as the FFMpeg Input Plugin which allow you to open most if not all common video formats out there. To do that:

1. Download the latest FFMpeg Input plugin from the SourceForge.

2. Run the setup file to install the plugin. When prompted to choose the folder where to install, select the folder where you extracted VirtualDub.


Step 3: Unflip Video with Flip Horizontally Filter

1. Run the program by running VirtualDub.exe.

2. Press Ctrl+O or go to File > Open video file... and select the flipped video. You can also open the video by dragging and dropping it inside VirtualDub.

3. In the toolbar go to Video > Filters or press Ctrl+F.

4. Click the Add... button, select the flip horizontally filter and then click OK to add it.

5. On the video preview you'll now notice that the video has been flipped.
flip horizontally preview
Right: Original Video, Left: Unmirrored Preview

The easiest way to know this is to seek to a section in the video where there is some visible text like captions, credits or a watermark. The text should now be readable.

6. Next if you don't mind saving the file to AVI just go to File and select Save as AVI... or press F7. You can then convert the AVI to whichever other format you want using a video converter.



Step 4: Save Video to MP4 or Other Formats

While VirtualDub only supports saving to AVI it does provide a means for using external encoders since version 1.10+. The appropriate external decoders if set up correctly can be used to export the edited video to MP4, MKV, MOV and other formats.

A good guide on how to set up some external encoders to save to various formats can be read here. For the purpose of this tutorial however I'll cover only exporting to MP4 or MOV using FFMpeg as explained in that guide.

To do that:

1. First download and install FFMpeg for the version of Windows you're running.

2. Next download this VDub profile file or copy the code provided here and save it to a file named ffmpeg-1.vdprof.

3. In VirtualDub go to Options > External encoders... then click the Import... button and select the ffmpeg-1.vdprof file. Doing that will import three different profiles:
  • mov ff x264+pcm: to encode to MOV with x264 video and PCM audio (i.e. WAV - if you need lossless audio)
  • mp4 ff mpeg4 q1+ac3: to encode to MP4 with MPEG-4 video and AC3 audio
  • mov ff mjpeg+pcm: to encode to MOV with MJPEG video (lossless) and PCM audio (lossless)
import vdprof profile

4. Switch to the Encoders tab with the following list of profiles.
encoder profile

Double click to open each of the profiles and in the Program box select the path to where FFMpeg is installed e.g. in C:\Program Files\ffmpeg\bin\ffmpeg.exe
encoder path

Click OK and that's it.

5. Now to save your video, go to File > Export > Using external encoder... and select one of the profiles you've just set up and click OK.

6. Choose where to save the encoded file and give it a name then click the Save button to start the encoding. Give VirtualDub some time to do the encoding. Your video will be flipped horizontally and saved in MP4 or MOV.

TIP:
  • You can encode to the lossless MOV format then use a normal video converter to save it to any other format using your preferred codecs and encoding settings for video and audio.