简体   繁体   中英

How to add new Flurry Analytics in Android?

I have been trying to use Flurry Analytics with the official documentation but I am not getting it. As answered in the question here: How to use flurry in an application? I used

import com.flurry.android.FlurryAgent;
@Override
protected void onStart()
 {
 super.onStart();
  FlurryAgent.onStartSession(this, "YOUR_API_KEY");
 }
@Override
 protected void onStop()
{
super.onStop();
FlurryAgent.onEndSession(this);
  } 

But the above code seems to be deprecated, the official documentation says to use

 //If you are shipping an app, extend the Application class if you are not already doing so:

 public class MyApplication extends Application {
 @Override
 public void onCreate() {
super.onCreate();
// configure Flurry
FlurryAgent.setLogEnabled(false);

// init Flurry
FlurryAgent.init(this, MY_FLURRY_APIKEY);
 }
} 

What is meant by shipping an app? How to integrate new Flurry analytics? Help me.

The previous versions of Flurry analytics required adding a line of code to each Activity in your app - in the onStart() and onStop() methods: @Override public void onStart() { super.onStart(); // Start Flurry FlurryAgent.onStartSession(this, ); } @Override public void onStop() { // stop Flurry FlurryAgent.onEndSession(this); super.onStop(); } @Override public void onStart() { super.onStart(); // Start Flurry FlurryAgent.onStartSession(this, ); } @Override public void onStop() { // stop Flurry FlurryAgent.onEndSession(this); super.onStop(); } @Override public void onStart() { super.onStart(); // Start Flurry FlurryAgent.onStartSession(this, ); } @Override public void onStop() { // stop Flurry FlurryAgent.onEndSession(this); super.onStop(); } The latest version of Flurry simplifies this by having you add a single line of code to the Application class of your app - so if you don't have an application class (and for most apps it is probably not needed) you will have to create one: public class CKApplication extends Application {

@Override
public void onCreate() {
    super.onCreate();
    // configure flurry...

    // init Flurry
    FlurryAgent.init(this, MY_FLURRY_APIKEY);
}
</code>

"Shipping" and app means submitting it to Google Play store - or any other app store - in other words making your app available to the public is called "shipping the app".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM