Sunday, March 3, 2013

Re: [android-developers] Re: two activities running at same time

i think everyone just forgot to mention the obvious and what you seemed to get wrong:
At no point what so ever were your activity and the other acitvity running at the same time.

Only one activity can be running (as in "Resumed" state) at a time.  Android has one UI thread, if you're using it, someone else is waiting.

In your instance what happens is that your activity is launching, pausing the other app and then giving control back once it is done. It doesn't matter that it has no UI. I've used such activities myself and they have the nasty habit of making the phone appear unresponsive - even without a UI, it is still the "top" app, thus whatever app is behind it, while appearing to run, will not recieve any input commands and most likely have the UI itself hault.  Since its only for a brief state, no one is the wiser.

Either way, you should take TreKing's suggestion, you should not be using a activity for this, rather a Service (which btw, is an activity without a UI) with a background thread.


On Sunday, March 3, 2013 2:00:25 AM UTC+2, ga...@deanblakely.com wrote:
TreKing.  You gressed it.  Broadcast receiver.  It's an activity that runs for about 600 - 700 mills. 
On Saturday, March 2, 2013 11:05:23 AM UTC-7, TreKing wrote:

On Sat, Mar 2, 2013 at 10:36 AM, ga...@deanblakely.com <ga...@deanblakely.com> wrote:
Well, the app reliably works while other activities are running and when the phone is locked.

This may be the case in your testing, but this is not guaranteed. Your app can and will be killed at any point while it's in the background to make room for other components as the system requires. You will find this out quite quickly once you release the app users who manage to get into these type of edge-cases.

It sounds like you should be using a Service.
 
You send the phone a text and you get back the phones location.  It doesn't have to be running.  In fact it never has to run.  It just has to be installed on the phone.

Obviously it does have to run at some point to do anything. Maybe it runs in response to a Broadcast instead of user interaction but it doesn't just magically work without actually running some code.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate