4
알림을받은 후 앱이 메모리에없는 경우 문제가 발생합니다. 백 스택은 생성되지 않습니다. 개발자 가이드에 따라 단계를 수행했습니다. 제가 놓친 부분을 보여 주시길 바랍니다. 다음 의도로 수동으로 백 스택을 생성하기 위해 HomeActivity를 통해 모든 인 텐트를 라우트해야 할 것입니다.알림 PendingIntent에서 안드로이드 백 스택을 생성하지 않습니다.
의 AndroidManifest.xml
<activity
android:name=".activity.HomeActivity"
android:clearTaskOnLaunch="true"
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
android:icon="@drawable/actionbar_logo"
android:label="@string/activity_label_home"
android:launchMode="singleTask"
android:parentActivityName=".activity.Start"
android:windowSoftInputMode="stateAlwaysHidden" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.Start" />
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".activity.ChatActivity"
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
android:label="@string/activity_label_in_chat"
android:parentActivityName=".activity.HomeActivity"
android:windowSoftInputMode="stateHidden"
tools:ignore="UnusedAttribute" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.HomeActivity" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/vnd.myapp.chat" />
</intent-filter>
</activity>
건물 통지 액션 바에서 홈 클릭 처리에
final String chatId = cursor.getString(cursor.getColumnIndexOrThrow(MessageColumns.CHAT));
final Intent chat = new Intent(c, ChatActivity.class);
chat.putExtra(ChatActivity.EXTRA_CHAT_ID, chatId);
PendingIntent intent = TaskStackBuilder.create(c).addNextIntentWithParentStack (chat).getPendingIntent (0, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder (c);
final NotificationManagerCompat nm = NotificationManagerCompat.from (c);
builder
.setSmallIcon (R.drawable.ic_stat_notification)
.setContentIntent (intent)
.setGroup (GROUP_KEY_MYAPP)
.setGroupSummary (true);
Notification notification = builder.build();
nm.notify(NOTIFICATION_ID, notification);
:
public void onHomeActionDefault (final Activity baseActivity) {
Keyboard.close (baseActivity);
Intent upIntent = NavUtils.getParentActivityIntent (baseActivity);
if (null != upIntent) {
if (NavUtils.shouldUpRecreateTask (baseActivity, upIntent)) {
android.support.v4.app.TaskStackBuilder.create (baseActivity)
.addNextIntentWithParentStack (upIntent)
.startActivities();
} else {
NavUtils.navigateUpTo (baseActivity, upIntent);
}
} else {
NavUtils.navigateUpFromSameTask (baseActivity);
}
}
내가 여기없는거야 뭔가가 있나요?