<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jappit.com &#187; geotagging</title>
	<atom:link href="http://www.jappit.com/blog/tag/geotagging/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jappit.com/blog</link>
	<description>Mobile blog by Alessandro La Rosa</description>
	<lastBuildDate>Wed, 23 Nov 2011 10:38:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>FliKun: KuneriLite based FlashLite photo uploader for Flickr</title>
		<link>http://www.jappit.com/blog/2008/06/25/flikun-kunerilite-based-flashlite-photo-uploader-for-flickr/</link>
		<comments>http://www.jappit.com/blog/2008/06/25/flikun-kunerilite-based-flashlite-photo-uploader-for-flickr/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 12:02:35 +0000</pubDate>
		<dc:creator>pit</dc:creator>
				<category><![CDATA[cool stuff]]></category>
		<category><![CDATA[flash lite]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[nokia]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[geotagging]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[image thumbs]]></category>
		<category><![CDATA[kunerilite]]></category>
		<category><![CDATA[rest api]]></category>

		<guid isPermaLink="false">http://www.jappit.com/blog/?p=54</guid>
		<description><![CDATA[Today, we&#8217;ll see how it&#8217;s possible to build a Flickr uploader in FlashLite using KuneriLite, geotagging our photos with the current GPS location. You can download the current FliKun version (for FlashLite 3.0) here: FliKun_3rd_edition_unsigned.sis (please read the notes at the end of this article). So, let&#8217;s start from the beginning. Flickr API To upload [...]]]></description>
			<content:encoded><![CDATA[<p>Today, we&#8217;ll see how it&#8217;s possible to build a <strong><a title="Flickr uploader" href="http://www.flickr.com/" target="_blank">Flickr</a> uploader in <a title="FlashLite website" href="http://www.adobe.com/products/flashlite/" target="_blank">FlashLite</a> using <a title="KuneriLite website" href="http://www.kunerilite.net/" target="_blank">KuneriLite</a></strong>, geotagging our photos with the current <strong>GPS location</strong>.</p>
<p>You can download the current <strong>FliKun</strong> version (for FlashLite 3.0) here: <a title="FliKun Flash Lite Flickr uploader" href="http://www.jappit.com/uploads/kunerilite/FliKun_3rd_edition_unsigned.sis">FliKun_3rd_edition_unsigned.sis</a> (<em>please read the notes at the end of this article</em>).</p>
<p><img src="http://www.jappit.com/images/blog/uploads/flikun.jpg" alt="Flikun Screenshots" width="480" height="213" /></p>
<p>So, let&#8217;s start from the beginning.</p>
<h3>Flickr API</h3>
<p>To upload photos to Flickr we&#8217;ll need to use <a title="Flickr API" href="http://www.flickr.com/services/api/" target="_blank">Flickr API</a>: this way we&#8217;ll be able to <strong>authenticate the user</strong> and <strong>upload/geotag photos</strong> using its REST services, all from within our application.</p>
<p>First thing we should do is to setup an <strong>API key</strong> for our service, going on the <a title="Flickr API key request page" href="http://www.flickr.com/services/api/keys/apply/" target="_blank">request page</a>. Here you have to fill out the <strong>application details</strong>, with special care to the authentication method we want to use: suitable choices for our needs would be both <a title="Flickr Desktop authentication" href="http://www.flickr.com/services/api/auth.howto.desktop.html" target="_blank"><strong>desktop</strong></a> and <a title="Flickr mobile application authentication" href="http://www.flickr.com/services/api/auth.howto.mobile.html" target="_blank"><strong>mobile application</strong></a> authentications:</p>
<ul>
<li>With the first option the user will be redirected to a Flickr page, from within our application, where he should authenticate and <strong>grant necessary permissions</strong> to our application.</li>
<li>With the second option we can let the user generate a <strong>mini-token</strong> from a dedicated page, using his desktop browser, and then tell him to insert this mini-token within in our application.</li>
</ul>
<p>In both cases, we will get a <strong>token</strong> that will be used for all future uses of our application, so there would be no more need to authenticate the user after the first time.</p>
<h3>KuneriLite Plugins</h3>
<p>In our application, we will need to access these <strong>functionalities</strong>:</p>
<ul>
<li><strong>Retrieve photos</strong> stored in phone&#8217;s gallery</li>
<li><strong>Make thumbs</strong> to show them in our application</li>
<li><strong>Start the GPS</strong> and retrieve user&#8217;s current location</li>
<li><strong>Upload</strong> stored photo on Flickr server</li>
</ul>
<p>So, we&#8217;ll need to use the following <strong>KuneriLite plugins</strong>:</p>
<ul>
<li><a title="KuneriLite GPS plugin" href="http://wiki.kunerilite.net/index.php?title=GPS_plugin" target="_blank">GPS</a>: we&#8217;ll use the <strong>start</strong> command to start GPS, and the <strong>read</strong> command to read current location</li>
<li><a title="KuneriLite File plugin" href="http://wiki.kunerilite.net/index.php?title=File_plugin" target="_blank">File</a>: with <strong>dir</strong> command we&#8217;ll be able to list files in phone&#8217;s gallery folders. We&#8217;ll use this also to store textual infos, like the user token</li>
<li><a title="KuneriLite Upload/Download plugin" href="http://wiki.kunerilite.net/index.php?title=Upload/Download_plugin" target="_blank">Upload/Download</a>: with this plugin we&#8217;ll <strong>upload</strong> the photos to Flickr website, using its API, and create the thumbs (with the <strong>resize</strong> command) to show them within our application</li>
</ul>
<h3>Get a token</h3>
<p>We&#8217;ll use the <strong>desktop authentication method</strong>, so these are the steps required to authenticate the user, and to get his token:</p>
<ul>
<li>Get a <strong>frob</strong>, with the Flickr <strong>flickr.auth.getFrob</strong> method</li>
<li>Generate the desktop <strong>authentication URL</strong> with the given frob</li>
<li>Send the user to the generated URL, using the <strong>phone browser</strong>, where he should authenticate and grand permissions to our application</li>
<li>When the user is back to our application, we will finally get his authentication <strong>token</strong> with the <strong>flickr.auth.getToken</strong> Flickr method</li>
</ul>
<p>All these Flickr API calls need to be signed with an api_sig parameter, that is explained here: <a title="Flickr authentication API page" href="http://www.flickr.com/services/api/auth.spec.html" target="_blank">Flickr Authentication API page</a> (in the <strong>Signing</strong> paragraph). To generate it in our FlashLite application, we&#8217;ll use the following function:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">function getApiSignature<span style="color: #009900;">&#40;</span>args<span style="color: #339933;">:</span><span style="color: #003399;">Object</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	var authSig<span style="color: #339933;">:</span><span style="color: #003399;">Array</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>var key<span style="color: #339933;">:</span><span style="color: #003399;">String</span> in args<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		authSig.<span style="color: #006633;">push</span><span style="color: #009900;">&#40;</span>key <span style="color: #339933;">+</span> args<span style="color: #009900;">&#91;</span>key<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	authSig <span style="color: #339933;">=</span> authSig.<span style="color: #006633;">sort</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	var apiSig<span style="color: #339933;">:</span><span style="color: #003399;">String</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">this</span>._md5.<span style="color: #006633;">hash</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">&lt;</span>API_SECRET<span style="color: #339933;">&gt;</span> <span style="color: #339933;">+</span> authSig.<span style="color: #006633;">join</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">return</span> apiSig<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>where &lt;API_SECRET&gt; is the <strong>API Secret associated to your API Key</strong> (you can see both of them on <a title="Flickr API keys" href="http://www.flickr.com/services/api/keys/" target="_blank">Flickr API Keys page</a>).</p>
<p>If all has gone well, we will finally get the user token, that we must store somewhere (for example using SharedObject, or within a local file using KuneriLite file plugin).</p>
<h3>Show phone gallery photos</h3>
<p>Since we&#8217;ll use <strong>S60 3rd edition phones</strong>, we&#8217;ll search for photos in these folders: &#8220;<em>C:\Data\Images\&#8221;</em> and <em>&#8220;E:\Images\&#8221;</em>. Since on these phones photos will be stored in many <strong>subfolders</strong>, we&#8217;ll search within them, using &#8220;/s&#8221; argument within KuneriLite <strong>dir</strong> call. Also, we should <strong>avoid listing photo thumbs</strong>, that are stored<br />
in subfolders named &#8220;_PAlbTN&#8221;, so it&#8217;ll be easy to spot out and avoid to get them.</p>
<p>Once we have the photo paths, we can use the KuneriLite resize <strong>command</strong> to resize them to our <strong>preferred size</strong>, and use those thumbs within our application. In doing this, we should care for the following points:</p>
<ul>
<li>It&#8217;s <strong>not possible to load more than 5 resources at once</strong>, so we should generate and load thumbs in a progressive manner, otherwise we will have lost calls (without any feedback or exception) within our application</li>
<li>While loading a thumb in a MovieClip, we should take care <strong>not to remove the Clip while it&#8217;s loading</strong> (for example, because the user has navigated to another screen). Doing this we&#8217;ll avoid the issue described <a title="FlashLite moviecliploader issue" href="http://www.jappit.com/blog/2008/04/23/flashlite-and-moviecliploader-loadclip-issue/" target="_blank">here</a>.</li>
</ul>
<h3>Enter photo details and upload it!</h3>
<p>Once the user has selected a photo, we should let him <strong>enter photo data (title, description and tags)</strong>, and then let him choose if he wants to <strong>tag with his location the photo itself</strong>.</p>
<p>In this case, we can use the approach described in this other article to <strong>retrieve the current GPS location</strong>: <a title="displaying gps position in flashlite using google static maps and kunerilite" href="http://www.jappit.com/blog/2008/06/12/displaying-gps-position-in-flashlite-using-google-static-maps-and-kunerilite/" target="_blank">Displaying gps position in flashlite using google static maps and kunerilite</a>.</p>
<p>Once we have the GPS location coordinates, we can finally upload the photo to Flickr website with the <a title="Flickr Upload API" href="http://www.flickr.com/services/api/upload.api.html" target="_blank">upload API</a>. Since the upload API itself requires, apart from the file itself, to send the <strong>other params within the POST body</strong>, we should use some sort of <strong>server proxy</strong>, since KuneriLite <strong>upload</strong> command does not allow to post them this way. What we could do is to send the textual parameters within the upload URL, and then let our proxy POST them to Flickr server.</p>
<h3>Get FliKun!</h3>
<p>This <strong>first release </strong>of <strong>FliKun</strong> is very (very!) alpha, so try it at your own risk <img src='http://www.jappit.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  jokes apart, there are still many points open (like the <strong>horrible graphics</strong>!), so expect new versions as soon as I&#8217;ve got the time to work more on it!</p>
<p>Download <a title="Flikun Alpha version" href="http://www.jappit.com/uploads/kunerilite/FliKun_3rd_edition_unsigned.sis" target="_blank">FliKun_3rd_edition_unsigned.sis</a> (for FlashLite 3.0).</p>
<p>Currently known issues/bugs are:</p>
<ul>
<li><span style="text-decoration: line-through;">Sometimes upload fails, especially when using some special characters</span></li>
<li>There is no upload progress bar (but will be added very soon)</li>
<li>File upload fails (with error code -4) when photo size is bigger than approx 450 Kb (I&#8217;m <strong>currently working to solve this</strong>)</li>
</ul>
<p>For any other bugs you may encounter, please leave comment on this post! Thanks <img src='http://www.jappit.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Finally note that, to use the <strong>GPS</strong> feature, you&#8217;ll need to <strong>sign the SIS file with a valid certificate</strong>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jappit.com/blog/2008/06/25/flikun-kunerilite-based-flashlite-photo-uploader-for-flickr/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

