Skip to content

Commit e22f474

Browse files
Dianne HackbornAndroid (Google) Code Review
authored andcommitted
Merge "Update documentation to reflect the old approach not working." into ics-mr1
2 parents b069833 + fa9b5ca commit e22f474

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

docs/html/guide/topics/ui/notifiers/notifications.jd

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -245,31 +245,27 @@ an application to be part of that application's UI flow, so simply launching the
245245
activity like this can cause it to be mixed with your normal application back stack
246246
in undesired ways. To make it behave correctly, in the manifest declaration
247247
for the activity the attributes
248-
<code>android:launchMode="singleInstance"</code> and
248+
<code>android:launchMode="singleTask"</code>,
249+
<code>android:taskAffinity=""</code> and
249250
<code>android:excludeFromRecents="true"</code>
250251
must be set. The full activity declaration for this sample is:</p>
251252

252253
{@sample development/samples/ApiDemos/AndroidManifest.xml interstitial_affinity}
253254

254-
<p>Because of the use of <code>singleInstance</code>, you must be careful about launching
255-
any other activities from this one. These activities will be launched
256-
in their own task, and care must be taken to make sure this interacts
257-
well with the current state of your application's task. This is essentially
255+
<p>You must be careful when launching other activities from this initial activity,
256+
because this is not a top-level part of the application, does not appear in
257+
recents, and needs to be relaunched at any point from the notification with new data
258+
to show. This best approach is to make sure any activity launched from it is
259+
launched in its own task. When doing this care must be taken to make sure this
260+
new task interacts well with the current state of your exiting application's
261+
task. This is essentially
258262
the same as switching to the main application as described for the Email style
259263
notification shown before. Given the <code>makeMessageIntentStack()</code>
260-
method previously shown, handling a click here would look something like this:</p>
264+
method previously shown, handling a click then would look something like this:</p>
261265

262266
{@sample development/samples/ApiDemos/src/com/example/android/apis/app/IncomingMessageInterstitial.java
263267
app_launch}
264268

265-
<p>If you don't want to use the <code>singleInstance</code> launch mode for
266-
this activity, an alternative approach is to use <code>android:taskAffinity=""</code>.
267-
This tells Android that the activity should not be treated as part of the
268-
main application flow, so it will not get mixed together with that. All of the
269-
other issues discussed here do still apply, though this would allow you to start
270-
additional activities that are part of this notification task instead of switching
271-
to and replacing the main application task.</p>
272-
273269
<h2 id="ManageYourNotifications">Managing your Notifications</h2>
274270

275271
<p>The {@link android.app.NotificationManager} is a system service that manages all

0 commit comments

Comments
 (0)