How to display information just once when app starts

hii

how do i display information just once when my app opens the very first time…

For example, when my app opens for the first time, there should be a scene which will say “welcome to our app and blah blah” , then there will be a button called “Ok” . When i touch that button, it should go to menu scene…and the next time the app opens, the scene which displayed “welcome to our apps” should not display again…

How do i get this?? 

Normally you would have some saved file in their system.DocumentsDirectory that indicates the app has already run. When the app starts, it looks for a settings file or a specific “first run” file or anything to indicate that the app has run. If it doesn’t find that file, you can set a flag for first run, then write out an initial settings file or however you want to track it.

If the first run flag is true, then display your first time info. If it’s false, then you don’t (and set the flag to false afterwards!)

The next time they run the app, it will find the saved file, set the first run flag to false.

Rob

Thank you so much

This one will do ??
loadsave = require “loadsave”

user = loadsave.loadTable(“user.json”)
if user == nil then
user.isWelcomeScreenEnabled = true
loadsave.saveTable(user, “user.json”)
End

if user.isWelcomeScreenEnabled == true then
composer.gotoScene(“welcomescreen”, “fade”)
user.isWelcomeScreenEnabled = false
loadsave.saveTable(user, “user.json”)
elseif user.isWelcomeScreenEnabled == false then
composer.gotoScene(“scene”,“fade”)
end

This will work???
I cannot test it cause i am out

loadsave = require "loadsave" local user = loadsave.loadTable("user.json") if user == nil then      user = {}      user.isWelcomeScreenEnabled = true      loadsave.saveTable(user, "user.json") end if user.isWelcomeScreenEnabled == true then     user.isWelcomeScreenEnabled = false     loadsave.saveTable(user, "user.json")     composer.gotoScene("welcomescreen", "fade") else     composer.gotoScene("scene","fade") end

You have the gist down. I made a few minor tweaks.

Rob

Yes yes
I’ve added composer.gotoScene before saving my user.isWelcomeScreenEnabled…so isWelcomeScreenEnabled will not be set to false because composer will change the scene
Thanks for figuring it out :smiley:

Normally you would have some saved file in their system.DocumentsDirectory that indicates the app has already run. When the app starts, it looks for a settings file or a specific “first run” file or anything to indicate that the app has run. If it doesn’t find that file, you can set a flag for first run, then write out an initial settings file or however you want to track it.

If the first run flag is true, then display your first time info. If it’s false, then you don’t (and set the flag to false afterwards!)

The next time they run the app, it will find the saved file, set the first run flag to false.

Rob

Thank you so much

This one will do ??
loadsave = require “loadsave”

user = loadsave.loadTable(“user.json”)
if user == nil then
user.isWelcomeScreenEnabled = true
loadsave.saveTable(user, “user.json”)
End

if user.isWelcomeScreenEnabled == true then
composer.gotoScene(“welcomescreen”, “fade”)
user.isWelcomeScreenEnabled = false
loadsave.saveTable(user, “user.json”)
elseif user.isWelcomeScreenEnabled == false then
composer.gotoScene(“scene”,“fade”)
end

This will work???
I cannot test it cause i am out

loadsave = require "loadsave" local user = loadsave.loadTable("user.json") if user == nil then      user = {}      user.isWelcomeScreenEnabled = true      loadsave.saveTable(user, "user.json") end if user.isWelcomeScreenEnabled == true then     user.isWelcomeScreenEnabled = false     loadsave.saveTable(user, "user.json")     composer.gotoScene("welcomescreen", "fade") else     composer.gotoScene("scene","fade") end

You have the gist down. I made a few minor tweaks.

Rob

Yes yes
I’ve added composer.gotoScene before saving my user.isWelcomeScreenEnabled…so isWelcomeScreenEnabled will not be set to false because composer will change the scene
Thanks for figuring it out :smiley: