I am developing a 2d game using LibGdx framework , when i press HOME button and then resume the game it freezes for 3-4 secs as the textures are being reloaded . I have used AssetManager to load the TextureAtlas & then getting the images by findRegion . I referred to documentation for "Texture" (http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/Texture.html) and it mentions that " If the OpenGL context is lost all managed textures get invalidated. This happens when a user switches to another application or receives an incoming call. Managed textures get reloaded automatically.". I am confused what to avoid this delay !!
Kindly Help
Thanks
There will always be a delay on resuming the game.
This is because on android if you press home button or switch to another app a so called context loss occures.
When a context loss occurs on Android, it means that the operating system has decided to forcefully free the memory that was occupied with your loaded assets.
When you switch back to the game you need to reload these assets again to prevent the game from crashing and this reloading is reason for the delay.
Related
I'm using the AS3 Timer class to sync data between a Flex Mobile app and a server ideally every 30 mins then send a local (distriqt) Notification to the user when action is required.
However, when the device goes into sleep / hibernate mode it seems to slow down, even stop the Timer. I've tried using a lower interval (5mins) but it still only works intermittently.
This is very hard to test as the behavior is different in debug / run modes.
Any suggestions?
Thanks.
Sounds like you might need to change your approach here. Background operation of applications is very different from the foreground.
Your application will run for a little while (depending on the current device memory load among other things) and will then enter a suspended mode, mainly to preserve the application's memory state.
There are some background mode exceptions to this, such as audio playback and location updates, however if you aren't performing these then Apple will most likely reject your application as part of the review process.
You can also investigate the executeInBackground flag on the NativeApplication. This allows a long running task to execute in the background, however this does not guarantee that the application would run in the background continuously.
You can read more here: http://blogs.adobe.com/airodynamics/2012/05/04/air-ios-background-behavior/
UIBackgroundModes: https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW22
I'm having an issue where my flash project crashes during 'Crazy kid Testing' - Where we click the same button several times and then do the same on another button. If the same button is clicked repeatedly, 10-12 times, Flash Player (SWF) crashes.
Is there any method to automatically reload the page when flash crashes WITHOUT user input? This will be used on a Kiosk in Firefox (latest).
Vesper had the right idea when it comes to both using ExternalInterface and probing for memory leaks and resolving those leaks.
You should debug your Flash app for memory leaks first, because Flash
crashing is not a sign of good application. And if Flash would still
crash after all memory leaks eliminated, you should reduce the memory
footprint of your app. Anything beyond, and only a watchdog could save
you. – Vesper Jun 6 at 18:20
I'm working on an app using SharpDX to render DirectX content to a DrawingSurfaceBackgroundGrid in Windows Phone 8.
I've found that, if the app goes out to the photo picker or suspends/resumes through Fast Application Resume, memory utilization will increase by about ~2mb and prior resources will not be reclaimed. This means a DirectX-based app using DrawingSurfaceBackgroundGrid will eventually run out of memory on user-initiated actions.
The leak starts once DrawingSurfaceBackgroundGrid.SetBackgroundContentProvider is invoked with a SurfaceBackgroundContentProvider. I'm using a DrawingSurfaceBackgroundContentProviderNativeBase implementation that has empty method bodies for all abstract members.
An isolated repro can be found here. Repro steps are: build and run the app, click "choose photo", hit the hardware back button, observe memory spike.
Anyone else seeing similar?
This was a bug in SharpDX, which has been resolved in this commit.
Has anyone experienced a very slow resume when closing the dashboard of swarm? There is about a 5 second delay in my application where a black screen is displayed after the dashboard is closed and before the actually game screen is rendered. I had originally thought that maybe my show() method for the current was doing too much and causing the lag, but after looking a bit closer I see that the show() method is actually never even called when switching from the swarm dashboard back to the game, I suppose this is due to the fact that Swarm is not operating in a libgdx context but an android one.
Any help appreciated.
That's OpenGl context Loss. your assets need to be reloaded. If you have a lot of assets, you should separate them and load them when needed. That will help your game to feel much faster, especially when starting and when coming back from swarm dashboard.
I'm building an Adobe Air 2.5. desktop application with Flash CS 5. The apps filesize is 10 MB with a medium amount of movieclips, vector graphics, bitmaps and code in it. It takes around 8 seconds from clicking the desktop icon until the app is available to work with.
How to improve the startup time?
Thanks. Uli
I think that you can decrease load time by placing on stage strictly what you need to show when the app starts.You can draw the rest of the assets upon request, dynamically.
So don't just drag everything on-stage.Instead, instantiate and addChild() as needed.
Depending on the asset size, it might take a little time to load, but cetainly the user won't have to wait 10 seconds before he/she can use your app.
Maybe not all of your app's content will be viewed in every single session, so why put everything on stage from the beggining?