android - Execute code every time the application begins -


i execute code every time application begins (not first time application begins getsharedpreferences doesn't help).

i've tried write code in onstart() of main activity, code executed everytime entered activity including times activity other activities (so onstart() doesn't help).

if can direct me this, i'll appreciate that. thanks.

create application class - everytime application opens execute oncreate method.

//note extends application , not activity. public class myapplication extends application {   @override public void oncreate() {     super.oncreate();    //put code here. } 

make sure register in manifest -

   <application     android:name=".myapplication" 

any code put in oncreate execute when app opened.


Comments

Popular posts from this blog

angularjs - Redirect to a new template in angular js -

Oracle SQL. How to select specific IDs where value of columns specify criteria? -

Desktop Launcher for Python Script Starts Program in Wrong Path (Linux) -