Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

October 27, 2011

Using Google Authentication - via AccountManager - to access Google services on Android devices

* Attention *      This is a Work in Progress (WiP)      *Attention *

This post will cover the use of AccountManager (available in Android 2.0 and onwards) to access Google Accounts online.

It is a research article I am putting together mainly for my own use but my preliminary research revealed very few postings on the net, so I thought I'd keep it available online, so that it is accessible to more people as well as being a note board for myself.

It is possible to authenticate Google Accounts using HTTP requests but this requires the user to supply the app with both username and password, which is neither comfortable or convenient for the user. Using Google Authentication it is possible to use information already stored in the Android device to authenticate towards Google services without the Application needing access to username or password.

And authentication handled by AccountManager is handled in a generic way regardless of application.

I am performing this research in order to use it in my own Apps, primarily Analytics 4 Android (Free), but  hopefully general application in your instance should be fairly easy. Please feel free to comment.

In this article I will be citing other works. I may/may not have asked for permission to do so, but I am hoping that if You are an author and/or publisher of any said works will treat them as fair use. I will try to provide adequate attribution and reference for any works used. If You feel that I am violating your copyright, please feel free to contact me on janholbo(at) gmail (d ot) com.


References:

  1. AccountManager (Android Reference material), http://developer.android.com/reference/android/accounts/AccountManager.html
  2. AndroidAccountManager (google-api-java-client), http://code.google.com/p/google-api-java-client/wiki/AndroidAccountManager
  3. Authenticating against App Engine from an Android app (Nick's Blog), http://blog.notdot.net/2010/05/Authenticating-against-App-Engine-from-an-Android-app

Links to be researched:

Other links:

August 28, 2011

Preview of Google TV Add-on for the Android SDK

Preview of Google TV Add-on for the Android SDK - http://pulse.me/s/1ifb4

April 20, 2010

Analytics4Android update - working on XML parser

This is a progress update for the Analytics4Android Google Analytics Widget project for Android Mobile phones.

Not much seems to have happened since the end of March when I last made an update public. I have had the (mis)fortune of having too little time for this project that tangible progress has emerged. I am - however - still working on this project although I have not had much time to do so.

At the moment I am working on the XML parser that is to parse both the Analytics profile feed and data feed. This is both a work-in-progress as well as a learning-in-progress situation for me as I have not written or parsed XML files much in the past. When the work has progressed further I hope to see two jumps in both the profile feed parser and data feed parser.

So although there is no update on the version number on the Analytics4Android web page, work is still under way!

April 12, 2010

Android Books

I just picked up Android Application Development from O'Reilly and Beginning Android from Apress from my local library. I reserved them some time in mid February but as my local library did not have any copies themselves, they had to get them from another library, thus the long wait.

Android Application Development has been written with the experienced (Java) Developer in mind. Thus you should read this, if You want an introduction to the development process in Android. The book starts with an overview of the Android development kit and shows how to setup the Android SDK as well as the Eclipse IDE on either Windows, Linux or Mac OS X. It also has a common project 'MicroJobs' that it builds most of it's chapters around.


Beginning Android does not require you to be an experienced developer but you do need a set of basic Java skills. It does not cover how to setup your development tools and abstracts from the development tools choice throughout the book.

I know these are not new books (May '09 for Android Application Development and June '09 for Beginning Android) and that they do not cover Android 2.x but 1) I am a beginner into this field and these two books will be the first two that I am going to read 2) My phone (a Nordic HTC Hero) at the moment runs Android 1.5. Hopefully HTC will release Android 2.1 for us Europeans! (c'mon, HTC, pretty please, please ;-)

I am going to write a (small) book review of both as I get through them!

Jan

PS. I know that Mark Murphy has written Beginning Android 2 as well and I will look into that as soon as possible. First I need to learn to crawl ;-)

March 28, 2010

Analytics4Android update - now at version 0.15

Analytics4Android is now up to version 0.15 and we are half way to the next mile stone. It can now retrieve the Analytics Account profile feed. Next task is to parse that feed.

UI development is on hold for now. I want to implement a tabbed UI and it is currently giving me a headache. Apparently it is a bug in eclipse and/or the Android SDK/ADT.

Tomorrow will be the start of the profile feed. All the data feeds are formatted as XML Atom feeds.

Analytics4Android is an Android Application/Widget that will display (excerpts from) Google Analytics data. It is currently under active development and is in alpha state. First beta release will be version 0.50.

March 17, 2010

Problems with Eclipse IDE, Android SDK hindering the development of Analytics 4 Android ...

I am currently experiencing problems that might have roots in problems with my Eclipse IDE and the installed Android SDK (which might actually have r4, not r5, for which Eclipse had downloaded its r5 parts).

So I have wasted valuable time trying to debug the new UI for Analytics 4 Android. So no real advancement on that front. I have downloaded and installed the new SDK r5 and Eclipse is now downloading and installing the new parts for this.

But I am seriously wondering, Should I just back up the important parts of my /home partition and then proceed to install the latest Lucid Lynx Alpha release ... It would have the advantage of getting rid of old files (the current installation has roots in 7.10 and has just been incrementally been upgraded).

So while I am working tonight I will be thinking about whether to wait for the first Beta or just jump straight in now.

Anyhow the Analytics 4 Android projects page is now online at kaddu.dk

