I have an droid as3 app that i need it to work on the device background, i know that the android os is lowering the fps to 4 when it's on background which is fine by me, but, if i leave my app open and close my phone after around 30 minutes the app gets terminated automatically. does someone knows if there is something to do to keep it alive untill the user stop it?
i undestand that there is something i can do such as using the
executeInBackground() function or something similar.
First thing I thought about was if there is a way to trigger a android service(to run on background) through Adobe air, and unfortunately adobe air cannot run as a service in the background or trigger a android service.
You may try to write an android service that runs things on background.
There is something I found here it may help you.
Related
So I've created a 'Sound App' that needs to run when the phone is locked.. After a minute of being locked the sound just cuts out. Anyone suggest a fix?
The app is created out of basic HTML5, css & js. Audio needs to continue playing when the phone is locked.
Thanks in advance! :D
You'll need to use a plugin that provides a background service. In order to preserve battery, mobile devices do not normally allow applications to continue to run once they lose focus. After a short period of time they are paused, and if RAM is required to run other apps, they might be stopped entirely. See the pause/resume events for a little more info: http://cordova.apache.org/docs/en/3.5.0/cordova_events_events.md.html#pause
Here's a project from devgeeks, who is an accomplished Cordova developer, regarding background audio on iOS: https://github.com/devgeeks/ExampleHTML5AudioStreaming -- also, this blog by Andrew Trice may be of value, he is also an experienced Cordova developer: http://www.tricedesigns.com/2012/01/25/low-latency-polyphonic-audio-in-phonegap
You might want to search for "cordova phonegap app background audio" for more solutions.
I hope you're all good. I am working on an android application project and I mostly use android emulator for testing the application. Android Emulator takes too much time for application loading and since I am working on the design I have to run the application after a few seconds again and again. Because of slow emulator I think my time is wasted and I can't focus on the work.
I recently tried my Galaxy Note for running application and its quite fast and running experience is much better. What I wanted to know is.. Does running eclipse project on my Phone will harm my mobile phone in any way?
Because moments back while using the phone the screen got stuck and the icons changed to different green, red and blue color. I restarted the phone and its acting normal now. But I wanted to know if it happened because of the eclipse project running on the phone? Is it safe ?
It is possible to harm your phone.
Apart from the wear and tear (YMMV) of repeatedly flashing your app to memory you may unwittingly (or otherwise) create a virus.
I've been in a situation where a thread has run amok after the app terminated and hogged the processor slowing things down. It did eventually quit though (possibly after elective rebooting). I've often had my phone restart when debugging on it. I wouldn't worry too much about that (although my domain was Samsung's bada, a lot less robust platform).
I don't see too many risks with Java apps as the language is so well managed. Native code is a risk in that, at least, a buffer overflow could place unwanted code outside of the process address space and so escape being cleaned up when the app quits. A shut down and/or force close may result from such errors.
I need to run my android application (written in Flex) in the system background, so that periodically performs some defined task. Unfortunately I can not find any hints on the Internet:( I would also like to know how such an application to restore from the system background?
Please help if you know the solution.
Thank you.
Best,
Martin
I need to run my android application (written in Flex) in the system
background, so that periodically performs some defined task
Technically you should be able to minimized it on launch; however for performance issues non active applications are throttled. That means everything--including timers--will run slower than expected. So, 1 second on your timer will not necessarily equal 1 second in the real world when the application is inactive.
Unless it will be okay for the user to manually trigger your tasks; you should consider an alternate technology for the implementation. AIR is just not usually suitable for background applications.
As the title says, is there any predefined time set in the operating system that will close any application after some time? in my application I have a process that takes around 5 seconds to complete in pure java. And I know that I should put this in a AsyncTask, just asking the clearify this. Thanks!
It varies from device to device and depends on what is running on the device.
Hope this example gives you a fair idea of what can happen.I'm currently developing an app that uses the camera via intent.
On the Acer Liquid, it went to the camera and returned but on the Sony Ericson Arc, the app was killed in the background almost immediately after the it left my app to go to the camera.
After a restart of the Arc and running the app again, it wasn't killed. Started a few other apps and tried again and it was killed. The Liquid on the other hand would keep the app running four hours in the background even if I started a bunch of other apps.
There is no standard, it varies from device to device, manufacturer to manufacturer and what's currently running at the time.
I couldn't find any good application for streaming MP3s from a URL that can run in the background that meets my requirements so I decided to write one myself. It turns out its incredibly easy to stream an MP3 with the native MediaPlayer if you're running Froyo or better, and I am.
But my problem is if I switch applications and try to keep the stream going (some of them last 2-4 hours) and play a game or something while i'm listening to it, it sometimes just dies. I'm not sure exactly what the problem is, my guess is that the Android system decided it was OK to kill that process... but it wasn't.
So is there something I can do to make it kill other processes if resources are needed instead of my streaming mp3 app?
What I have tried:
android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_AUDIO);
But it's no good.
You need to make the service a foreground service, if you haven't already. Foreground services have to display an icon in the notification bar, and the Android system will not kill them unless under extreme memory pressure.
Check out the documents for startForeground()
I found that after my Droid Incredible was updated to Gingerbread (2.3.4) all of a sudden it works. I made no changes at all, it just doesn't die in Gingerbread like it did in Froyo. I know there were media player improvements in Gingerbread so I'm going to have to assume there was a bug in Froyo that was fixed in Gingerbread.
As far as i know, a program can't be running forever, at some point the OS will kill it. But what you can try is to have a service and make it generate notifications once in a while with useful information. Then, start the activity again.
This is due to an activity Lifecycle. The OS might kill your app if it need memory. You might have to consider a service
I have had problems with memory management in my Android phone, which terminated processes like you described. You may consider installing a program like Android Booster to monitor available memory and close programs that are using too much memory, so that the programs you would like to keep open have enough memory to run.