Archiv for November, 2009


published: November 3rd, 2009

Is GPS on? If not prompt user to turn it on.

Here’s a quick code snippet to determine if the GPS is on, and if it isn’t go to the Setting screen allowing the user to turn it on.  Android does not allow a 3rd party app to automatically turn the GPS on/off as of 1.5, a “feature” discussed extensively on the Android Developers Forum.

(more…)

published: November 3rd, 2009

New Version of MediaDroid and Message Drop up on Android Market

I posted a new version of both MediaDroid and Message Drop to the Android Market this morning.

The new version of MediaDroid fixes the reboot bug.  It’s not as elegant as a fix as I’d like but it does work.  FYI to any developers, the SD Card isn’t necessarily mounted when the ACTION_BOOT_COMPLETED event is broadcast.  I used a CountDownTimer to wait 30 seconds after my BroadcastReceiver is called, then I’m able to access the files on the SD Card.

I added a couple features to Message Drop and fixed a few bugs.  The new features are spelled out on the Message Drop page  and include a new Setting for assigning the “Blank Tag” and a mode helping you build bulleted item lists.

My plan is to switch back to MediaDroid and perform some much needed polishing, and I ran into a Force Close that I haven’t been able to track down yet.  Always more to do!

published: November 2nd, 2009

Searching for phone numbers with Android

I’ve been playing around with searching for contacts on the Android platform and thought I’d pass along a couple things I’ve learned.

One thing I’ve found out is that some of the classes from the books I’ve been using as reference have been deprecated.  Apparently, instead of using People.NUMBER, which has been deprecated for future support of multiple accounts, I should use the ContactsContact set of interfaces to get the contacts name and number.  Guess I’ll be upgrading to the Android 2.0 sdk sooner then I thought.  Although according to this forum thread the previous interfaces used to specify contact column, such as People, are still supported and will access contact information from the “primary” account.

Another cool thing I figured out was how to have the phone pad soft keyboard attached to an EditText widget.

device.png

It’s one of those, it was so easy I’m ashamed I didn’t know it, but then again, the SDK is large enough to where it’s hard to know ALL of it.  Anyway, all you need to do is define the “inputType” attribute value for the EditText widget which captures the phone number.

   	<EditText android:id="@+id/phone_nbr"
		android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:inputType="phone"
		android:singleLine="true" />

Now, when the phone_nbr EditText box is entered, the phone pad comes up for data entry instead of the default Android soft keyboard.

There’s still many aspects of the Contacts API I haven’t investigated yet, but hopefully with the new apps I have the opportunity to work on, I’ll have lots of time to learn more about them.