简体   繁体   中英

Google Analytics SDK Air for Android using AS3 and Flash

How do I install Google SDK for Android using Flash and AS3?

I see this in the docs but it doesn't look like AS3? Where do I put this code? Any good tutorials that teach a person how to do this?

Add the send methods to the onStart() and onStop() methods of each of your Activities as in the following example:

/**
 * An example Activity in your app with Analytics
 * implemented.
 */
public class myTrackedActivity extends Activity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
  }

  @Override
  public void onStart() {
    super.onStart();
    ... // The rest of your onStart() code.
    EasyTracker.getInstance().activityStart(this); // Add this method.
  }

  @Override
  public void onStop() {
    super.onStop();
    ... // The rest of your onStop() code.
    EasyTracker.getInstance().activityStop(this); // Add this method.
  }
}

Note that EasyTracker requires Context before you can call its methods. In the above example, this line:

EasyTracker.getInstance.activityStart(this);

takes care of setting the context. However if you need to make EasyTracker calls in other classes or methods, you'll need to call EasyTracker's setContext(Context ctx) method first:

// Set Context before using EasyTracker. Note that the SDK will
// use the application context.
EasyTracker.getInstance().setContext(this);

// EasyTracker is now ready for use.

Google SDK is used for creating native Android apps - in a Flash context, you could use it to build an AIR Adobe Native Extension for Android.

The link provides a starting point for building ANEs. Btw, code looks like Java to me (the default Android development language).

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