newspaint

Documenting Problems That Were Difficult To Find The Answer To

Category Archives: Android

Viber Location System Could Not Identify Your Location

I found Viber, one day, to be mysteriously pausing for 20-30 seconds after sending a message before getting the following error message:

The system could not identify your location. Your message was sent without location.

The system could not identify your location

The system could not identify your location

Then you would have to press Ok before your message would actually get delivered. So what was causing this? Turned out to be very simple (but you wouldn’t know unless you were told). And would probably only happen if you had blocked location reporting to the application using Privacy Guard for Android 5.1.1 (in CyanogenMod 12.1).

You need to press the following icon so that it turns grey in order to stop sending your location with messages.

Viber location on/off icon

Viber location on/off icon

This can be found next to where you enter text:

Press the location icon until it turns grey to turn off location transmission

Press the location icon until it turns grey to turn off location transmission

So that the icon should turn back to grey (location reporting disabled):

Viber location icon should be grey

Viber location icon should be grey

No more errors when sending messages!

Backing Up Encrypted Data Partition On Android Phone

I have CyanogenMod 12.1 (Android 5.1.1) on my phone. And the data partition is encrypted. Unfortunately TWRP (recovery) cannot access this encrypted data partition – so I cannot back up my data in recovery.

Making Backup From Phone

So, when booted normally into Android, one can use adb to make a backup of the data partition.

This Stack Exchange forum post suggests executing:

$ adb root # connect as root user when running adb shell in future
$ adb pull -p /dev/block/dm-0 /tmp/dm0backup.img

An alternative technique might be to use the following command (using the adb shell command will produce invalid output):

$ adb exec-out "cat /dev/block/dm-0 |gzip -c" >/tmp/dm0backup.gz
$ adb exec-out "gzip -c /dev/block/dm-0" >/tmp/dm0backup.gz

Pushing Backup Back To Phone

$ adb root # connect as root user when running adb shell in future
$ adb push -p /tmp/dm0backup.img /dev/block/dm-0

Pull the battery out (don’t shut down normally and give the system a chance to write all over your newly restored backup), put it back in, and restart the phone.

A better way is via TWRP documented in this forum post:

After booting phone into recovery (TWRP), in one terminal start:

me@myhost:~$ adb forward tcp:5678 tcp:8765
me@myhost:~$ adb shell
~ # busybox nc -l -p 8765 >/dev/block/mmcblk0p43

In another terminal run:

me@myhost:~$ dd if=your-image-file.img | nc localhost 5678

While the dd transfer is running you can check progress by finding the PID and running (in another terminal):

me@myhost:~$ kill -USR1 pid

Mounting Android Data Partition Image In Linux

F2FS

2019-04-26 update: note that F2FS, rather than ext4, has been used of late so mounting as ext4 may not work. If this is the case then you can install the following package for Ubuntu:

$ sudo apt-get install f2fs-tools
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libf2fs0
The following NEW packages will be installed:
  f2fs-tools libf2fs0
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 69.7 kB of archives.
After this operation, 226 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
...

The options required to mount F2FS are different from ext4 as the noload option is not supported. The norecovery option is required in order to mount as read-only (otherwise an error message of “cannot mount /dev/loop0 read-only” will be encountered).

# make a mount point
sudo mkdir /mnt/android

# mount dirty partition
#   noexec     - do not allow direct execution of binaries on mount
#   norecovery - do not attempt to replay dirty log which requires read-write
#   ro         - read only
sudo mount -o ro,norecovery,noexec -t f2fs /tmp/dm0backup.img /mnt/android

# look into mounted partition
ls -al /mnt/android

# unmount when you're finished
sudo umount /mnt/android

ext4

You can mount your backed up partition in Linux using the command (thanks to this article):

# make a mount point
sudo mkdir /mnt/android

# mount dirty partition
#   noload - don't load journal on mounting
#   noexec - do not allow direct execution of binaries on mount
#   ro     - read only
sudo mount -o ro,noexec,noload -t ext4 /tmp/dm0backup.img /mnt/android

# look into mounted partition
ls -al /mnt/android

# unmount when you're finished
sudo umount /mnt/android

CyanogenMod 12.1 Google Play Services has stopped

On a Samsung Galaxy Tab SM-T320 I was getting the following message after upgrading CyanogenMod to the latest stable 12.1 build:

Unfortunately, Google Play services has stopped.

This message would occur constantly, maybe every 3 seconds or so.

On pressing the “Report” button I would see a preview of a Crash Report that stated:

Submission subject
[CRASH] com.google.android.gms threw android.database.sqlite.SQLiteException

Submission content
android.database.sqlite.SQLiteException: Can’t downgrade database from version 65 to 64

So I used adb to shell into the device from my laptop and became the root user (using the su command).

