root / src / com / rackspacecloud / android / GaListActivity.java @ b2a2d2f1
History | View | Annotate | Download (2.6 kB)
1 |
package com.rackspacecloud.android; |
---|---|
2 |
|
3 |
import com.google.android.apps.analytics.GoogleAnalyticsTracker; |
4 |
|
5 |
import android.app.ListActivity; |
6 |
import android.os.Build; |
7 |
import android.os.Bundle; |
8 |
|
9 |
public class GaListActivity extends ListActivity { |
10 |
|
11 |
protected static final String CATEGORY_FILE = "file"; |
12 |
protected static final String CATEGORY_SERVER = "server"; |
13 |
protected static final String CATEGORY_CONTAINER = "containers"; |
14 |
protected static final String CATEGORY_LOAD_BALANCER = "load_balancer"; |
15 |
|
16 |
protected static final String PAGE_ROOT = "/Root"; |
17 |
protected static final String PAGE_SERVERS = "/Servers"; |
18 |
protected static final String PAGE_SERVER = "/Server"; |
19 |
protected static final String PAGE_CONTAINERS = "/Containers"; |
20 |
protected static final String PAGE_FOLDER = "/Folder"; |
21 |
protected static final String PAGE_STORAGE_OBJECT = "/StorageObject"; |
22 |
protected static final String PAGE_ADD_SERVER = "/AddServer"; |
23 |
protected static final String PAGE_CONTACT = "/ContactInformation"; |
24 |
protected static final String PAGE_ADD_CONTAINER = "/AddContainer"; |
25 |
protected static final String PAGE_PASSCODE = "/Passcode"; |
26 |
protected static final String PAGE_PROVIDERS = "/Providers"; |
27 |
protected static final String PAGE_CONTAINER_DETAILS = "/ContainerDetail"; |
28 |
protected static final String PAGE_ADD_OBJECT = "/AddObject"; |
29 |
|
30 |
protected static final String EVENT_CREATE = "created"; |
31 |
protected static final String EVENT_DELETE = "deleted"; |
32 |
protected static final String EVENT_PING = "pinged"; |
33 |
protected static final String EVENT_REBOOT = "reboot"; |
34 |
protected static final String EVENT_BACKUP = "backup_schedule_changed"; |
35 |
protected static final String EVENT_RESIZE = "resized"; |
36 |
protected static final String EVENT_PASSWORD = "password_changed"; |
37 |
protected static final String EVENT_UPDATED = "updated"; |
38 |
protected static final String EVENT_REBUILD = "rebuilt"; |
39 |
protected static final String EVENT_RENAME = "renamed"; |
40 |
|
41 |
private GoogleAnalyticsTracker tracker;
|
42 |
|
43 |
@Override
|
44 |
protected void onCreate(Bundle savedInstanceState) { |
45 |
super.onCreate(savedInstanceState);
|
46 |
startTracker(); |
47 |
} |
48 |
|
49 |
public void startTracker(){ |
50 |
if(!"google_sdk".equals(Build.PRODUCT) && !"sdk".equals(Build.PRODUCT)){ |
51 |
tracker = GoogleAnalyticsTracker.getInstance(); |
52 |
tracker.start(Config.WEB_PROPERTY_ID, 20, this); |
53 |
} |
54 |
} |
55 |
|
56 |
public void trackPageView(String page){ |
57 |
if(tracker != null){ |
58 |
tracker.trackPageView(page); |
59 |
} |
60 |
} |
61 |
|
62 |
@Override
|
63 |
protected void onDestroy(){ |
64 |
super.onDestroy();
|
65 |
if(tracker != null){ |
66 |
tracker.stop(); |
67 |
} |
68 |
} |
69 |
|
70 |
public void trackEvent(String category, String action, String label, int value){ |
71 |
if(tracker != null){ |
72 |
tracker.trackEvent(category, action, label, value); |
73 |
} |
74 |
} |
75 |
|
76 |
} |