benbahrenburg / benCoding.Android.Tools

A collection of utilities designed to make working with Titanium on Android alittle easier.
Other
59 stars 36 forks source link

Document argument for `restartApp` #10

Closed FokkeZB closed 10 years ago

FokkeZB commented 10 years ago

I see restartApp() has an argument for a day that default to 15000ms: https://github.com/benbahrenburg/benCoding.Android.Tools/blob/master/src/bencoding/android/tools/PlatformProxy.java#L68-L75

Why is this a string? And why - if the default is 15000ms - do I see the app restarting almost instantly?

dbankier commented 10 years ago

See my comment here: https://github.com/dbankier/TiShadow/issues/373#issuecomment-62973184

benbahrenburg commented 10 years ago

@FokkeZB usually you don't have numbers as nulls....since it is optional it is provide as a string.

It uses the standard alarm function, so feel free to debug.

FokkeZB commented 10 years ago

@benbahrenburg So the method (only) takes a string like this?

platform.restartApp('0');

Also, relating to our use case for https://github.com/dbankier/TiShadow/issues/373#issuecomment-62973184 - any thoughts on the best way to have TiShadow restart an app asap?

benbahrenburg commented 10 years ago

@FokkeZB is it the exit part of the restart part you are having issues with? @dbankier seemed to indicate everything is working as expected.

dbankier commented 10 years ago

@benbahrenburg, this issue is that android.os.Process.killProcess(android.os.Process.myPid()); which is basically your exitApp(), the OS interprets as a crash and restart the app immediately.

i.e.:

  1. The result is exitApp() doesn't exit, it restarts.
  2. restartApp() restarts the app twice.
benbahrenburg commented 10 years ago

Have you tried just calling finish(); ?

dbankier commented 10 years ago

finish()?

benbahrenburg commented 10 years ago

The finish() method was mentioned in a post on SO. At the moment I'm not near a computer with the mobile stack installed. Will be able to try something different alittle later this week.