Baccega Andrea Blog


The future is web3.0

Google Analytics Bridge for Android developers

author Posted by: veke87 on date ago 23rd, 2009 | filed Filed under: Programmazione

Google Analytics Bridge is a java library for android ( Soon to be Open Source licensed ) that will help developers understand what the user interaction with their own application.

Google Analytics Bridge is really easy to setup and it runs on a separate thread. This is do to the problem with the internet request sometime freezing the UI and setting off the hated message:

"The Application xyz is not responing"

With the two choises :

  1. Force Close
  2. Wait

Since The Google Analytics Bridge runs on a different thread to avoid this error.

First Setup

Download and import the jar file to the application you want use the Google Analytics Bridge on. The setup is a fast one-line command but you need the following information:

  • Google Analytics Tracking Code ( EX: "UA-123123123-1" )
  • The Domain Name

Set up a brand new Google Analytics Profile

you will need to set up a new Google Analytics Profile or use an existing one. You will need to open a new website profile on google analytics.

The procedure is fast and simple but it does require The domain name.

In that field you can specify whatever you want, but i suggest something like:

track.your-application-name.com

After creating the new profile, copy the UA-XXXXXX-Y code for a further usage.

The Constructor

Once you've done all of step one it's time to create our constructor.

In the onCreate routine place the following code:

JAVA:
  1. new AnalyticsBridge(this.getApplicationContext(),"UA-XXXXXX-Y","track.your-application-name.com");

You don't need to create an AnalyticsBridge object , after this line you will call the methods in a static way.

NOTE: You should call the constructor once per application lifetime.

Public Methods

_trackPageview(String pageTitle)

If you've some experience integrating google analytics on your own website you'll also remember what this method will do.

_trackPageview method on the web it's used for logging a new page View by the user. Similarly calling this static method on android will generate a google analytics request that will log a new Activity View.

Lets say you've a lot of activity, and some of theese will show the same content but in a different way, then i would put the following code on each onCreate Subroutine:

JAVA:
  1. /** Called when the activity is first created. */
  2. @Override
  3. public void onCreate(Bundle savedInstanceState) {
  4. super.onCreate(savedInstanceState);
  5. setContentView(R.layout.main);
  6.  
  7. AnalyticsBridge._trackPageview(this.getClass().getName());
  8.  
  9. }

This code will log each opened activity to google analytics.. Isn't it easy? :)

_trackEvent(String category, String action)

_trackEvent method is the same used on the web google analytics apis. I made this bridge because you should want to track some event made by the user.

Let suppouse you want to track a button click event on your user interface - this could help you understand how the user interact with your user interface - then you simply write the following statement on your View.OnClickListener implementation:

JAVA:
  1. Button loginbutton=new Button();
  2. loginbutton.setOnClickListener(new View.OnClickListener() {
  3.  
  4. @Override
  5. public void onClick(View v) {
  6. AnalyticsBridge._trackEvent("Click", "Login Button");
  7.  
  8. }
  9. });

That code will track the event of category "Click" and action "login Button".

Download:

Right now the library is quite stable . You can download it here

Thanks

Thanks to barakinflorida who corrected my bad english :)

Vodafone Widget Android

author Posted by: veke87 on date lug 17th, 2009 | filed Filed under: Programmazione

vodafoneWidgetBitberzerkir sul forum di androidiani, e in seguito integrato con nuove funzionalità ( per ora ancora in beta ) da Andrea Baccega ( me ).

Il programma lo potete scaricare direttamente dal market e per ora suppora la visualizzazione di tre widges :

  • Infinity Sms
  • Traffico Resituo
  • Iphone DataPack

Vediamo un attimo più in dettaglio queste funzionalità

Infinity Sms

Il widget degli infinity sms per android è un widget rosso diviso in 3 righe:

  • Titolo : La dicitura "Infinity Sms"
  • Residuo : mosta gli sms inviati confronto al massimo inviabile giornalmente
  • Tempo : mostra l'ora di aggiornamento del widget

Questo widget è utilissimo per coloro che fanno un uso veramente massiccio degli sms, e quindi averlo sott'occhio può aiutarvi a non sforare la soglia giornaliera :)

Read more »

wordpress seo