Flurry不会在android中记录任何内容

时间:2013-01-07 05:41:59

标签: android analytics 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

3 个答案:

答案 0 :(得分:6)

使用Flurry Analytics SDK v3.1.0(本周从Flurry创建和下载)时,我收到了日志消息。

以下是配置Flurry将消息写入Android日志的相关代码:

@Override
protected void onStart() {
    super.onStart();
    FlurryAgent.onStartSession(this, FLURRY_API_KEY);
    FlurryAgent.setLogEnabled(true);
    FlurryAgent.setLogEvents(true);
    FlurryAgent.setLogLevel(Log.VERBOSE);

}

@Override
protected void onStop() {
    super.onStop();
    FlurryAgent.onEndSession(this);
}

这是证据

01-10 11:35:23.310: I/FlurryAgent(3915): loading persistent data: /data/data/com.ader/files/.flurryagent.624f614c
01-10 11:35:23.310: D/FlurryAgent(3915): Loading API key: ****************RY7Z
01-10 11:35:23.320: D/FlurryAgent(3915): Loading phoneId: AND2001447e7dcd4d3b
01-10 11:35:23.320: D/FlurryAgent(3915): Loading session reports
01-10 11:35:23.320: D/FlurryAgent(3915): Session report added: 1
01-10 11:35:23.320: D/FlurryAgent(3915): Session report added: 2
01-10 11:35:23.320: D/FlurryAgent(3915): Persistent file loaded
01-10 11:35:23.560: D/FlurryAgent(3915): generating report
01-10 11:35:23.570: D/FlurryAgent(3915): Sending report to: http://data.flurry.com/aap.do
01-10 11:35:29.610: D/FlurryAgent(3915): Report successful
01-10 11:35:29.610: D/FlurryAgent(3915): Done sending initial agent report

我认为诀窍是你没有的以下电话:

FlurryAgent.setLogLevel(Log.VERBOSE);

答案 1 :(得分:0)

这对我有用:

@Override
protected void onStart() {
    super.onStart();
    FlurryAgent.setLogEnabled(true);
    FlurryAgent.setLogLevel(Log.VERBOSE);
    FlurryAgent.onStartSession(this, "XXXXXXXXXXXXXXX");
    //System.out.println("Started Flurry");
}

@Override
protected void onStop() {
    super.onStop();     
    FlurryAgent.onEndSession(this);
    //System.out.println("Stopped Flurry");
}

答案 2 :(得分:0)

对于那些最近会遇到像我这样的问题的人。

FlurryAgent.setLogEnabled(true);
FlurryAgent.setLogEvents(true);
FlurryAgent.setLogLevel(Log.VERBOSE);
// must be last one
FlurryAgent.init(context, "some key");

我在扩展Application的类中初始化Flurry。将init调用放在最后是很重要的。

提到here,页面底部有3种方法:

  

......这应该在init之前调用。