0
我需要在當前狀態下,打開應用程序打開我的應用程序,而我的主要胡亞蓉的任何新實例如何在當前狀態下,從通知
這裏是我的代碼
Intent intent = new Intent(baseActivity, MainActivity.class);
intent.putExtra("FROM_NOTIFICATION", true);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(baseActivity, 0 /* Request code */, intent,
PendingIntent.FLAG_ONE_SHOT);
和
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(baseActivity)
.setSmallIcon(getNotificationIcon()).setLargeIcon(BitmapFactory.decodeResource(baseActivity.getResources(), R.drawable.ic_launcher))
.setContentTitle(baseActivity.getResources().getString(R.string.app_name))
.setContentText(message)
.setOngoing(true)
.setContentIntent(pendingIntent);
notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
我該怎麼做?還是有另一種方式?
你的意思是「沒有任何我的主要靈敏度的新實例」? 舊實例在哪裏?你的意思是,如果你已經在應用程序中,它不應該重寫'舊'。 – Vucko
@Vucko是的。它是否可行? – kadik
是的,我現在不在我的筆記本電腦旁邊重新檢查我正在使用的內容,但我認爲它在'AndroidManifest.xml'中的'android:noHistory =「true」'''你想要的。如果這不起作用,我將不得不在4小時左右回覆你:D –
Vucko