简体   繁体   English

Android上的Flurry Analytics EndTimedEvent

[英]EndTimedEvent for Flurry Analytics on Android

My question is regarding the timedEvents in flurry for Android. 我的问题是关于Android中的timedEvents。 I have three activities in my android app say A, B and A is my entry point of my activity. 我的Android应用程序中有3个活动,说A,B和A是我活动的切入点。 I am starting and ending the flurry session in onStart() and onStop() respectively for each activity A, B. I have a timed event say 'event_test' and I start this event on click of a button present in activity A and I navigate to B and spend some time in B. I have another button in B on click of which I am ending the timed event ' event_test '. 我分别在每个活动A,B的onStart()onStop()开始和结束flurry会话。我有一个定时事件说“ event_test”,并且我单击活动A中存在的按钮就开始了该事件,并导航到B并花一些时间在B上。我在B中还有另一个按钮,单击此按钮将结束定时事件“ event_test ”。 Ideally ' event_test ' should capture the entire time I spend in activity A and activity B. But it is only capturing the time I spent in activity A but not in B. I would greatly appreciate if some one can help me in this problem. 理想情况下,“ event_test ”应该捕获我在活动A和活动B中花费的全部时间。但是,它仅捕获我在活动A中而不是在活动B中所花费的时间。如果有人可以帮助我解决此问题,我将不胜感激。

You need to take Android Activity lifecycle into consideration in this case. 在这种情况下,您需要考虑Android Activity lifecycle

As per the activity lifecycle the onStop() of the current activity() CAN be called AFTER the onStart() of the next activity. 根据活动生命周期,可以在下一个活动的onStart()之后将当前活动()的onStop()称为。

In that case a new session will be started before ending the previous session. 在这种情况下,将在结束上一个会话之前开始一个新的会话。 It may cause the problem you are facing now. 这可能会导致您现在面临的问题。 In this scenario , I don't know, how the Flurry APIs will respond. 在这种情况下,我不知道Flurry API将如何响应。 Only Flurry support team can answer that. 只有Flurry支持团队才能回答。

However I can suggest a workaround which may not be the best. 但是,我可以建议一种可能不是最好的解决方法。 You can create your own timer, which will start when button is clicked in Activity A, and will stop at button click in Activity B. This way you can get the time duration you are looking for. 您可以创建自己的计时器,该计时器将在Activity A中单击按钮时开始,并在Activity B中单击按钮时停止。通过这种方式,您可以获得所需的持续时间。 And you can use that time in logevent as parameter. 您可以在logevent将该时间用作参数。

Hope it helps you. 希望对您有帮助。

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

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