Bhavesh Hirpara
Bhavesh Hirpara

Reputation: 22556

Flurry does not log anything in android

I have implemented flurry before. It was working fine. Today with new version of sdk, flurry does not log any thing in logcat.

My code

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);
    }
}
}

in Activity

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();
}
}

in manifest.xml

<uses-permission android:name="android.permission.INTERNET" />

when I implemented before it show me log like this, but today implementing in another app, i did not get any log of flurry... what can be the issue??

 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

Upvotes: 5

Views: 9677

Answers (3)

Igor K
Igor K

Reputation: 470

For those who will have same problem like me recently.

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

I was initializing Flurry in class that extends Application. It was important to have init call is last.

It is mentioned here, at the bottom of the page for 3 methods there are:

... This should be called before init.

Upvotes: 0

capcom
capcom

Reputation: 3337

This works for me:

@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");
}

Upvotes: 0

JulianHarty
JulianHarty

Reputation: 3286

I get log messages when using Flurry Analytics SDK v3.1.0 (created and downloaded this week from Flurry).

Here's the relevant code that configured Flurry to write messages to the Android log:

@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);
}

And here is the evidence

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

I think the trick is the following call you don't have:

FlurryAgent.setLogLevel(Log.VERBOSE);

Upvotes: 6

Related Questions