Run function one time


how to run function one time when app is open and the next time when app is open then function is not called.

Run function one time in Ionic Android app

Hi Alisax,

You can take advantage of localStorage get rid of one time app initializer function.

Simply create “” or whatever name localstorage, when app will run for first time it will check initialize key exist in that storage, if it null then do one time setup code.

initApp() {
  let local = new LocalStorage("");
  local.get("initialize").then((result) => {
      if(result == null) {
          console.log("Do your one time initializing code");
      } else {
          console.log("code which will not call first time, called for subsequent app view")


hi itsmemyk
Great. Thank you! That was surprisingly easy.
Again Thank You very much … :slight_smile: