Subversion Repositories SmartDukaan

Rev

Rev 14991 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14991 Rev 16278
Line 1... Line 1...
1
package com.saholic.profittill.main;
1
package com.saholic.profittill.main;
2
 
2
 
3
import java.util.HashMap;
-
 
4
 
-
 
5
import android.app.Application;
3
import android.app.Application;
6
import android.content.Context;
4
import android.content.Context;
7
import android.content.SharedPreferences;
-
 
8
import android.preference.PreferenceManager;
-
 
9
 
5
 
-
 
6
import com.android.volley.RequestQueue;
-
 
7
import com.android.volley.toolbox.Volley;
10
import com.google.android.gms.analytics.GoogleAnalytics;
8
import com.google.android.gms.analytics.GoogleAnalytics;
11
import com.google.android.gms.analytics.Tracker;
9
import com.google.android.gms.analytics.Tracker;
12
import com.saholic.profittill.R;
10
import com.saholic.profittill.R;
13
 
11
 
14
public class  GoogleAnalyticsTracker  extends Application {
12
import java.util.HashMap;
15
 
-
 
16
 
13
 
17
    /*google.analytics.project.code*/
14
public class  GoogleAnalyticsTracker  extends Application {
18
    private static final String PROPERTY_ID = "UA-59241805-2";
15
    private static final String PROPERTY_ID = "UA-59241805-2";
-
 
16
    public static int GENERAL_TRACKER = 0;
-
 
17
    private RequestQueue mRequestQueue;
19
/*    private static final String PROPERTY_ID = "UA-61365281-1";*/
18
    private static GoogleAnalyticsTracker mInstance;
20
 
19
 
-
 
20
    public static synchronized GoogleAnalyticsTracker getInstance() {
-
 
21
        return mInstance;
-
 
22
    }
21
 
23
 
22
    public static int GENERAL_TRACKER = 0;
24
    public static Context getAppContext(){
-
 
25
        return mInstance.getApplicationContext();
-
 
26
    }
23
 
27
 
24
    public enum TrackerName {
28
    public enum TrackerName {
25
        APP_TRACKER, GLOBAL_TRACKER, ECOMMERCE_TRACKER,
29
        APP_TRACKER, GLOBAL_TRACKER, ECOMMERCE_TRACKER,
26
    }
30
    }
27
 
31
 
Line 36... Line 40...
36
            Tracker t = (appTracker == TrackerName.APP_TRACKER) ? analytics.newTracker(PROPERTY_ID) : (appTracker == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker(R.xml.global_tracker) : analytics.newTracker(R.xml.ecommerce_tracker);
40
            Tracker t = (appTracker == TrackerName.APP_TRACKER) ? analytics.newTracker(PROPERTY_ID) : (appTracker == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker(R.xml.global_tracker) : analytics.newTracker(R.xml.ecommerce_tracker);
37
            mTrackers.put(appTracker, t);
41
            mTrackers.put(appTracker, t);
38
        }
42
        }
39
        return (Tracker) mTrackers.get(appTracker);
43
        return (Tracker) mTrackers.get(appTracker);
40
    }
44
    }
-
 
45
 
-
 
46
 
-
 
47
    @Override
-
 
48
    public void onCreate() {
-
 
49
        super.onCreate();
-
 
50
        mInstance = this;
-
 
51
    }
-
 
52
 
-
 
53
    public RequestQueue getRequestQueue() {
-
 
54
        if (mRequestQueue == null) {
-
 
55
            mRequestQueue = Volley.newRequestQueue(getApplicationContext());
-
 
56
        }
-
 
57
 
-
 
58
        return mRequestQueue;
-
 
59
    }
-
 
60
 
-
 
61
 
41
}
62
}
42
63