- This topic has 12 replies, 2 voices, and was last updated 10 years, 3 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?
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.
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
Philip
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'); } }
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?
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
support-octavioMemberHi Philip,
I am discussing the best approach with the dev team, will follow up with a small sample project asap.
Philip!!!MemberGreat ill be waiting,
i the meantime i will post another topic for a problem i ‘m having.
Philip!!!MemberHi octavio
Any news yet?
support-octavioMemberHi Richard,
Sorry for the delay. I am sharing an example in a couple hours more 🙂
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.
Philip!!!MemberHi Octavio
It worked and helped me a lot.
support-octavioMemberHi philip, glad to help. I have closed the thread.
-
AuthorPosts