executing code every 24h, but only if app is opened
<p>I want to execute specific code in my app every 24h.</p>

<p>I know how to use AlarmManager but problem is I don't want that code to be executed if app isn't running.</p>

<p>I want it to be executed when app starts but only if 24h has passed after last execution.</p>

<p>It doesn't matter if more 24h has passed</p>

<p>For example if user opens my app for the first time code will execute. If it opens it again after 20min nothing will happen. if it opens it after 24h or more code will be executed.</p>
