Feb 25, 2013

Android Database

Seems the process to import an Android database isn't as simple as just dropping a SQLite database into your project. If the database doesn't reside in the "/data/data/<project name>/" directory, Android may have issues reading the database correctly. In addition, the primary key column names need to be "_id". Finally, there needs to be a table in the database that has some additional metadata:


CREATE TABLE "android_metadata" ("locale" TEXT DEFAULT 'en_US')
INSERT INTO "android_metadata" VALUES ('en_US')


What needs to be determined is how this will work in locales outside en_US.

Final thought is in regards to file size. It seems if you don't give the database a specific file extension, Android prior to 2.3 will not decompress assets in your APK if it is larger than 1MB. The 300k word dictionary looks to be about 6MB, so this would fall under that restriction. I'd have to rename it to something like "mp3", so that the android packaging tool will not try to compress it.

Note, copying the database over to the "/data/data" may only be necessary if the database is intended to be written - if the database is read-only, this may not be necessary. I'll need to investigate this further.

Helpful resources:



Feb 22, 2013

SQLite Foray

In getting started with using Android and local storage, the simplest and most recommended approach is to use the SQLite database. This is the same technology used for HTML5 local storage and has been around for quite awhile.

I was curious about the performance, so I ran a simple test: Query 280k text records (inserted via alphabetical order).

Before I get to the results, here is a tool to avoid that I used: SQLite Database Browser. The reasons are simple:

  1. It freezes on you if the syntax is invalid.
  2. Importing 260k+ records was going to take over an hour (compared to less than 5 seconds with the tool I ended up with)

The best tool I was able to find, which is also free, is SQLite Studio. The website looks a bit sketch. Maybe that's how they roll in Poland, or maybe after they steal my credit card information by installing a keyboard sniffer, they'll be able to give it a facelift.




Managed DNS

The idea of having this blog on Blogger with a name such as "ofieldstest" didn't sit so well with me, especially since I have a few years of my domain name paid for, sitting without a control panel, on bluehost.com. In looking around, what I found out I needed was a way to have someone else manage my DNS for me, since bluehost refuses (unless you want to pay for hosting, which I don't). Alas, there is a way to accomplish this. In essence, you'll need someone who has their own name server to host your DNS records for you.

I found the following, although there may be others. 
  • GoDaddy offers a service called Off-Site DNS, that allows you to manage DNS for a host registered with a different registrar (in my case, BlueHost). 
  • Seems NoIP will do something similar for free, although I haven't created an account and haven't confirmed this.
The only thing left now is to fix what is called a "naked domain", e.g. "http://favpix.com" (missing the "www."). I'll need to dig around some more to see how I can address this. Blogger did say "redirect all http://favpix.com/ requests to http://www.favpix.com", but as of now, that doesn't seem to be working.

In all, it took maybe an hour to track this information down including the email to BlueHost to confirm there was no way for me to manage the CNAMEs myself using their nameservers.



A better Android Crash reporting framework?

Haven't had time to dig into the details (the android apps I've published haven't crashed on me), so I cannot say with certainty this is worthwhile. The tool called Android Crash Reporting Application, or ACRA, (grab it on Github here https://github.com/ACRA/acra) does pretty much what the name says. It supposedly offers more details about the crash than what Google will provide by default. It'll post it to a Google Docs document. Not sure about the performance impact (does it wrap all of the code in a huge try/catch statement or does it read from a crash report).

More digging required.

JD GUI

Came across this gem. Rather than fire up eclipse (although it's running most of the time anyway), if you need to quickly view the decompiled java source, there's a free tool called JD-GUI. It's fairly small, offers search capabilities and is very fast. It accepts a class file or a jar file, which is very convenient.

Grab a copy here: http://java.decompiler.free.fr/?q=jdgui


Actionbar Sherlock

Came across this nifty library for Android. This will enable the elegant tab/icon UI present in Jelly Bean on older devices as far back as API v7(Android 2.x - which is over 99% of devices).

As of this posting, only 13% of Android devices are on Jelly Bean - which means dropping in this library to support Android 2.x device will help your app stand out from the pack.

Resources:

  1. Actionbar Sherlock http://actionbarsherlock.com/
  2. Android Usage by API Level: http://developer.android.com/about/dashboards/index.html 
  3. Download on Github https://github.com/JakeWharton/ActionBarSherlock

First Post - Getting Started

First post of the new blog. Looks similar to Google Docs. Would like to know how to add a thumbnail - presumably dragging and dropping will work.