Essentially I just had to delete any databases that were being used by Google Play Services. This was a lot. To find out which I would run the command:

logcat |grep -B 3 -A 20 downgrade |less

and look for lines that stated:

E/DatabaseUtils( 1180): 	at com.android.providers.telephony.SmsProvider.
query(SmsProvider.java:276)

and so forth and then run

rm /data/data/com.android.providers.telephony/databases/*

or

rm /data/data/com.google.android.gms/databases/*

I think these were the main two database directories I had to erase. You will probably want to back up any SMSs you have (although this doesn’t apply in the case of a tablet with just wifi).

I also had a similar crash with the clock and had to erase its databases, too.

Then reboot. Should be no more errors.

CyanogenMod 12.1 Not Roaming (No Signal)

I had a problem in Estonia. My phone was not roaming with my foreign SIM. When I inserted an Estonian SIM it connected just fine with H+ and LTE data modes enabled. But my foreign SIM would give me the following message whenever I tried to connect automatically or manually to any Estonian provider:

Can't connect to this network at the moment

Can’t connect to this network at the moment

The message was “Can’t connect to this network at the moment. Try again later.”

Very unhelpful. And I would have no signal at all.

When I returned to my foreign country I double-checked with my provider to ensure that I did, indeed, have roaming enabled. In fact this worked on a previous version of CyanogenMod on a different phone in Estonia. So it appeared there was something wrong with the phone.

Eventually I luckily ended up on this article which had a technique that worked for me.

Update

A faster way may be to just dial *#*#4636#*#* on your phone, select Phone Information, find the “Set preferred network type:” drop down and select “GSM only” and wait 60 seconds to see if you get a connection.

But even if this works it could be just a temporary solution. And you may be restricted to slow speeds so experiment with other network types, too. What you set in this testing menu will not be retained after a reboot.

First I had to set my preferred network type to “2G” by first going into settings, and choosing “Mobile Networks” (taking care to touch the words, not the switch icon):

Choose Settings, Mobile Networks

Choose Settings, Mobile Networks

Then set the preferred network type to 2G:

Set the Preferred Network Type to 2G

Set the Preferred Network Type to 2G

At this point you can power off your phone, insert your foreign (roaming) SIM, then turn your phone on again. Like magic it will find a signal and finally be roaming.

How About Roaming in New Zealand on Three UK?

Again I had to set the preferred network type to 2G to actually connect to Spark NZ or 2 Degrees in New Zealand on Three roaming. (Update: actually, that’s strictly speaking not true, I was just impatient. Turns out you can have LTE preferred but just wait the 1-2 minutes it takes to connect to the mobile network, and may disconnect but will reconnect again).

But if you want a faster connection you have to do a little trick after powering up your phone each time. That trick is as follows.

Dial *#*#4636#*#* which will give you a “Testing” menu. Choose “Phone information”.

Further down the screen you will see “Network type:” and this may be EDGE – which is a high speed form of 2G (GSM). You can make this HSPA or HSPAP by doing the following.

Find “Set the preferred network type:” and from this list select “LTE/GSM auto (PRL)”. It will take a while to connect back to the phone network, between 1 and 2 minutes. Be patient (although if you wait 5 minutes give up). This time when you connect the “Network type:” should display HSPA or HSPAP and your connection should be a lot quicker.

Note that this preference will be lost each time you reboot your phone. So you’ll have to go through this little trick each time you power on for high speed mobile data in New Zealand.

A friend has UTMS showing on their phone on the same network which is 3G.

See this forum post about various network types and speeds.

App Names Missing in App List/Drawer in CyanogenMod/Android

In CyanogenMod 12.1 Android I was worried when I upgraded and the app icons were missing names/missing text in the app list (known in CyanogenMod as the “app drawer”).

App list missing text

App list missing text

Go back to your home screen. Then touch an unused area and hold until you see the home screen settings. Then drag up the panel from the bottom to reveal home screen options.

Tap and hold until home screen options appear, then drag the bottom panel up the screen

Tap and hold until home screen options appear, then drag the bottom panel up the screen

Finally ensure text for the app list is not hidden (change this setting if so).

Show icon labels

Show icon labels

Done!

Samsung Galaxy Tab Pro S 8.4 SM-T700 Force Reboot

Things really bad? Want to force a reboot of your Samsung Galaxy Tab Pro S 8.4 SM-T700 (Cyanogenmod klimtwifi)?

Hold down the home button (on the bottom middle front of the device) + volume down + power for ten seconds.

Adjusting Ringtone and Media Volume in Android Lollypop

It’s not immediately obvious how one can set media volume and ringtone volume in Android Lollypop.

If you want your phone to vibrate, or set it to be silent, how can you do this quickly and easily? In addition how can you also have quick and easy control of your media (e.g. music player)?

Set Up

First go to Settings > Buttons and ensure that the “Volume keys control ringtone volume” is set to off.

Ensure volume keys do not control ringtone volume

Ensure volume keys do not control ringtone volume

If this is set to on then you won’t be able to easily control music playback volume – and that could be a real problem if a loud song suddenly comes on.

Changing Ringtone Volume or Setting Vibrate or Silent

Press a volume key on the side (or back) of your phone – up or down, it doesn’t matter.

You will see a slider drop down at the top of your phone:

Touch the sliders icon circled here in red

Touch the sliders icon circled here in red

Touch the sliders icon on the far right of this black bar (circled in red in the photo).

Now you will have the option to set the volume of media (which you can already do by using your physical volume keys) as well as the ringtone volume.

Set the ringtone volume or vibrate by sliding the slider circled in red here

Set the ringtone volume or vibrate by sliding the slider circled in red here

Set the ringtone volume or the phone to vibrate by sliding the slider (circled in red in the photo).

If you must have your phone absolutely silent then touch the “None” button.

Putting CyanogenMod 12 Onto Samsung Galaxy Tab Pro 8.4

The official instructions for this are at CyanogenMod’s wiki. However there are reports that Heimdall does not work on latest tablets with the following error:

Downloading device's PIT file...
ERROR: Failed to send request to end PIT file transfer!

Instead, following the links provided in this XDA thread, one can download a toolkit from autoroot.chainfire.eu for the SM-T320 model. After extracting this and running the tool (on Windows) Odin3-v3.07.exe you click on the “PDA” button and open the .tar.md5 file included in the package. On holding down the VOLUME DOWN key when powering-on the tablet you will see the following screen at which it is okay to proceed to send the loaded .tar.md5 file to the tablet.

Samsung Pro Tab 8.4 Custom OS Load Screen

Samsung Pro Tab 8.4 Custom OS Load Screen

Next download a recovery which can be found at this XDA thread. Reboot the device holding the VOLUME DOWN key again and use the Odin3 tool again but this time loading the recovery .tar.md5 file.

Finally reboot into recovery by holding the VOLUME UP key on power-up. Then you can sideload the CyanogenMod zip from ADB by selecting “Install from zip” then select loading from sideload. If you see the option “Apply update from ADB” then you have got the stock recovery and not the CyanogenMod recovery installed.

One problem is that, annoyingly, on first boot into CyanogenMod 12 the modal dialog box “Unfortunately, Email Has Stopped” keeps coming over and over and over and you have you just keep clicking “OK” and trying to quickly hit the “next” key through the default options in between until you get to the default screen. At which point deleting the Email client is probably the best thing to do.

How To Save Photos On SDCard In CyanogenMod/Android

My CyanogenMod (11)/Android (4.4) phone was saving photos to internal memory by default but I wanted to save photos to my sdcard.

I found how to change the camera storage option in this forum thread. Here I document the process using screenshots.

First start up the Camera app.

Next tap/select the “options” icon (it is an unfilled circle that may contain icons on top).

Then tap/select the “settings” icon (it is three horizontal lines with sliders on top).

Choose the options icon and then the settings icon

Choose the options icon and then the settings icon

From the SETTINGS menu that you are now seeing tap/select the “more settings” icon (it is identical to the same three horizontal lines with sliders on top that you tapped previously).

Select the more settings icon

Select the more settings icon

How you see the MORE SETTINGS menu. From here you can select “Storage” to choose the destination for photos.

Select Storage from the More Options menu

Select Storage from the More Options menu

Lastly select “SD card” as the desired destination (or “Internal” if you wish to switch back).

Select destination for the saved photos

Select destination for the saved photos

All done!

Upgrading the Samsung Galaxy Tablet 1 (P1000) 7 inch to CyanogenMod 11

Lately the CyanogenMod downloads page for the p1 (Samsung Galaxy Tab P1000) has had CyanogenMod version 11 nightly builds starting September 2014.

Downloading the zip only your external SD card is sufficient – then install, reboot back into recovery, then install a second time, and it should be good.

A problem is that the Google Apps from the CyanogenMod website (http://wiki.cyanogenmod.org/w/Google_Apps) do not work (this is discussed in this forum thread) and have your phone repeatedly complaining about crashes (this is the case for both the CM11 and CM10.2 Gapps packages from this website).

Instead you need to get the Banks GApps from a site like http://stiangi.tihlde.org/android/gapps/banks/4.4.2/. I downloaded the 5-31_GApps_Standard_4.4.2_signed.zip package onto my external SD card and rebooted into recovery to install.

Then after booting into CyanogenMod 11 I used Aptoid to search for “Google Calendar Sync” and installed it (or you could do this from the marketplace) so that my calendar would sync.