Cross-platform SDK and HTML5 tools for mobile app development
X
 
2 posts / 0 new
Last post
Vinod Takarkhede
adsoftech's picture
Offline
Joined: 29 Nov 2011
Posts:
How to add method in MoSync

How to add  a methods that will be called on the very first startup of the application only and a method that gets calles on every startup of the MoSync application?

Fredrik Eldh
Fredrik's picture
Offline
Mobile Sourcerer
Joined: 16 Feb 2009
Posts:
The answer depends on what

The answer depends on what kind of MoSync app you're writing, but assuming you use C++, here's my idea.

Your Moblet constructor gets called on startup. You may write your code there, or create another method and call that from the constructor.

To determine if the app has been started before, you can use a data store. If the store does not exist, you can assume it is the first startup, call your special method, and then create the store. The next time your app starts, the store will exist, and you can choose to not call the first-startup function.

Of course, all this will be different if you use HTML5. As it is not my area of expertise, I will leave it to others to anwer that question.

Login or register to post comments