{"id":831,"date":"2009-08-13T21:53:11","date_gmt":"2009-08-13T21:53:11","guid":{"rendered":"http:\/\/dalelane.co.uk\/blog\/?p=831"},"modified":"2009-08-13T22:14:34","modified_gmt":"2009-08-13T22:14:34","slug":"a-fire-eagle-updater-for-windows-mobile","status":"publish","type":"post","link":"https:\/\/dalelane.co.uk\/blog\/?p=831","title":{"rendered":"A Fire Eagle updater for Windows Mobile"},"content":{"rendered":"<p><img decoding=\"async\" style=\"border: thin black solid\" src=\"http:\/\/i267.photobucket.com\/albums\/ii311\/dale_lane\/090813-bladelocate.gif\" vspace=\"10\" hspace=\"10\" align=\"left\"\/>I wrote a <a href=\"http:\/\/dalelane.co.uk\/blog\/?p=667\">Fire Eagle web service<\/a> at <a href=\"http:\/\/openhacklondon.pbworks.com\/\" target=\"_blank\">Open Hack London<\/a> a few months ago &#8211; that gave a nice, mobile-friendly way to share your current location, as stored in <a href=\"http:\/\/fireeagle.yahoo.net\/\" target=\"_blank\">Fire Eagle<\/a>.<\/p>\n<p>Last week, I finally got round to updating my <a href=\"http:\/\/feguestpass.appspot.com\/\" target=\"_blank\">Fire Eagle Guest Pass<\/a> web service to use the newer <a href=\"http:\/\/oauth.net\/core\/1.0a\" target=\"_blank\">OAuth 1.0a<\/a>. <\/p>\n<p>This got me thinking that I haven&#8217;t used it very much since writing it in May&#8230; because while it let me share where Fire Eagle thinks I am, I didn&#8217;t have an easy mobile-friendly way to tell Fire Eagle where I am in the first place! \ud83d\ude42<\/p>\n<p>So while I had &#8220;how to do OAuth&#8221; fresh in my mind, I thought I&#8217;d start writing a quick mobile Fire Eagle client.<\/p>\n<p>I wrote it in C# for Windows Mobile. There are a few interesting points in the code that deserve their own blog posts, but first I wanted to quickly show what I&#8217;ve got working so far.<\/p>\n<p><!--more--><strong>Updating your location<\/strong><\/p>\n<p>The <a href=\"http:\/\/fireeagle.yahoo.net\/developer\" target=\"_blank\">Fire Eagle API<\/a> provides a <a href=\"http:\/\/fireeagle.yahoo.net\/developer\/explorer\/0.1\/update\" target=\"_blank\">variety of ways to update your location<\/a>. <\/p>\n<p>I&#8217;ve tried to use a few of them in my mobile app:<\/p>\n<p><img decoding=\"async\" style=\"border: thin black solid\" src=\"http:\/\/i267.photobucket.com\/albums\/ii311\/dale_lane\/090813-bladelocate-cellid.gif\" vspace=\"10\" hspace=\"10\" align=\"right\"\/>Uploading the Cell ID of the GSM tower your phone is connected to. <\/p>\n<p>The accuracy of this is going to be variable, but it has several benefits such as not putting a big drain on the battery and working even when you are indoors.<\/p>\n<p>Unfortunately, Yahoo!&#8217;s database of UK cell ids seems very limited, but even so, it&#8217;s a neat approach.<br \/>\n<br clear=\"all\"\/><br \/>\n<img decoding=\"async\" style=\"border: thin black solid\" src=\"http:\/\/i267.photobucket.com\/albums\/ii311\/dale_lane\/090813-bladelocate-gps.gif\" vspace=\"10\" hspace=\"10\" align=\"left\"\/>Uploading the phone&#8217;s latitude and longitude taken from a GPS unit. <\/p>\n<p>It&#8217;s the most obvious approach, and probably the most accurate in many cases. <\/p>\n<p>But it&#8217;s a battery hog, and needs you to be outdoors and relatively stationary for it to work.<br \/>\n<br clear=\"all\"\/><br \/>\n<img decoding=\"async\" style=\"border: thin black solid\" src=\"http:\/\/i267.photobucket.com\/albums\/ii311\/dale_lane\/090813-bladelocate-address.gif\" vspace=\"10\" hspace=\"10\" align=\"right\"\/>If all else fails, you can manually enter all, or part, of an address. <\/p>\n<p>If you know the postcode of where you are, this is a fairly quick and easy way of updating Fire Eagle.<br \/>\n<br clear=\"all\"\/><br \/>\n<img decoding=\"async\" style=\"border: thin black solid\" src=\"http:\/\/i267.photobucket.com\/albums\/ii311\/dale_lane\/090813-bladelocate-free.gif\" vspace=\"10\" hspace=\"10\" align=\"left\"\/>You can even just enter any free text, and let <a href=\"http:\/\/developer.yahoo.com\/geo\/\" target=\"_blank\">Yahoo&#8217;s Geo API<\/a> try and identify the place that you mean.<br \/>\n<br clear=\"all\"\/><br \/>\n<img decoding=\"async\" style=\"border: thin black solid\" src=\"http:\/\/i267.photobucket.com\/albums\/ii311\/dale_lane\/090813-bladelocate-calendar.gif\" vspace=\"10\" hspace=\"10\" align=\"right\"\/>Finally, I&#8217;ve also added the ability to grab the location out of the current appointment in your mobile&#8217;s calendar. <\/p>\n<p>Again, this relies on Yahoo&#8217;s GeoPlanet stuff to try and parse this into an actual place.<\/p>\n<p><br clear=\"all\"\/><br \/>\n<img decoding=\"async\" style=\"border: thin black solid\" src=\"http:\/\/i267.photobucket.com\/albums\/ii311\/dale_lane\/090813-bladelocate-guestpass.gif\" vspace=\"10\" hspace=\"10\" align=\"left\"\/>I&#8217;ve also embedded my <a href=\"http:\/\/feguestpass.appspot.com\/\">Guest Pass page<\/a> in the app so you can share your location once you&#8217;ve updated it. <\/p>\n<p>Once I&#8217;ve figured out how to <a href=\"http:\/\/dalelane.co.uk\/blog\/?p=303\">authenticate with Google App Engine<\/a> from C#, I&#8217;ll do this properly from the app rather than embedding a webpage. <\/p>\n<p>But this will do for now.<br \/>\n<br clear=\"all\"\/><a name=\"oauth\"><\/a><br \/>\n<strong>Authenticating with OAuth<\/strong><\/p>\n<p>Since the <a href=\"http:\/\/blog.oauth.net\/2009\/04\/22\/acknowledgement-of-the-oauth-security-issue\/\" target=\"_blank\">security threat identified in OAuth last April<\/a>, OAuth providers have got even more cautious, and the updated OAuth protocol is even more burdensome than before. <\/p>\n<p>It&#8217;s clunky, but to authenticate my app (without giving me your Yahoo! username and password) I&#8217;ve had to do the following:<\/p>\n<p><img decoding=\"async\" style=\"border: thin black solid\" src=\"http:\/\/i267.photobucket.com\/albums\/ii311\/dale_lane\/090813-bladelocate-authstart.gif\" vspace=\"10\" hspace=\"10\" align=\"left\"\/>First off, the app needs to send a request to the Yahoo! servers. Tapping on the button kicks this off.<br \/>\n<br clear=\"all\"\/><br \/>\n<img decoding=\"async\" style=\"border: thin black solid\" src=\"http:\/\/i267.photobucket.com\/albums\/ii311\/dale_lane\/090813-bladelocate-authtoken.gif\" vspace=\"10\" hspace=\"10\" align=\"right\"\/>This gets you a token string which needs to be entered into an authorization page on the Fire Eagle website.<\/p>\n<p>To make this a little easier, the token string is copied into the phone&#8217;s clipboard, and a button is displayed to launch the authorization web page in your mobile&#8217;s default browser.<br \/>\n<br clear=\"all\"\/><br \/>\n<img decoding=\"async\" style=\"border: thin black solid\" src=\"http:\/\/i267.photobucket.com\/albums\/ii311\/dale_lane\/090813-bladelocate-auth-ieauth.gif\" vspace=\"10\" hspace=\"10\" align=\"left\"\/>The user needs to paste the code into the text box and tap Confirm.<br \/>\n<br clear=\"all\"\/><br \/>\n<img decoding=\"async\" style=\"border: thin black solid\" src=\"http:\/\/i267.photobucket.com\/albums\/ii311\/dale_lane\/090813-bladelocate-auth-ieverify.gif\" vspace=\"10\" hspace=\"10\" align=\"right\"\/>This takes you to a verification web page displaying a verify code. <\/p>\n<p>The user needs to copy this code.<br \/>\n<br clear=\"all\"\/><br \/>\n<img decoding=\"async\" style=\"border: thin black solid\" src=\"http:\/\/i267.photobucket.com\/albums\/ii311\/dale_lane\/090813-bladelocate-authverify.gif\" vspace=\"10\" hspace=\"10\" align=\"left\"\/>This code needs to be pasted into the text box. <\/p>\n<p>The process is then completed by tapping the final &#8220;Complete Authentication&#8221; button.<br \/>\n<br clear=\"all\"\/><br \/>\n<img decoding=\"async\" style=\"border: thin black solid\" src=\"http:\/\/i267.photobucket.com\/albums\/ii311\/dale_lane\/090813-bladelocate-authcomplete.gif\" vspace=\"10\" hspace=\"10\" align=\"right\"\/>Job done. <\/p>\n<p>The user is authenticated, and the tokens are stored so that the user doesn&#8217;t have to go through this again.<br \/>\n<br clear=\"all\"\/><a name=\"oauthugh\"><\/a><br \/>\n<strong>Ugh<\/strong><\/p>\n<p>I know that the <a href=\"http:\/\/www.google.co.uk\/search?q=password+anti-pattern\" target=\"_blank\">password anti-pattern<\/a> is &#8220;a bad thing&#8221;. Asking for a user&#8217;s password on another service isn&#8217;t good. <\/p>\n<p>But how much simpler would this authentication be if I could just show the user a couple of text boxes &#8211; one for a username and one for a password? <\/p>\n<p>Because as user experiences go, this is fairly icky. <\/p>\n<p>(It was fairly icky to code, as well!)<\/p>\n<p>I know the GUI needs a little work &#8211; what I&#8217;ve got is a quick-and-dirty first implementation to get the underlying OAuth client code working. And the GUI could do more to walk the user through it. <\/p>\n<p>But even so&#8230; the user still has to switch from app to web browser, copying a value across, navigate a website, then copy a different value switching back from web browser to app. This is going to be too convoluted for many users. <\/p>\n<p>Ah well, it was interesting to get to grips with the OAuth 1.0a protocol, and now I&#8217;ve got an easy way to update Fire Eagle on the move. <\/p>\n<p><strong>Download<\/strong><\/p>\n<p>If you would like a copy, <a href=\"http:\/\/dalelane.co.uk\/files\/bLADELocate.CAB\">download it here<\/a>.<\/p>\n<p>A few provisos:<\/p>\n<ul>\n<li>It&#8217;s for Windows Mobile 5 (or upwards)\n<\/li>\n<li>It&#8217;s for touchscreen devices only\n<\/li>\n<li>It needs .NET Compact Framework 2 (or greater) &#8211; this comes preinstalled on Windows Mobile 6, but on WM5 devices you need to go <a href=\"http:\/\/www.microsoft.com\/DownLoads\/details.aspx?familyid=9655156B-356B-4A2C-857C-E62F50AE9A55&#038;displaylang=en\" target=\"_blank\">get it yourself<\/a>\n<\/li>\n<li>It&#8217;s the work of a couple of evenings &#8211; this was me playing around with code. It&#8217;s not a polished or finished product &#8211; think of it as an alpha release.\n<\/li>\n<\/ul>\n<p>But if all that is okay with you, and you think you might find it useful, you are very welcome to have a copy.<\/p>\n<p>(And please do <a href=\"http:\/\/getsatisfaction.com\/dalelane\/products\/dalelane_blade_locate\" target=\"_blank\">let me know<\/a> how you get on with it!)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wrote a Fire Eagle web service at Open Hack London a few months ago &#8211; that gave a nice, mobile-friendly way to share your current location, as stored in Fire Eagle. Last week, I finally got round to updating my Fire Eagle Guest Pass web service to use the newer OAuth 1.0a. This got [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[142,46,19],"class_list":["post-831","post","type-post","status-publish","format-standard","hentry","category-code","tag-fire-eagle","tag-mobile","tag-windows-mobile"],"_links":{"self":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/831","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=831"}],"version-history":[{"count":0,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/831\/revisions"}],"wp:attachment":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=831"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=831"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}