Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Freezes after sleeping — Gideros Forum

Freezes after sleeping

unlyingunlying Guru
edited November 2012 in Bugs and issues
My game freezes after going to sleep. How to fix this?
video:
http://rghost.ru/private/41882090/ae276801fec0b958adcfed7a42c73042
Tagged:

Comments

  • atilimatilim Maintainer
    edited November 2012
    Most probably it's because of this fix: http://www.giderosmobile.com/forum/discussion/1725/android-app-is-resumed-at-lockscreen

    I wonder why your phone doesn't show a lock screen after locking and unlocking? Is there a setting for this? My all test devices show a lock screen therefore I cannot test your issue.
  • @atilim you can just wait until it goes to sleep. It will be same. All your touches takes by application, but you'll not see any changes before you turn screen off and turn it on again.
    I'll try your solution today.
  • atilimatilim Maintainer
    edited November 2012
    Found an app: https://play.google.com/store/apps/details?id=org.jraf.android.nolock

    After installing this app, same issue also occurred on my side. Let me look at it how to fix it. (I think this may be hard to fix because most probably this application prevents calling of onWindowFocusChanged function)
  • atilimatilim Maintainer
    edited November 2012
    That solution is already available and it mainly causes this bug. If you've installed an application like "No Lock", can you disable it and test again?
  • unlyingunlying Guru
    edited November 2012
    @atilim i don't have this application. It is not my video. It is from Samsung Apps Team.
    I don't really care about exactly this problem(turn off, turn on without lockscreen - freeze).
    I care about sleeping. When my phone goes to sleep and turning on after this - it has same freezes. I'll post video soon.
  • Btw i don't have this problem in another application(Ricky Monkey Free)
  • fxonefxone Member
    edited November 2012
    @unlying because this behaviour indicates on some problem with activity FLAGS not with Gideros app at all, so simply try my solution:
    put in AndroidManifest.xml this phrase at main 'activity' section:

    android:launchMode="singleTop"

    the example line starts like:
     <activity android:launchMode="singleTop" android:label="<a href="https://forum.gideros.rocks/profile/string%2Fapp_name%26quot" rel="nofollow">@string/app_name&quot</a>; android:name="com.giderosmobile.android.StreetPoolActivity" android:screenOrientation="landscape" android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
    If you want more details, please see:
    http://developer.android.com/guide/topics/manifest/activity-element.html#lmode
  • @fxone it doesn't helps me. But thanks anyway.
    Khm. I understand why i don't have this problem in Ricky Monkey Free. It was built with older gideros version
  • FYI: I can see the same issue with "out of the box" Nexus 7.
  • atilimatilim Maintainer
    Here is the solution.

    Open *Activity.java and delete these two lines:
    	private boolean mToBeResumed = false;
    	private boolean mLostFocus = false;
    and add these instead:
    	private boolean mHasFocus = false;
    	private boolean mPlaying = false;

    And change onPause as:
    	<a href="https://forum.gideros.rocks/profile/Override" rel="nofollow">@Override</a>
    	protected void onPause()
    	{
    		if (mPlaying == true)
    		{
    			GiderosApplication.getInstance().onPause();
    			mGLView.onPause();
    			mPlaying = false;
    		}
     
    		super.onPause();
    	}

    Change onResume as:
    	<a href="https://forum.gideros.rocks/profile/Override" rel="nofollow">@Override</a>
    	protected void onResume()
    	{
    		super.onResume();
     
    		if (mHasFocus == true && mPlaying == false)
    		{
    			mGLView.onResume();
    			GiderosApplication.getInstance().onResume();
    			mPlaying = true;
    		}
    	}

    Change onWindowFocusChanged as:
    	<a href="https://forum.gideros.rocks/profile/Override" rel="nofollow">@Override</a>
    	public void onWindowFocusChanged(boolean hasFocus)
    	{
    		super.onWindowFocusChanged(hasFocus);
     
    		mHasFocus = hasFocus;
     
    		if (mHasFocus == true && mPlaying == false)
    		{
    			mGLView.onResume();
    			GiderosApplication.getInstance().onResume();
    			mPlaying = true;
    		}
    	}
    Also I'm attaching the modified version of AndroidTemplateActivity.java. You can directly copy this file to Templates/Eclipse/Android Template/src/com/giderosmobile/android/
    zip
    zip
    AndroidTemplateActivity.zip
    1K

    Likes: fxone

    +1 -1 (+1 / -0 )Share on Facebook
  • @atilim is this fix will be available on next version?
    have fun with our games~
    http://www.nightspade.com
  • @atilim I made changes that you suggest and it works fine, thanks. So i have to update all my latest apps now.

    Likes: zeroexu

    +1 -1 (+1 / -0 )Share on Facebook
  • Doubled. Do only i have problems with submitting posts now?
    chking
  • I still have this problem and receive bad marks from users for this. Why it isn't fixed yet?
  • @unlying: Your comment above
    @atilim I made changes that you suggest and it works fine, thanks. So i have to update all my latest apps now.
    would suggest that the fix worked but I think the fix was not actually applied to the most recent update. I only have V2012.09.02 installed here at work so I don't know if this is true or not but it is something to check.

  • I have full uninstall gideros, then install again and it looks like it is ok now. Keep testing.
Sign In or Register to comment.