Hope You have a good day!

March 04, 2010

Google Analytics Application/Widget for Android

Last Update:  March 17th, 2010 9:42 CET

I have started work on an Application/Widget that can retrieve and display data from Google Analytics, for mobile phones running on the Android platform.

This will be my first application and Widget for Android and as such it is both a learning as well as a production project as the outcome should be a usable Application/Widget.

As work is still in its very early stages and I need to research both Android development and how to use the Google Data API from Java/Android there is not much to show yet. I will put up an article on our web site, when there is more to show.

Update March 12th:
I now get an authorization token when providing my own correct google login. Failure is detected and parsed but not parsed properly and user is not informed. User info is probably going to be delayed - I'd rather try to get some data first ;-)

For progress/project status please look further down.

Update March 17th:
The past few days nothing (seems to have) happened. Partly due to other engagements, work etc. Partly because I started fiddling with the UI and that broke something, which I could not figure out. I have been writing a few lines of code which will be the start of managing Accounts and Profiles.

I have rethought the UI and the way the App/Widget will be set up, including the way it is set up in my IDE (Eclipse). I have also decided to change the name of the App/Widget, which was a working title anyway. Hopefully later today I will have put up a web page on the App/Widget with the new name. I will also change the way I update the info. So far I have just kept editing this post. From today I will make a new post with the changes only and then put the status on the web page. When the web page is ready, I will post the URL here.

Status: Version 0.10 - alpha state

Next mile stone: V. 0.20 - Account Query (request profiles)

To Do (anticipated version):

  • Authenticate user (V. 0.10 - DONE!)
  • Account Query (request profiles) (V. 0.20)
  • Report Query (V. 0.30)
  • Widget setup (V. 0.40)
  • Widget display (V. 0.50)

Progress:

March 12th, 2010
Version 0.10

  • Authentication of Google Analytics Account code
    • HttpRequest code based upon a post by Rich Stern : http://blog.richstern.com/?p=32
    • Google now authenticates my personal account and an authorization token is returned.
    • Still need to parse the HttpResponse properly
      • Determine response from Google (DONE)
      • Inform user of failure/success (showing dialog upon Authorization already)
      • Save authorization token on succes (DONE)
    • ... time to head for the second mile stone! Whoop!

March 12th, 2010
Version 0.05
  • Authentication of Google Analytics Account code
    • HttpRequest code based upon a post by Rich Stern : http://blog.richstern.com/?p=32
    • Google now authenticates my personal account and an authorization token is returned.
    • Still need to parse the HttpResponse properly
      • Determine response from Google (partly done)
      • Inform user of (possible) failure
      • Save authorization token on succes (DONE)
    • ... but I am half way to the first mile stone! Yay!
March 11th, 2010
Version 0.04
  • Authentication of Google Analytics Account code
    • based upen code from a post by Rich Stern : http://blog.richstern.com/?p=32
    • Google now authenticates my personal account and an authorization token is returned.
    • Still need to parse the HttpResponse properly
      • Determine response from Google
      • Inform user of (possible) failure
      • Save authorization token on succes
    • ... but I am almost half way to the first mile stone! Yay!
March 10th, 2010:
Version 0.03
  • code for reading UI contenst Username and Password added
  • Authentication of Google Analytics Account code started
March 4th, 2010:
Version 0.01
  • Project started.
  • UI for adding accounts started
  • No working code yet

January 08, 2010

Developing on Android - problems installing ADT

While trying to install the ADT on a Ubuntu 9.10 Karmic Koala using the Ubuntu Eclipse package I get the following errors trying to add ADT to Eclipse:

Cannot complete the install because one or more required items could not be found.
  Software being installed: Android Development Tools 0.9.5.v200911191123-20404 (com.android.ide.eclipse.adt.feature.group 0.9.5.v200911191123-20404)
  Missing requirement: Android Development Tools 0.9.5.v200911191123-20404 (com.android.ide.eclipse.adt.feature.group 0.9.5.v200911191123-20404) requires 'org.eclipse.gef 0.0.0' but it could not be found

Next step would be to remove Eclipse and reinstall it from a tarball I guess ....

Does anybody else got to this road-block and perhaps passed it?

December 27, 2009

Developing on Android

I've had an Android phone - the HTC Hero - for almost 3 weeks now and now I feel it is time to get to the next level - developing applications and widgets for this platform. That is why I chose to get an Android so I better get started on it.

This blog-entry is a place and thought holder for research, research plans and ideas for apps and widgets. It is primaryly for my own use and is put online so that I have access to it from different places. You are very welcome use and comment on it.

At a later stage I will put articles on my web site.

Android development can be done on several platforms including Windows, Linux and Mac.

My development platform is my laptop which is running Ubuntu (Linux) 9.10 Karmic Koala. I have to find an Integrated Development Environment (IDE), a Version Control System, the Android Source Development Kit. I also need to research the Android APIs.

Following the quick start guide at the Android Development web site the supported IDE is Eclipse version 3.4 and above. This ties in well with my choice of using Ubuntu 9.10 as it contains Eclipse 3.5 whereas Jaunty (9.04) contains only Eclipse 3.2.

First you have to install Eclipse and the lastest JDK.

... to be continued ...

... to be researched:
Android Development with Eclipse - Tutorial by Jack Vogel (Android 2.0 Eclipse 3.5)