Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14060] Parity: Backgrounding the app on Android does not send ti.end event

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-06-03T22:32:50.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.1.1, Release 3.2.0
ComponentsAndroid
Labelsanalytics, qe-3.1.1, qe-closed-3.1.1, qe-testadded
ReporterMukesh Gadiya
AssigneePing Wang
Created2013-05-31T02:38:01.000+0000
Updated2014-03-13T00:21:05.000+0000

Description

1. In iOS, when app is closed/backgrounded and then brought back to foreground, sends ti.end and ti.start events indicating 1st session end and 2nd session begin respectively. For example: Event INFO :[{"id":"5225C0FF-D387-440C-9DA2-93737A3D2387","mid":"12DA5FD3-F582-4AF6-9E21-FB14AA8F102F","rdu":null,"type":"ti.foreground","aguid":"d8504b70-8106-4423-b35a-128a56fb30db","event":"ti.foreground","seq":11,"ver":"2","deploytype":"test","sid":"51AAB984-DBB2-4502-9ECE-6C2474380A7A","ts":"2013-05-31T01:11:06.038+0000","data":{"tz":-420,"os":"iphone","nettype":"WIFI","deploytype":"test","app_version":"1.0","osver":"5.0.1","version":"3.1.1","platform":"iphone","model":"iPhone4,1"}},{"id":"AAF8B7B7-E312-4E55-A942-2F0CE89AC6BF","mid":"12DA5FD3-F582-4AF6-9E21-FB14AA8F102F","rdu":null,"type":"ti.background","aguid":"d8504b70-8106-4423-b35a-128a56fb30db","event":"ti.background","seq":12,"ver":"2","deploytype":"test","sid":"51AAB984-DBB2-4502-9ECE-6C2474380A7A","ts":"2013-05-31T01:11:06.785+0000","data":null}] 2. On Android, backgrounding the app - either by pressing home button or by killing the the app from settings->app->force stop - does not send ti.end event to analytics. It is only sent when back button is pressed to get out of the app From end user's perspective, getting out of the app is equivalent to ending the session in the app, so it makes sense to send ti.end event just like it is done on iOS.

Attachments

FileDateSize
activity_lifecycle.png2013-05-31T22:24:24.000+000093721

