- This topic has 12 replies, 2 voices, and was last updated 10 years, 9 months ago by
support-octavio.
-
AuthorPosts
-
Philip!!!MemberHi Octavio
I have a question for you.
I developed a book application,
the first time i open the application it starts from my start up screen,
now, i want after i close the application and open it again to start
from the screen i was last time.how can i implement something like that?
September 11, 2014 at 8:55 pm #351477
support-octavioMemberHi philip,
You can achieve this by saving a variable in local storage, everytime you change to a new screen (phoneui.postPageTransition funtcion) overwrite this var and add the code (phoneui.documentReadyHandler) to navigate to a screen depending on value saved on localstorage var. Let me know if you need further assistance.
September 12, 2014 at 3:34 am #351487
Philip!!!MemberHi Octavio
I’m sorry , when you say local storage , do you mean my custom.js ?
is it possible to post an example because i am new to this ?
Thank you
PhilipSeptember 12, 2014 at 2:26 pm #351504
support-octavioMemberHi philip,
For local storage take a look at this example: http://www.genuitec.com/support-genuitec/viewtopic.php?f=14&t=2251
For transitions something like this should work:
phoneui.postPageTransition = function(newScreenId) { localStorage.setItem("lastscreen","products"); } phoneui.documentReadyHandler = function() { if(localStorage.getItem("lastscreen")=="products"){ phoneui.gotoScreen('m1-products', 'FADE'); } }
September 12, 2014 at 2:46 pm #351505
Philip!!!MemberHi Octavio
I’m sorry but i am a bit confused
Am i suppose to add the code to my custom.js file in my project folder
or add the local storage custom.js file in my project folder?September 16, 2014 at 4:28 am #351543
Philip!!!MemberHi Octavio
I haven’t got a feed back from you yet.If you think we are not on the same page here on what i am trying to do
exactly i can always share a folder with a sample of my application with you
( in privet of course) so you understand better my problem.
just send me an email or a link.Philip
September 16, 2014 at 1:02 pm #351551
support-octavioMemberHi Philip,
I am discussing the best approach with the dev team, will follow up with a small sample project asap.
September 16, 2014 at 2:53 pm #351554
Philip!!!MemberGreat ill be waiting,
i the meantime i will post another topic for a problem i ‘m having.September 25, 2014 at 5:04 am #351742
Philip!!!MemberHi octavio
Any news yet?
September 26, 2014 at 9:18 am #351761
support-octavioMemberHi Richard,
Sorry for the delay. I am sharing an example in a couple hours more 🙂
September 26, 2014 at 1:02 pm #351766
support-octavioMemberHi philip,
Here is the example I promised. Note that the back button doesn’t work if your last active screen is a secondary screen, so I suggest you to avoid them.
phoneui.postPageTransition = function(newScreenId) { localStorage.setItem("lastscreen",newScreenId); } phoneui.documentReadyHandler = function() { var lastscreen = localStorage.getItem("lastscreen"); if(lastscreen!=undefined||lastscreen!="#m1-home") { phoneui.gotoScreen(lastscreen, 'NONE'); } }
Ping me if you need further assistance.
Attachments:
You must be logged in to view attached files.September 29, 2014 at 8:40 am #351810
Philip!!!MemberHi Octavio
It worked and helped me a lot.
September 29, 2014 at 12:33 pm #351822
support-octavioMemberHi philip, glad to help. I have closed the thread.
-
AuthorPosts