【发布时间】:2012-12-10 14:46:17
【问题描述】:
我一直在努力将 Google 分析用于我的应用小部件,但没有任何成功,代码在 Activity 中使用时可以正常工作,但不能从应用小部件中使用。
【问题讨论】:
标签: android-widget google-analytics
我一直在努力将 Google 分析用于我的应用小部件,但没有任何成功,代码在 Activity 中使用时可以正常工作,但不能从应用小部件中使用。
【问题讨论】:
标签: android-widget google-analytics
您好,在您的 AppWidgetProvider onEnabled() 方法中使用此代码
Tracker t = ((MyApplication) context.getApplicationContext()).getTracker(
MyApplication.TrackerName.APP_TRACKER);
// Set screen name.
t.setScreenName(screenName);
// Send a screen view.
t.send(new HitBuilders.AppViewBuilder().build());
【讨论】: