簡體   English   中英

無需休閑即可進行單項活動的通知意圖

[英]Notification intent to single activity without recreation

我有webview應用程序,並且有兩種類型的GCM通知:“新線程”和“新回復線程”。 因此,當用戶單擊通知之一時,此時Webview應該打開適當的網頁之一。 我申請了

Intent intent = new Intent(this, MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT);

並將android:launchMode="singleTask"到活動清單中。 那就是我如何避免webview重新創建頁面的整個過程。 但是我有一個問題:如何在MainActivity中列出Intent以進一步更改Webview的位置?

如果是Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP不是我需要的標志,然后請告訴我如何避免在void onCreate(Bundle savedInstanceState)完全Webview void onCreate(Bundle savedInstanceState) savedInstanceState == null一直以來,如何保存上一個Webview實例?

@Override
protected void onNewIntent(Intent intent)

是解決方案。 感謝pskink

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM