revert to standard launchMode to get proper from-Launcher behavior and

specify a pair of flags when background-launching GamesList that
strips any stack it has and doesn't launch a new instance.  Seems to
fix the problems with launching from notifications and invite emails.
But then I've thought this fixed before.
This commit is contained in:
Andy2 2011-12-16 19:02:20 -08:00
parent 888b4f6701
commit 0d6b5914b9
2 changed files with 14 additions and 15 deletions

View file

@ -43,7 +43,7 @@
<activity android:name="GamesList" <activity android:name="GamesList"
android:label="@string/title_games_list" android:label="@string/title_games_list"
android:launchMode="singleTop" android:launchMode="standard"
android:configChanges="keyboardHidden|orientation" android:configChanges="keyboardHidden|orientation"
> >
<intent-filter> <intent-filter>

View file

@ -67,22 +67,19 @@ public class DispatchNotify extends Activity {
DbgUtils.logf( "DispatchNotify: nothing running" ); DbgUtils.logf( "DispatchNotify: nothing running" );
Intent intent = new Intent( this, GamesList.class ); Intent intent = new Intent( this, GamesList.class );
/* Flags. Tried Intent.FLAG_ACTIVITY_NEW_TASK. I don't // This combination of flags will bring an existing
* remember what it fixes, but what it breaks is easy to // GamesList instance to the front, killing any children
* duplicate. Launch Crosswords from the home screen making // it has, or create a new one if none exists. Coupled
* sure it's the only instance running. Get a networked game // with a "standard" launchMode it seems to work, meaning
* going, and with BoardActivity frontmost check the relay and // both that the app preserves its stack in normal use
* select a relay notification. New BoardActivity will come // (you can go to Home with a stack of activities and
* up, but if you hit home button then Crosswords icon you're // return to the top activity on that stack if you
* back to games list. Hit back button and you're back to // relaunch the app) and that when I launch from here the
* BoardActivity, and back from there back to GamesList. // stack gets nuked and we don't get a second GamesList
* That's because a new activity came up from the activity // instance.
* below thanks to the flag.
*/
intent.setFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP intent.setFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP
// Intent.FLAG_ACTIVITY_NEW_TASK NO See above | Intent.FLAG_ACTIVITY_SINGLE_TOP );
);
if ( null != relayIDs ) { if ( null != relayIDs ) {
intent.putExtra( RELAYIDS_EXTRA, relayIDs ); intent.putExtra( RELAYIDS_EXTRA, relayIDs );
} else if ( null != data ) { } else if ( null != data ) {
@ -128,6 +125,7 @@ public class DispatchNotify extends Activity {
} }
} }
} }
DbgUtils.logf( "tryHandle(%s)=>%b", data.toString(), handled );
return handled; return handled;
} }
@ -148,6 +146,7 @@ public class DispatchNotify extends Activity {
} }
} }
} }
DbgUtils.logf( "tryHandle(%s)=>%b", relayIDs.toString(), handled );
return handled; return handled;
} }
} }