<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Gideon Dsouza - android</title><link>http://www.gideondsouza.com:80/Tags/android</link><description>Gideon Dsouza - android</description><item><title>Time Predict</title><link>http://www.gideondsouza.com:80/blog/time-predict</link><description>&lt;p&gt;Time Predict is finally out! I've been working on it for sometime now and bothering my friends and colleagues to test it out for me.&lt;/p&gt;

&lt;p&gt;It's a simple application I wrote, pretty much a port of http://easyclock.appspot.com/ but it's &lt;strong&gt;on Android&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This app came more out of a need I myself had. Hopefully it will be useful to other people too.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://play.google.com/store/apps/details?id=com.gideondsouza.timepredict"&gt;&lt;img src="http://www.gideondsouza.com/Media/Default/BlogPost/blog/ice_pi_cropped.png" alt="Time Predict Screenie"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://play.google.com/store/apps/details?id=com.gideondsouza.timepredict"&gt;Get it from the market here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm very open to any Comments and Suggestions :)&lt;/p&gt;
</description><pubDate>Sun, 24 Jun 2012 13:15:00 GMT</pubDate><guid isPermaLink="true">http://www.gideondsouza.com:80/blog/time-predict</guid></item><item><title>How to get the current location, address and send it to a server on android</title><link>http://www.gideondsouza.com:80/blog/how-to-get-the-current-location-address-and-send-it-to-a-server-on-android</link><description>&lt;p&gt;Location, Location, Location! Well this article isn't all about location.&lt;/p&gt;

&lt;p&gt;Things I will cover in this article:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Get the location of the users device (via the NETWORK). This will be latitude and longitude.&lt;/li&gt;
&lt;li&gt;Reverse-Geo code information from the first step and get an address&lt;/li&gt;
&lt;li&gt;Send that off to a server via Http GET. (This is typically what you would want to do given a location ;) )&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Getting a location&lt;/h3&gt;

&lt;p&gt;So first off, how do we get the users current latitude and longitude? There are two options (1) We could use the Network (2) Or the GPS. Somehow, getting a location from the network is quite accurate (I tested it a couple times) and it's fairly fast. Getting a location from the GPS then isn't too difficult.&lt;/p&gt;

&lt;p&gt;So in a default Android application you would want to add the following permission in your AndroidManifest.xml :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is if you're using the network, to use the GPS you would need:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I have an &lt;code&gt;AddressActivity.java&lt;/code&gt; and a &lt;code&gt;main.xml&lt;/code&gt;. My view looks like this:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://www.gideondsouza.com/Media/Default/BlogPost/blog/eclipse_mainxml_Design.JPG" alt="main.xml design view"&gt;&lt;/p&gt;

&lt;p&gt;The first button gets my location and the code is below. This is pretty straightforward and the snippet is plagiarized straight from the &lt;a href="http://developer.android.com/guide/topics/location/obtaining-user-location.html"&gt;Android docs here&lt;/a&gt;. I have two activity level variables &lt;code&gt;lat&lt;/code&gt; and &lt;code&gt;lon&lt;/code&gt;, I store the locations here so I can use them later.&lt;/p&gt;

&lt;script src="https://gist.github.com/2864370.js"&gt; &lt;/script&gt;

&lt;p&gt;To get a location from the GPS you would just change this line:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;To:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Getting an Address&lt;/h3&gt;

&lt;p&gt;The magic for reverse geo-coding comes from the &lt;a href="http://developer.android.com/reference/android/location/Geocoder.html"&gt;Geocoder class&lt;/a&gt;.  You would need the Internet permission in your manifest and this results in an internet call. &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;uses-permission android:name="android.permission.INTERNET"/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I encapsulate all my geocoder stuff into a &lt;code&gt;GetAddress()&lt;/code&gt; function which I call from my &lt;code&gt;btnAddress&lt;/code&gt;. It looks like this:&lt;/p&gt;

&lt;script src="https://gist.github.com/2864432.js"&gt; &lt;/script&gt;

&lt;h3&gt;Send to the Internet&lt;/h3&gt;

&lt;p&gt;Now typically when you get this far, you want to send this information off to your server somewhere and then do something useful with it. So the last function &lt;code&gt;postData()&lt;/code&gt; sends a latitude and longitude to my server. I made little dummy program on AppHabour in ASP.NET-MVC3. It sends the data via GET through a URL.&lt;/p&gt;

&lt;p&gt;No doubt you need the INTERNET permission as I described earlier. The code looks like this:&lt;/p&gt;

