Is there a way to detect that the the user just returned to the app after leaving it to another app and then back? I tried to use window.onfocus
but it only worked in a PC browser.
Yes, you may utilize Page Visibility API. Listen for visibilitychange
event and check document.hidden
property there.