Windows Phone 8 (WP8) - Suspend not working

0 favourites
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • I recently created a few apps with Construct 2 and successfully uploaded them to the Windows 8 Store. However, when I tried to export the same apps to the Windows Phone 8 Store, they all failed certification because the apps did not resume where they left off when the user switches away to do something else on the phone.

    In Windows 8, the same apps properly go into a suspended mode when you navigate away from them. They pick up exactly where they left off when you go back to them. In Windows Phone 8, the apps restart from the beginning.

    Here is a very simple app to show this behavior:

    dl.dropbox.com/s/zvrorjglsx2ns80/HypnosisWheel_v1.0.0.3.capx

    Reproduce the behavior:

    1) Open the .capx file and export it to Windows Phone 8

    2) Open the .sln file in the export directory

    3) Run the project

    4) Double tap a few times on the circle to increase the speed

    5) Now tap the back button or windows button

    6) Then go back to the app and it will be reset back to its original speed

  • This is a limitation of the exporter. You're going to fail lots of other certification requirements too, like properly handling audio when the user is playing music, back button functionality etc.

    I'm working on a plugin at the moment that adds the necessary functionality. ETA is probably about a week at the moment as also working on Surface optimisations.

  • Sweet! Looking forward to it.

  • rob Kachmar - have you tried r115? I made some changes to how WP8 suspend works, although it might not be perfect still...

  • If you guys need any C# or Silverlight help, let me know. I've been making WP apps since launch.

  • firebelly have you been able to get a decent debugger working on WP? I followed this tutorial http://matthiasshapiro.com/2012/12/03/debugging-an-html5-windows-phone-app/ but that only gives me things I specifically log. Been looking for a solution that's just like the VS console for W8.

  • Ashley,

    I tried exporting again with the r115 release, but I am still experiencing the same reset behavior. I updated the .capx link above with the file I opened in the new r115 release.

    firebelly,

    How are you maintaining state in your app after the user clicks the back or windows button on the phone, and then comes back to your app?

    BTW, this is from the app failure report I received...

    Requirements

    A Windows Phone app is deactivated when the user presses the Start button or if the device timeout causes the lock screen to engage. A Windows Phone app is also deactivated with it invokes a Launcher or Chooser API.

    A Windows Phone OS 7.0 app is tombstoned (terminated) when it is deactivated. A Windows Phone OS 7.1 or higher app becomes Dormant when it is deactivated but can be terminated by the system when resource use policy causes it to tombstone.

    When activated after termination, the app must meet the requirements in Section 5.2.1 - Launch time.

    For more information and best practices, see App activation and deactivation for Windows Phone.

  • Just to come back to this:

    I haven't exported using the latest release, but in r114 changing the following fixed the issue for me:

    Browser.InvokeScript("if (window.C2WP8Notify) C2WP8Notify('activated');");

    to

    Browser.InvokeScript("eval", "if (window.C2WP8Notify) C2WP8Notify('activated');");

    and

    Browser.InvokeScript("if (window.C2WP8Notify) C2WP8Notify('deactivated');");

    to

    Browser.InvokeScript("eval", "if (window.C2WP8Notify) C2WP8Notify('deactivated');");

    When we released a game on Windows Phone 7, you had to handle tombstoning, which was essentially saving the game state to isolated storage and loading it up again on resume. Looks like this is all done automagically on Windows Phone 8, yay.

  • Also rob Kachmar if that doesn't work, pm me a link to the Windows Phone build and I'll take a look.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for the reply. I tried out your suggestion, but no luck. Below is a link to the exported WP8 files with your suggested change.

    dropbox.com/s/mvp760jnwy2qgmp/HypnosisWheelWin8Phone.zip

    I think the problem is that the OnAppActivated() and OnAppDeactivated() methods are never even being called. I even added some simple MessageBox calls inside of them to troubleshoot when they are called, but they never fire.

  • I realized the previous project links I provided may not be the easiest type of project to identify the lack of suspend functionality in WP8.

    Here are some new links with a simple project that increments a text box score on any click or touch. When you navigate away from the app in WP8 and come back to it, the score will revert back to zero and not maintain its previous value.

    NOTE for "thehen": The ShowBugsWin8Phone.zip link has your suggested fix, but unfortunately it does not work.

    The Construct 2 project:

    dropbox.com/s/mmql3v0xr4m8y56/ShowBugs.capx

    The Windows 8 App export where state is maintained between app switching.

    dropbox.com/s/2rs2i065qpejrul/ShowBugsWin8.zip

    The Windows Phone 8 App export where state is NOT maintained between app switching.

    dropbox.com/s/zovqwuo15mgkfwx/ShowBugsWin8Phone.zip

  • I'm not sure of the problem - it works fine for me here.

    With the project you uploaded comment out the MessageBox lines.

    In index.html, under 'cr_setSuspended(false);' add 'alert("Activated!")'

    You'll then see the alert message when the game is resumed. Spinning speed is the same as when exited.

  • Add me on Skype if you still can't get this to work and we'll go through it - hoffmania1

  • First off, thanks for spending time to help me with my little problem.

    Unfortunately I can't seem to get it working. I tried your suggestions without any luck. Here's a quick video of me exporting a simple project and making the suggested tweaks.

    dropbox.com/s/odm2wq34r0ntjq9/ShowBugs_Construct2_r115_WindowsPhone8_NotSuspending_2013-01-13_2206.zip

    Here is the exported solution from the video:

    dropbox.com/s/zovqwuo15mgkfwx/ShowBugsWin8Phone.zip

    Here is the Construct 2 project from the video:

    dropbox.com/s/mmql3v0xr4m8y56/ShowBugs.capx

    BTW, I tried out your Mortar Melon game, very cool! It's inspiring to see what is possible with Construct 2.

  • Hi Rob,

    The version you uploaded works great.

    What the video shows is that after quitting the app, you're relaunching it from icon, which by default starts the application from the beginning. If you quit the app and tap the back button, you'll see the activation/deactivation working as expected.

    The functionality that you've described and want to achieve is called 'Fast Resume'. You can find more info here: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj735579(v=vs.105).aspx. To enable fast resume, open up WMAppManifest.xml and add ActivationPolicy="Resume" to the DefaultTask element. E.g.

    <DefaultTask Name ="_default" NavigationPage="MainPage.xaml" ActivationPolicy="Resume"/>

    It's important to note that you don't have to add this to pass certification.

    Thanks for trying out Mortar Melon :D

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)