Close all activities and services for an app?

by Mark Murphy » Thu, 15 Jul 2010 01:30:01 GMT


Sponsored Links
 


Do not do this.


Call finish() in your activity if they decline the terms of service.


Please do not do this in production code.


Fix your launch activity.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
Available!

--



Close all activities and services for an app?

by Boozel » Thu, 15 Jul 2010 01:40:36 GMT


 finish() doesnt stop the service or any other activities that are
running, any way to stop all things in this package?
How do I "Fix my launch activity"?







--


Sponsored Links


Close all activities and services for an app?

by Mark Murphy » Thu, 15 Jul 2010 01:52:14 GMT


 


I told you not to build your app this way. You did not listen. I will
say it again: your concept of having a service that opens a terms of
service activity is a mistake. Do not build your app this way.

You can call stopService() to stop your service. Redesign your
application such that there are no other activities open. Then,
finish() on your terms-of-service activity will be all that is needed.


How should I know? Android does not magically cause "the launch
activity automatically starts aggin" if it was already destroyed
(finish(), BACK button, etc.). Something is calling startActivity() to
start it up again. LogCat may give you some clues.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
Available!

--



Close all activities and services for an app?

by Nathan » Thu, 15 Jul 2010 02:14:32 GMT


 


Don't start all that other stuff before they accept the terms of
service?

Nathan

--



Close all activities and services for an app?

by Boozel » Thu, 15 Jul 2010 04:48:43 GMT


 ou were correct, i tried to do it the way you suggested but ran into
a problem so tried the old way as a work around. It just caused more
issues though. i've re written it so the activity starts the service
and have got it all working.
Thanks,

The only issue i have is that when i have the second activity on the
screen (terms and conditions) and i kill it on the emulator via the
task list it restarts the first activity which restarts the second.
any ideas why? here is my log

07-14 22:43:20.885: INFO/ActivityManager(102): Starting activity:
Intent { act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER] flg=0x10200000
cmp=com.example.test/.bbClient }
07-14 22:43:21.465: INFO/ARMAssembler(102): generated
scanline__00000077:03545404_00000004_00000000 [ 47 ipp] (67 ins) at
[0x3894f0:0x3895fc] in 2346763 ns
07-14 22:43:22.175: INFO/ActivityManager(102): Start proc
com.example.test for activity com.example.test/.bbClient: pid=447
uid=10028 gids={3003, 1015}
07-14 22:43:23.086: DEBUG/ddm-heap(447): Got feature list request
07-14 22:43:23.595: INFO/ARMAssembler(102): generated
scanline__00000177:03515104_00000001_00000000 [ 73 ipp] (95 ins) at
[0x333200:0x33337c] in 1673319 ns
07-14 22:43:24.315: INFO/ActivityManager(102): Starting activity:
Intent { cmp=com.example.test/.TsandCs }
07-14 22:43:26.535: INFO/ActivityManager(102): Displayed activity
com.example.test/.TsandCs: 1936 ms (total 5325 ms)
07-14 22:43:26.916: INFO/ARMAssembler(102): generated
scanline__00000077:03545404_00000A04_00000000 [ 29 ipp] (51 ins) at
[0x3335c0:0x33368c] in 5497347 ns
07-14 22:43:31.506: DEBUG/dalvikvm(447): Calling exit(1)
07-14 22:43:31.635: DEBUG/Zygote(30): Process 447 exited cleanly (1)
07-14 22:43:31.685: INFO/ActivityManager(102): Process
com.example.test (pid 447) has died.
07-14 22:43:31.697: INFO/WindowManager(102): WIN DEATH:
Window{43c3d248 com.example.test/com.example.test.TsandCs
paused=false}
07-14 22:43:31.785: INFO/WindowManager(102): WIN DEATH:
Window{43c15e10 com.example.test/com.example.test.bbClient
paused=false}
07-14 22:43:32.075: INFO/ActivityManager(102): Start proc
com.example.test for activity com.example.test/.bbClient: pid=455
uid=10028 gids={3003, 1015}
07-14 22:43:32.805: DEBUG/ddm-heap(455): Got feature list request
07-14 22:43:33.265: INFO/UsageStats(102): Unexpected resume of
com.example.test while already resumed in com.example.test
07-14 22:43:33.875: INFO/ActivityManager(102): Starting activity:
Intent { cmp=com.example.test/.TsandCs }
07-14 22:43:35.025: WARN/InputManagerService(102): Got RemoteException
sending setActive(false) notification to pid 447 uid 10028
07-14 22:43:35.625: INFO/ActivityManager(102): Displayed activity
com.example.test/.TsandCs: 1388 ms (total 3802 ms)

and thanks again i really appreciate all the help.

On Jul 14, 7:47pm, Mark Murphy <mmur...@commonsware.com> wrote:

--



Close all activities and services for an app?

by Mark Murphy » Thu, 15 Jul 2010 04:54:04 GMT


 


What do you mean by "kill it on the emulator via the task list"? There
is no "task list" on the emulator. There's the process list in DDMS,
but terminating a process should not trigger an activity to be
started. There's the "most recent tasks" list (long press on HOME),
but that does not kill anything, but rather brings that task to the
foreground.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
Available!

--



Close all activities and services for an app?

by Boozel » Thu, 15 Jul 2010 05:00:12 GMT


 sorry i mean via the process list on DDMS.






--



Close all activities and services for an app?

by Mark Murphy » Thu, 15 Jul 2010 05:03:46 GMT


 


Like I said, I have no idea why/how terminating a process in DDMS
would trigger the launching of an activity. You have me stumped.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
Available!

--



Other Threads

1. Eclipse and debug perspective and <disconnected>DalvikVM[localhost:8600

Dear,

When pressing a button on my application, Eclipse ask me to open the
debug perspective and the application pauses (not stop, and no force
to close message).

I debug on a real device, and  if, after eclipse ask to open the debug
perspective, I disconnect my device from the computer, the game
continus as usual without any problem.

On the debug consol, I have got only :
<terminated> [Android Application]
        <disconnected>DalvikVM[localhost:8601]

I know whre the problem is from but I can't understand why :
I have got two buttons :
 1-  one a pause/play button that pauses the game
 2- the other permits to go to next screen. You can not go next screen
if it's on pause.

If I press to go next screen without having pressing the pause/play
button, no debug perspective is opened.

But If I press the pause/play button and after I press the go next
screen button, there the debug perspective asks to be opened.
What's really strange is that if I remove all action done from the
OnClickListener for the pause/play button, I still meet that problem.

I have no force to close message and If the device is disconnected
from the computer everything seems find.

Questions are : What's wrong ? How can I know more about ? Does that
bug could affect my application on real device ?

Regards,

Olivier




--~--~---------~--~----~------------~-------~--~----~

2. gsm modem during suspend

Hi all,

I would like to know how android deal with the problem of data buffering 
during mobile phone suspend.
This is a scenario:

linux start to suspend and no wakelock are acquired by any subsystem and 
the application that read from
the serial device is froozen, but the application does't know exaclty 
when it will go to sleep so it can
give this info to the gsm modem (rise up RTS). The modem is connected to 
the serial and try to send data,
linux buffer it but doesnt't give any info to the application. It can be 
happen or there is somenthing
wrong on this scenario?

Michael

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: 

3. Select NetPreference faild

4. Join and Earn $10,000 without any cost

5. Strange that it doesn't ask for permission

6. Android as a Universal Remote for CE/HA?