简体   繁体   English

适用于Android 2.1的Flurry SDK?

[英]Flurry SDK for Android 2.1?

Is there a version of the Flurry SDK for Android 2.1? 是否有适用于Android 2.1的Flurry SDK版本?

Thanks. 谢谢。

Yes the Flurry SDK works for Android 2.1. 是的,Flurry SDK适用于Android 2.1。 What you need to do is following. 您需要做的是遵循。 Sign up here: www.flurry.com 在这里注册: www.flurry.com

After this you'll have to create a new Project, than do following steps: 之后,您必须创建一个新项目,而不是执行以下步骤:

  1. Add FlurryAgent.jar to your application's classpath 将FlurryAgent.jar添加到应用程序的类路径中

    • If you're using Eclipse, modify your Java Build Path, and choose Add External JAR... or use Gradle + Jcenter compile 'com.flurry.android:analytics:6.2.0' 如果您使用的是Eclipse,请修改Java Build Path,然后选择Add External JAR ...或使用Gradle + Jcenter compile 'com.flurry.android:analytics:6.2.0'
    • If you're using the SDK tools directly, drop it into your libs folder and the ant task will pick it up. 如果直接使用SDK工具,请将其放到libs文件夹中,然后ant任务将其拾取。
  2. Configure AndroidManifest.xml 配置AndroidManifest.xml

Required Permission: 所需权限:

android.permission.INTERNET

Required to send analytics data back to the flurry servers Optional Permission: 将分析数据发送回flurry服务器所需的可选权限:

android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION

If your application has location permissions, analytics will track where your application is being used. 如果您的应用程序具有位置许可,则分析将跟踪您的应用程序的使用位置。 Without this, only country level location information will be available. 否则,将仅提供国家/地区级别的位置信息。 To disable detailed location reporting even when your app has permission, call FlurryAgent.setReportLocation(false) before calling FlurryAgent.onStartSession() and no detailed location information will be sent. 若要禁用详细位置报告(即使您的应用程序具有权限),请FlurryAgent.setReportLocation(false) before calling FlurryAgent.onStartSession()并且不会发送详细的位置信息。 Specify a versionName attribute in the manifest to have data reported under that version name. 在清单中指定versionName属性,以使用该版本名称报告数据。

3.Add calls to onStartSession and onEndSession 3,添加对onStartSession和onEndSession的调用

Insert a call to FlurryAgent.onStartSession(Context, String ), passing it a reference to a Context object (such as an Activity or Service), and your application's API key [YOURAPIKEYRIGHTHERE]. 插入对FlurryAgent.onStartSession(Context, String )的调用, FlurryAgent.onStartSession(Context, String它的引用传递给Context对象(例如Activity或Service),以及应用程序的API密钥[YOURAPIKEYRIGHTHERE]。 We recommend using the onStart method of each Activity in your application, and passing the Activity (or Service) itself as the Context object - passing the global Application context is not recommended. 我们建议您在应用程序中使用每个Activity的onStart方法,并将Activity(或Service)本身作为Context对象传递-不建议传递全局Application上下文。

public void onStart()
{
   super.onStart();
   FlurryAgent.onStartSession(this, "YOURAPIKEYRIGHTHERE");
   // your code
}

Insert a call to FlurryAgent.onEndSession(Context) when a session is complete. 会话完成后,插入对FlurryAgent.onEndSession(Context)的调用。 We recommend using the onStop method of each Activity in your application. 我们建议您在应用程序中使用每个Activity的onStop方法。 Make sure to match up a call to onEndSession for each call of onStartSession, passing in the same Context object that was used to call onStartSession 确保为onStartSession的每次调用匹配对onEndSession的调用,并传递用于调用onStartSession的同一Context对象。

public void onStop()
{
   super.onStop();
   FlurryAgent.onEndSession(this);
   // your code
}

So long as there is any Context that has called onStartSession but not onEndSession, the session will be continued. 只要有任何上下文调用了onStartSession但没有调用onEndSession,则该会话将继续。 Also, if a new Context calls onStartSession within 10 seconds of the last Context calling onEndSession, then the session will be resumed, instead of a new session being created. 另外,如果新的上下文在上一次调用onEndSession的上下文之后的10秒内调用了onStartSession,则将恢复会话,而不是创建新的会话。 Session length, usage frequency, events and errors will continue to be tracked as part of the same session. 会话长度,使用频率,事件和错误将继续作为同一会话的一部分进行跟踪。 This ensures that as a user transitions from one Activity to another in your application that they will not have a separate session tracked for each Activity, but will have a single session that spans many Activities. 这样可以确保在用户从应用程序中的一个活动过渡到另一个活动时,他们不会为每个活动跟踪一个单独的会话,而是拥有一个跨多个活动的单个会话。 If you want to track Activity usage, we recommend using onEvent, described below. 如果要跟踪活动的使用情况,建议使用如下所述的onEvent。 If you wish to change the window during which a session can be resumed, call FlurryAgent.setContinueSessionMillis(long milliseconds) before the first call to FlurryAgent.onStartSession . 如果您希望更改可以恢复会话的窗口,请在首次调用FlurryAgent.onStartSession之前调用FlurryAgent.setContinueSessionMillis(long milliseconds)

If you wish to change the window during which a session can be resumed, call FlurryAgent.setContinueSessionMillis(long milliseconds) before the first call to FlurryAgent.onStartSession . 如果您希望更改可以恢复会话的窗口,请在首次调用FlurryAgent.onStartSession之前调用FlurryAgent.setContinueSessionMillis(long milliseconds)

I hope I could help you! 希望能对您有所帮助!

Have a great day! 祝你有美好的一天!

safari 苹果浏览器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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