我之前实施过flurry。它工作正常。今天有了新版本的 sdk,flurry 没有在 logcat 中记录任何东西。
我的代码
Flurry.java
public class Flurry {
private static final String API_KEY = "xxxxxxxxxxxxxxxxxxxxxx";
private static Context mContext;
public static void init(Context c) {
mContext = c;
}
public static Context getContext() {
return mContext;
}
public static void onStartSession() {
if (mContext != null) {
Debug.e("", "startng flurry session...");
FlurryAgent.setUserId(Utils.getUserId(mContext));
FlurryAgent.setVersionName(Utils.getAppVersion(mContext));
FlurryAgent.setLogEnabled(true);
FlurryAgent.setLogEvents(true);
FlurryAgent.onStartSession(mContext, API_KEY);
// FlurryAgent.initializeAds(mContext);
} else {
Debug.e("", "mContext is null");
}
}
public static void onEndSession() {
if (mContext != null) {
Debug.e("", "ending flurry session...");
FlurryAgent.onEndSession(mContext);
}
}
}
在活动中
public class MainActivity extends TabActivity implements OnTabChangeListener {
/** Called when the activity is first created. */
TabHost tabHost;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
Flurry.init(this);
Flurry.onStartSession();
setTabs();
}
@Override
protected void onDestroy() {
Flurry.onEndSession();
super.onDestroy();
}
}
在 manifest.xml
<uses-permission android:name="android.permission.INTERNET" />
当我在它向我显示这样的日志之前实施时,但今天在另一个应用程序中实施时,我没有得到任何混乱的日志......可能是什么问题?
4359 FlurryAgent D Initializing Flurry session
4359 FlurryAgent D New session
4359 TitleActivity V ::onResume::
4359 Settings W Setting android_id has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value.
4359 FlurryAgent I loading persistent data: /data/data/com.xxxxxx/files/.flurryagent.-6ee7b2a3
4359 FlurryAgent D Loading API key: ****************xxxx
4359 FlurryAgent D Loading session reports
4359 FlurryAgent D Persistent file loaded
4359 FlurryAgent D generating report
4359 FlurryAgent D Sending report to: http://data.flurry.com/aap.do
4359 FlurryAgent D Report successful
4359 FlurryAgent D Processing report response
4359 FlurryAgent D Done sending initial agent report