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"
android:label="@string/title_games_list"
android:launchMode="singleTop"
android:launchMode="standard"
android:configChanges="keyboardHidden|orientation"
>
<intent-filter>

View file

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