我正在尝试使用以下教程跟踪我的 android 应用程序的使用情况:
https://developers.google.com/analytics/devguides/collection/android/v3/
但是,即使在多个设备上安装了应用程序并在模拟器中运行它之后,我的仪表板也从未显示任何使用情况。
我的实现如下:
STARTACTIVITY.java
public class StartActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.start);
EasyTracker.getInstance(this).activityStart(this);
分析.xml
<?xml version="1.0" encoding="utf-8" ?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:ignore="TypographyDashes">
<!--Replace placeholder ID with your tracking ID-->
<string name="ga_trackingId">UA-xxxxxxx-2</string>
<!--Enable automatic activity tracking-->
<bool name="ga_autoActivityTracking">true</bool>
<!--Enable automatic exception tracking-->
<bool name="ga_reportUncaughtExceptions">true</bool>
</resources>
显现:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test.datasettings"
android:versionCode="4"
android:versionName="1.3" >
<uses-permission android:name="android.permission.WRITE_APN_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:icon="@drawable/notifications_icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<activity
android:name="com.example.test.datasettings.StartActivity"
android:label="@string/display_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.test.datasettings.UpdateActivity"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden|screenSize">
</activity>
<activity
android:name="com.example.test.datasettings.ConfigFinalActivity"
android:configChanges="orientation|keyboardHidden|screenSize">
</activity>
<activity
android:name="com.example.test.datasettings.MySSLSocketFactory"
android:configChanges="orientation">
</activity>
<activity
android:name="com.example.test.datasettings.NotificationActivityForMultiProf"
android:theme="@android:style/Theme.NoDisplay" >
</activity>
</application>
</manifest>