Flashing Cyanogenmod Into A Nexus 7 2012 Tablet

I bought my Nexus 7 tablet a bit late in the game, in 2013, when everyone else was buying the new Nexus 7 2013 edition. Although being a model behind has its obvious drawbacks, the benefits can include a device with all the initial problems resolved (avoiding the first adopter’s problems with software and hardware), a cheaper price and usually a year’s worth of reviews and discussions to read prior to making the purchase. However, like everything else, one has to buy carefully.

There have been a couple of updates from Google on the software front since the tablet has been released, including the update to Lollipop (Android 5.1.1). This update, as you may already know, has caused a lot of grief to a lot of people, by making some tablets unusably slow, including mine (oh, why didn’t I say “no” to the update dialog). Far from making it a better experience (something one expects from a software update), it turns the tablet into something you do not want to use and there is no going back to previous version.

I have been leaving the tablet unused for quite a few months now, since it takes a few minutes just to get past the lock screen, so yesterday I decided to load a custom ROM, namely Cyanogenmod to make it my daily device again. This, as it happened, gave me a new set of problems to deal with, namely:

  • After flashing a new recovery image, namely TWRP-3.0.0-0-signed.zip, the device will boot into recovery, but cannot mount any of the partitions such as data and system, which results in a failed attempt to install Cyanogenmod and Gapps (Google Apps package).
  • I tried the multirom version as discussed in this web page, but it does not even boot (I think it was meant for the later models of Nexus 7).
  • I tried to flash a CWM recovery image for Nexus 7 as listed on this web page and it has the same problem mounting partitions as the TWRP recovery software.

So what to do? After a few hair pulling moments, I decided to give TWRP another try, this time, thinking that this device has been around for a while, I decided to flash an older version of TWRP, namely version 2.8.6. I thought, surely, if the newer version does not work, then the older version may not work? Wrong. TWRP version 2.8.6 recovery image worked perfectly. I was able to wipe the System partition, flash Cyanogenmod version 10.2 and Gapps (make sure you get the correct version of Gapps) and root the device successfully. Now I am looking forward to using my old Nexus 7 tablet as a daily device again.

 

Converting a large text file into an sqlite database

Sometimes we need to deal with large text files that are more than some text editors can handle. I recently have to convert a large text file containing a list of words which contains more than 600,000 lines.  The file size was just under 100MB and to open it with a text editor was an exercise in frustration.  Continue reading “Converting a large text file into an sqlite database”

How I got Cordova or Phonegap local html video playback working

I was working on a project recently where I had to create a Cordova Android app that could play video embedded in the “assets/www” directory. This proved to be quite challenging and it seems that there are a lot of hurdles to make this happen. There are many questions  on stackoverflow here and here , amongst many, regarding this issue and there are a lot of problems faced by developers as Android gets updated, with many new workarounds needing to be found.

For a while, I was able to use the Cordova Html5Video Plugin and it worked well, except there is a limited amount of video properties and events available and it is a little awkward, since videos have to be placed in a special directory, which are then placed in the sdcard partition of the device. When I tested this on my device, videos can be accessed from the device’s camera and video roll, which kind of begs the question why the user would watch the video in the app, if they can access the video clips directly outside. I am sure there are workarounds that can be applied in this case, but since this method stops working for me on devices above API 19, it feels kind of broken and messy.

I also was wanting to find a way to work with JSC3D to enable showing some 3D models in a Cordova application. Since JSC3D does not work unless the model is served over http, I was thinking that would it not be nice to have a mini server serving the files from inside the Cordova app? After working through a bit of Google magic, I found this project on Github, called Cordova-httpd, which is exactly what I was looking for.

Suddenly I realised that a lot of the problems with inline video in Cordova could be solved in the same way. One could create a folder for the video files and then serve them using the httpd server into the app. The only thing that would have to be modified were the src attribute of the video elements, which could be set at run time using the “deviceready” event of Cordova.

I have tested this on devices running Android 4.4 through to Android 5.1. So far so good. On older devices with Android versions prior to 4.4, I have tested this same method using Crosswalk API. I hope you find this information useful.

 

A simple checklist before updating your Android ROM

Initial Backup

  • Phone calls history
  • Messages history
  • Backup contacts (if not already in the cloud)
  • Write down backup authentication code for two-factor authentication of Google account

Pre-flash

  • Backup all apps (not Titanium backup)
  • Backup current ROM (Use Recovery mode)
  • Flash boot image

Let me know if there are others that I might be missing, but this is the checklist that I have used a number of times without any incident.

YouTube now streams HTML5 video

With YouTube now streaming HTML5 video, does it mean that Flash is dead? Well, whether or not Flash as a platform is dead, is debatable. One thing for sure, though, this move by YouTube, one of the biggest video content delivery system on the web will mean that it is now possible to disable or uninstall Flash player from one’s browser without experiencing a lot of inconvenience.

This move is definitely a positive one in light of all the security issues that Flash player has experienced. In the last year alone there have been multiple 0-day exploits being used by cyber criminals to install malware onto the computers of unwitting victims. From the computer security perspective, this means there is potentially one less vector for attack.

Hopefully this will mean that other video content providers on the web such as Facebook, Vimeo, Dailymotion and the others will follow suit and shift away from using proprietary technology to deliver their content. Without Flash, the web will have one less way of reaching into parts of your computer you don’t want it to.

It must be said, though, that the delivery of HTML5 video by YouTube is enabled by the use of the Widevine DRM plugin which is not in the spirit of the open source movement, but if I were to choose between Flash DRM and WideVine, I probably would choose Widevine as it is a compromise that Google had to make to appease content owners.

If you have been a long time Flash user, don’t be disheartened by the beginning of the demise of the platform that once had a claim of 95% install base. Flash is still a great tool for creating animations and it either will evolve new abilities (it partly has) to export to standards compliant open technologies or new tools will emerge. New Javascript animation tool anyone?