Thursday, January 12, 2012

Location

I just quite didn't have time to post about yesterday's update and there's a bit of an overlap with the changes for today.  Yesterday's changes were some bugs reported by users.

The first one had to do with setting the Music button.  Apparently the ROM he's using has two different versions of Google Music installed.  It didn't matter which one he picked from the list, it always launched the older one.  I just had to adjust how I was finding and saving the intent.  While I'm thinking about the music button, over the life of Desk Clock Plus, there have a been a number of people who have emailed and said that music play {insert app here} doesn't show up in the list.  This has more to do with the other app than mine.  I'm trying to figure out what apps are registered to handle .MP3 files.


final String MP3_FILE = "/sdcard/media_api/music/SHORTMP3.mp3";
        Intent viewIntent = new Intent(Intent.ACTION_VIEW);
        Uri uri = Uri.fromParts("file", MP3_FILE, null);
        viewIntent.setDataAndType(uri, "audio/mp3");     
        Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
        pickIntent.putExtra(Intent.EXTRA_INTENT, viewIntent);    
        startActivityForResult(pickIntent, MUSICPICKER);  


If the app isn't registered with the system to "view" a mp3, it doesn't show up in the list.  If anyone has a better way of doing this please let me know.

The other one which once again was reported by a pair of users with HP Touchpads saying that the display was way off.  Basically, the font sizes needed to be shrunk down the size of the font and weather icon to make everything fit.  Part of the major redesign when version 1.0 was released, all of the sizes, heights and widths were moved into one XML file.  This allowed me to very easily change everything to fit on to the Thouchpad.  Unfortunately, I didn't shrink the weather enough and the High/Low temp degree mark was pushed off the edge.  That was fixed in today's update...

So, the big thing for today's update is major improvement to finding your location.  Previously, I was relying on the last known location.  If I loop though everything and nothing knows where you're at then I'm forcing the device to update it's location.  I'm not 100% I'm happy with how all this works and it will probably be reexamined in the future.  Also, as it turns out the feature to use the IP address for the location wasn't working anymore (the web service I was using went away).  Fortunately, Yahoo had a replacement that I was able to use instead.

Finally, I also updated the "Immediate" time out to be more immediate.  As pointed out by Omniwolf in the comments, it was a little confusing / misleading.

Unless something comes up, I'm going to start on the static location tomorrow... Given the the changes I've made yesterday, I don't think that it's going to take me very long.