[TIMOB-19920] Android Lifecycle State (onPause, onCreate and others) not getting called
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2015-11-23T05:06:19.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | Community, activity, android |
Reporter | Bhavin Bhavsar |
Assignee | Ashraf Abu |
Created | 2015-09-29T06:58:40.000+0000 |
Updated | 2017-03-24T17:56:00.000+0000 |
Description
Hi, i am working on an titanium but i have problems getting android activity life-cycle state.
I have gone through http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Android.Activity adding of
true also in tiapp.xml.
Added the eventListners.
var appActivity = Ti.Android.currentActivity;
appActivity.addEventListener('onResume, function() {
Ti.API.info('Tha applicaiton was onResume'');
});
Just like this i have added onPause, onStart', onRestart and onStop. But still i am not getting any required output.
I want to get the state of android activity and if possible also without adding any other 3rd party module.
Hello, See pull request: https://github.com/appcelerator/titanium_mobile/pull/5701 See test application below. Explanation: 1. Added onCreate, onStart, onResume, onRestart, onPause, onStop, and onDestroy properties to the tab group or window activity property. 2. For Window, you must set these properties prior to window.open() called. 3. For TabGroup, you can set these only after the open event (it's unfortunate that the two APIs are different in this, but that's outside the scope of this PR).
Thanks.
[~bhavin2887] The comment written earlier works and you do get the lifecycle. I'll close this ticket as invalid if there is nothing else. :)
Closing ticket as invalid with reference to the above comments.