Google Analytics is a great tool for tracking metrics about how users are interacting with your Android applications.

It is so simple to set up that I highly recommend you use it in your Android development. In this tutorial, I describe how to set up and use Google Analytics for Android and HTML 5 Base Native Application.

Like Phonegap HTML5 mobile framework Using To Developing Android Application. For Build With Android Studio. Now I’ve gleaned from it.

Google Analytics setup

First, you must sign up to use Google Analytics through an existing Google account. Next, you must create an account for your application.

Select [Admin] Tab  for Administration Area  [Property]

By clicking drop-down box  –>Create new property
for New Property > What would you like to track?  Select [ Mobile apps ]
Setting up your property  > App Name. Here write your android application  name

how to add Google Analytics Android Apps & Native Application 1

set up with Android Studio

Now In order to set up Google Analytics inside your Android application, download the zip file for Android. Extract the file once it downloads and copy the jar file inside into the lib folder of your Android project.

(If a lib folder does not already exist, simply create one.) Now, I need the java build path. see here if you don’t know how to build path in android studio if you’re using Android Studio, follow these steps:

  • Select  File -> Project structure -> Modules -> Sources -> Add content root

how to add Google Analytics Android Apps & Native Application 2

Updating AndroidManifest.xml

Next, add the following permissions to your application’s Manifest.xml file:
 < android:name="android.permission.INTERNET" />
 < android:name="android.permission.ACCESS_NETWORK_STATE" />

Adding EasyTracker methods

Add the send methods to the onStart() and onStop() methods of each of your Activities. Creat a class file.

select [src] folder right-click New > Java Class . Copy & Past Blow Flowing Code  as in the following example:

* Created by bijoy .
public class myTrackedActivity extends Activity {
public void onStart() {
public void onStop() {

Creating your analytics.xml file

When you use EasyTracker, global configuration settings are managed using resources defined in XML.

Create a file called analytics.xml in your project’s res/values directory and add the following resources code in analytics.xml file :

how to add Google Analytics Android Apps & Native Application 3

Now that your project is set up to start using Google Analytics. Doing so will prevent you from seeing any data in your reports.

Affiliate Disclaimer : As an Amazon Associate I earn from qualifying purchases.