Comments

  1. Matt Langston 2013-05-31

    Relevant info: http://code.google.com/p/android/issues/detail?id=2373 (Activity stack behaves incorrectly during the first run of an app when started from Eclipse)
  2. Matt Langston 2013-05-31

    Android Activity Lifecycle and where Titanium analytics fits in: !activity_lifecycle.png!
  3. Ping Wang 2013-06-01

    PR: https://github.com/appcelerator/titanium_mobile/pull/4345
  4. Ping Wang 2013-06-01

    3_1_X PR: https://github.com/appcelerator/titanium_mobile/pull/4346
  5. Sabil Rahim 2013-06-03

    Testing various cases.
  6. Olga Romero 2013-06-14

    Appcelerator Studio, build: 3.1.1.201306131423 3.1.1.v20130613185544 Device: Nexus7 Android version 4.2
       {"city":"Mountain View","region_code":"CA","country_code":"US","country_name":"United States","postal_code":"94043","latitude":37.419200897217,"longitude":-122.05740356445,"area_code":650,"continent_code":"NA","ip_address":"38.110.144.252","region_name":"California","id":"a5a501ad-af49-4187-972e-6d8d7f15398e:101dee4a8a8f9400","sid":"0d819e1c-e4e7-4588-b01c-f6ccd7ac8a04","ts":"2013-06-14T20:51:05.043+0000","event":"ti.enroll","data":{"platform":"android","osarch":"ARMv7 Processor rev 9 (v7l)","model":"Nexus 7","mac_addr":"10:bf:48:c1:40:e3","previous_mid":"","oscpu":4,"ostype":"32bit","deploytype":"test","app_id":"com.appcelerator.timob14060","app_name":"timob14060"},"seq":1,"mid":"101dee4a8a8f9400","ver":"2","type":"ti.enroll","aguid":"65374a5b-3b71-4756-8023-1d14ca5cdefa"}
       {"city":"Mountain View","region_code":"CA","country_code":"US","country_name":"United States","postal_code":"94043","latitude":37.419200897217,"longitude":-122.05740356445,"area_code":650,"continent_code":"NA","ip_address":"38.110.144.252","region_name":"California","id":"daa8fa09-cc8d-49bb-ba16-cb61f09bb9d4:101dee4a8a8f9400","sid":"0d819e1c-e4e7-4588-b01c-f6ccd7ac8a04","ts":"2013-06-14T20:51:05.398+0000","event":"ti.start","data":{"platform":"android","os":"Android","model":"Nexus 7","tz":-480,"nettype":"WIFI","deploytype":"test","app_version":"1.0","osver":"4.2","version":"3.1.1"},"seq":2,"mid":"101dee4a8a8f9400","ver":"2","type":"ti.start","aguid":"65374a5b-3b71-4756-8023-1d14ca5cdefa"}
       
       
       {"id":"28a4b2b3-78a6-469d-ae2b-c45870b910a7:101dee4a8a8f9400","sid":"0d819e1c-e4e7-4588-b01c-f6ccd7ac8a04","ts":"2013-06-14T20:52:04.696+0000","event":"ti.end","data":{"value":""},"seq":3,"mid":"101dee4a8a8f9400","ver":"2","type":"ti.end","aguid":"65374a5b-3b71-4756-8023-1d14ca5cdefa"}
       {"city":"Mountain View","region_code":"CA","country_code":"US","country_name":"United States","postal_code":"94043","latitude":37.419200897217,"longitude":-122.05740356445,"area_code":650,"continent_code":"NA","ip_address":"38.110.144.252","region_name":"California","id":"436134d8-a473-4024-ab86-282c954517f9:101dee4a8a8f9400","sid":"0d819e1c-e4e7-4588-b01c-f6ccd7ac8a04","ts":"2013-06-14T20:52:17.000+0000","event":"ti.start","data":{"platform":"android","os":"Android","model":"Nexus 7","tz":-480,"nettype":"WIFI","deploytype":"test","app_version":"1.0","osver":"4.2","version":"3.1.1"},"seq":4,"mid":"101dee4a8a8f9400","ver":"2","type":"ti.start","aguid":"65374a5b-3b71-4756-8023-1d14ca5cdefa"}
       {"id":"37106c4c-6094-4ee5-902e-bedd657684c1:101dee4a8a8f9400","sid":"0d819e1c-e4e7-4588-b01c-f6ccd7ac8a04","ts":"2013-06-14T20:52:29.431+0000","event":"featureEvent.testButton","data":{"value":""},"seq":5,"mid":"101dee4a8a8f9400","ver":"2","type":"app.feature","aguid":"65374a5b-3b71-4756-8023-1d14ca5cdefa"}
       {"id":"a70852ad-c8a3-4f9c-9d87-582b99eb2c80:101dee4a8a8f9400","sid":"0d819e1c-e4e7-4588-b01c-f6ccd7ac8a04","ts":"2013-06-14T20:52:32.005+0000","event":"navEvent.testButton","data":{"to":"there","data":null,"event":"navEvent.testButton","from":"here"},"seq":6,"mid":"101dee4a8a8f9400","ver":"2","type":"app.nav","aguid":"65374a5b-3b71-4756-8023-1d14ca5cdefa"}
       {"id":"518ddaf0-df4e-4d37-97c4-ff9e06aed865:101dee4a8a8f9400","sid":"0d819e1c-e4e7-4588-b01c-f6ccd7ac8a04","ts":"2013-06-14T20:52:32.946+0000","event":"settingsEvent.testButton","data":{"value":""},"seq":7,"mid":"101dee4a8a8f9400","ver":"2","type":"app.settings","aguid":"65374a5b-3b71-4756-8023-1d14ca5cdefa"}
       {"id":"8b1c55e8-d2d8-4cbc-80af-1a8a9558035c:101dee4a8a8f9400","sid":"0d819e1c-e4e7-4588-b01c-f6ccd7ac8a04","ts":"2013-06-14T20:52:34.147+0000","event":"timedEvent.testButton","data":{"data":null,"stop":1371243065155,"duration":88990,"start":1371243065155,"event":"timedEvent.testButton"},"seq":8,"mid":"101dee4a8a8f9400","ver":"2","type":"app.timed","aguid":"65374a5b-3b71-4756-8023-1d14ca5cdefa"}
       {"id":"6d1b2e4d-903a-4a66-8255-8196aef1ec04:101dee4a8a8f9400","sid":"0d819e1c-e4e7-4588-b01c-f6ccd7ac8a04","ts":"2013-06-14T20:52:35.191+0000","event":"userEvent.testButton","data":{"value":""},"seq":9,"mid":"101dee4a8a8f9400","ver":"2","type":"app.user","aguid":"65374a5b-3b71-4756-8023-1d14ca5cdefa"}
       {"id":"383e59be-e4eb-4f59-87d6-0d431abdd35b:101dee4a8a8f9400","sid":"0d819e1c-e4e7-4588-b01c-f6ccd7ac8a04","ts":"2013-06-14T20:52:39.271+0000","event":"ti.end","data":{"value":""},"seq":10,"mid":"101dee4a8a8f9400","ver":"2","type":"ti.end","aguid":"65374a5b-3b71-4756-8023-1d14ca5cdefa"}
       
    Background and arrow back result in ti.end being sent Closing.

JSON Source