&lt;script src="https://gist.github.com/2864460.js"&gt; &lt;/script&gt;

&lt;p&gt;And there you have it! &lt;/p&gt;

&lt;p&gt;You can &lt;a href="http://www.gideondsouza.com/Media/Default/Misc/AndroidAddressApp.zip"&gt;download a fully runnable project of all this code from here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Hopefully soon I will use an AsyncTask to wrap up all of this code, so it happens asynchronously.  &lt;/p&gt;
</description><pubDate>Sun, 03 Jun 2012 18:24:23 GMT</pubDate><guid isPermaLink="true">http://www.gideondsouza.com:80/blog/how-to-get-the-current-location-address-and-send-it-to-a-server-on-android</guid></item><item><title>Android Sdk gives failed to fetch url http://dl-ssl.google.com/.../repository.xml</title><link>http://www.gideondsouza.com:80/blog/android-sdk-gives-failed-to-fetch-url</link><description>&lt;p&gt;Are you trying to update your Android-SDK and get:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;get the “Failed to fetch URL http://dl-ssl.google.com/android/repository/repository.xml” &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="http://stackoverflow.com/search?q=Failed+to+fetch+URL+http%3A%2F%2Fdl-ssl.google.com%2Fandroid%2Frepository%2Frepository.xml"&gt;Searching stackoverflow&lt;/a&gt; suggested an internet problem of some kind, but when I tried the URL in the browser itself it didn't work. &lt;/p&gt;

&lt;p&gt;Then I looked closer:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://www.gideondsouza.com/Media/Default/BlogPost/blog/Capture.JPG" alt="enter image description here"&gt;&lt;/p&gt;

&lt;p&gt;The SDK tools themselves have an update, so just select it and hit install.&lt;/p&gt;

&lt;p&gt;You'll land up with a new Android SDK Manager:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://www.gideondsouza.com/Media/Default/BlogPost/blog/newSDKMan.JPG" alt="enter image description here"&gt;&lt;/p&gt;

&lt;p&gt;Happy Coding! =)&lt;/p&gt;
</description><pubDate>Sat, 19 Nov 2011 07:16:01 GMT</pubDate><guid isPermaLink="true">http://www.gideondsouza.com:80/blog/android-sdk-gives-failed-to-fetch-url</guid></item><item><title>Windows Cannot Find Drivers - Setting up Android USB Debugging</title><link>http://www.gideondsouza.com:80/blog/windows-cannot-find-drivers-setting-up-android-usb-debugging</link><description>&lt;p&gt;So if you're trying to get Android USB debugging to work with your phone and it says:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Windows Cannot find Drivers&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Its probably a samsung phone? Yes?&lt;/p&gt;

&lt;p&gt;If it is then all you have to do it install &lt;a href="http://www.samsung.com/in/support/mobilesoftwaremanual/mobilesoftwaremanual.do?page=MOBILE.SOFTWARE.MANUAL"&gt;Samsung Kies&lt;/a&gt; and voila! You'll get everything up and running.&lt;/p&gt;

&lt;p&gt;If you're wondering how to &lt;strong&gt;debug a device on your phone&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make sure &lt;code&gt;USB Debugging&lt;/code&gt; on your phone is turned on (Mostly under &lt;code&gt;Settings&amp;gt;Applications&amp;gt;USB Debugging&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;(If you have a samsung phone install Samsung Kies)&lt;/li&gt;
&lt;li&gt;Connect your phone via USB&lt;/li&gt;
&lt;li&gt;In eclipse : Under the &lt;code&gt;Run Menu &amp;gt; Debug Congfigurations&lt;/code&gt; you should have a configuration under &lt;code&gt;Android Application&lt;/code&gt;, if you don't double click Android Application to create a new one.&lt;/li&gt;
&lt;li&gt;Select your configuration and then select the &lt;code&gt;Target Tab&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Choose &lt;code&gt;Manual&lt;/code&gt; then Click &lt;code&gt;Debug&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;You will be presented with a list of your connected devices and your virtual devices.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src="http://www.gideondsouza.com/Media/Default/BlogPost/blog/windows-cannot-find-drivers-setting-up-android-usb-debugging/androidUsbDebug.JPG" alt="enter image description here"&gt;&lt;/p&gt;

&lt;p&gt;Happy Android Programming!&lt;/p&gt;
</description><pubDate>Sun, 13 Nov 2011 08:56:45 GMT</pubDate><guid isPermaLink="true">http://www.gideondsouza.com:80/blog/windows-cannot-find-drivers-setting-up-android-usb-debugging</guid></item></channel></rss>