2

i have install my app in android tablet.i have maintain the sessions for logged in users, for this purpose i want to know the app is closed or just minimized the app by the client.suppose if i have minimized the app and swipe that app (i.e closing).so,how to find the app is invoked exit Application or not on this scenario.

thanks in advance.

1 Answers1

3

This is related to Application LifeCycle. In CodenameOne, you have 4 hooks to manage lifecycle of your application. Here it is :

public void init(Object context) {}
public void start() {}
public void stop() {}
public void destroy() {}

init() is used when the App is launched (NOT resumed !).
start() is used when application come on foreground (After init, or after being minimized)
stop() is used when application goes to background (ie minimized)
destroy() is used when the OS kill the process (don't know if it's efficient on all platform at this time)

You can always find more information here ==> CN1 developer guide

Tim Weber
  • 858
  • 4
  • 14