Handle mobile device's lifecycle w/ C2

Get help using Construct 2

Post » Wed Mar 06, 2013 8:20 pm

Good Evening Gentlemen,

I am eager to know if there is any way to handle lifecycle events on mobile devices? I.e. I want my game to save the player's progress when my app is minimized on android or iOS devices. Are there any common practices to achieve that?

When coding a native app for Android (as an example) you can always respond to onPause() or onStop()-Events and put all your data- or game-saving-code in there. Is there any system-event or something that is triggered when the app is minimized or "short-to-be-terminated"?

Are there any other common saving-procedures that the dedicated C2-user should use?

Regards,
Chris
B
6
Posts: 33
Reputation: 816

Post » Fri Mar 08, 2013 7:59 am

Hi again. No ideas? I was thinking about regularly saving my game in fixed time intervals or game events. But both options do not really suit the style of my game... Any ideas?
B
6
Posts: 33
Reputation: 816

Post » Fri Mar 08, 2013 8:53 am

You would need to look at cocoonjs or appmobi objects to see what device options are supported. You should also look at web storage for saving data between plays, etc...
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Fri Mar 08, 2013 2:24 pm

The Browser object's 'On suspended' and 'On resumed' are the right triggers for this. You could do something like write to WebStorage in 'On suspended'.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Fri Mar 08, 2013 2:29 pm

Hi BluePhaze and Ashley,

thanks a lot for your responses. As far as I can see, the CocoonJS and Appmobi objects do not support those triggers.

@Ashley: That's great news. However, doesn't the CocoonJS-Tutorial state that Construct 2's "Browser-Object" is not being supported?

Chris

EDIT: Oh I see. The Tut states that "Most features of the Browser object are not supported." - Is there a list out there that says which features are supported and which are not?
TheStoepsel20012013-03-08 14:35:51
B
6
Posts: 33
Reputation: 816

Post » Fri Mar 08, 2013 3:30 pm

These triggers are supported on all platforms. I think they're pretty much the only Browser object features that work in CocoonJS and directCanvas.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Tue Mar 12, 2013 6:57 pm

Thanks a lot, @Ashley!
B
6
Posts: 33
Reputation: 816


Return to How do I....?

Who is online

Users browsing this forum: Pandadoor, Zebbi and 14 guests