For example, an user opens an app, presses the home button, and then comes back to the app again.
Is there any way to trigger certain functions when the user navigates back to the app? Such as auto load a view object when the user is back to the app.
This question is for both Android & iOS.
try to use a boolean variable in Two methods of the acitivity, onKeyDown and onPause.
for android you can right your code in onResume function which is called when backgroud app come to front. but remember android life cycle which is
onCreate-->onResume.
so onResume is always called even app runs first time or come from background. but onCreate called only when Activity created first time.
you can set some variable on onPause method which is called when app is going to background
and when you get that variable "true" and onResume called you can perform you task.
enjoy.
In onPause() method write this code to know that your application is went to background.
Use the above flag in onResume() to know that your application was resumed.
Use the following to your likings in the projects's
AppDelegate.m
file (iOS only)