1

アクティビティA(スプラッシュアクティビティ)、アクティビティB(ホームアクティビティ)、アクティビティC(オファーアクティビティ)、アクティビティD(雑アクティビティ)があります。 >活動C->アクティビティDプッシュ通知の親アクティビティを維持するイベント

シナリオ - 活動A->アクティビティB:アプリケーション

一般的なアプリケーションフロー:私は2つのシナリオでオファー活動への適切なランディングを作成したいです閉じています。 (タスクマネージャには存在しません) 要件:プッシュ通知をクリックすると、ユーザーはアクティビティC(オファーアクティビティ)に直接着陸する必要があります。また、ボタンをクリックすると、ユーザーはアプリケーションを終了してはならず、アクティビティAを表示してからAをクリックすると終了する必要があります。 現在のシナリオ:今すぐ、通知が表示されたら、クリックすると、ユーザーはアクティビティCに移動しますが、その画面から戻ると、ユーザーは直接アプリケーションを終了します。なぜこれはそうですか?ここに私のparentactivityスタックコードは、プッシュ通知ランディングコード

  <activity 
      android:name=".OffersActivity" 
      android:screenOrientation="portrait" 
      android:theme="@style/AppTheme" 
      android:windowSoftInputMode="stateHidden"> 
      <meta-data 
       android:name="android.support.PARENT_ACTIVITY" 
       android:value="com.zotopay.zoto.HomeActivity" /> 
     </activity> 


     <activity 
      android:name=".HomeActivity" 
      android:screenOrientation="portrait" 
      android:windowSoftInputMode="adjustPan" 
      android:theme="@style/AppTheme" 
      > 
     </activity> 


    defaultConfig { 
     applicationId "com.zotopay.zoto" 
     minSdkVersion 14 
     targetSdkVersion 22 
     versionCode 1310145 
     versionName "1.4.5" 
    } 

です:

  Intent resultIntent = new Intent(this, OffersActivity.class); 
      TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); 
      // All the parents of OffersActivity will be added to task stack. 
      stackBuilder.addParentStack(OffersActivity.class); 
      // Add a SecondActivity intent to the task stack. 
      stackBuilder.addNextIntent(resultIntent); 

      PendingIntent contentIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); 

は、誰も私が私が間違っているのか知っている聞かせていただけますか?ホームアクティビティに着陸するのではなく、オファーアクティビティから戻るときにアプリケーションから退出することになります。

+0

<メタデータ アンドロイド:名=「android.support.PARENT_ACTIVITY」 アンドロイド:値=「ui.MainActivity」/> –

+0

pff、parentActivityNameはどこですか? –

+0

これら2つの公式ドキュメントhttp://developer.android.com/intl/ru/guide/topics/manifest/activity-element.html#parent –

答えて

1

私はカスタマイズされ、うまく動作します。

public class PushWooshManager extends BroadcastReceiver 
{ 
public void onReceive(Context context, Intent intent) 
{ 
    if (intent == null) 
     return; 

    Bundle pushBundle = PushManagerImpl.preHandlePush(context, intent); 
    if(pushBundle == null) 
     return; 
    JSONObject dataObject = PushManagerImpl.bundleToJSON(pushBundle); 

    Intent launchIntent =new Intent(MyApplication.getInstance().getApplicationContext(),YourDesired.class); 
    launchIntent.addCategory("android.intent.category.DEFAULT"); 
    launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); 
    launchIntent.putExtras(pushBundle); 
    launchIntent.putExtra(PushManager.PUSH_RECEIVE_EVENT, dataObject.toString()); 
    context.startActivity(launchIntent); 

    PushManagerImpl.postHandlePush(context, intent); 
} 
} 

これをmanifest.xmlに登録してください。プッシュウオッシュパネルからWOOSHを試してください。

あなたの活動C.ためparentActivityName属性を追加する必要がありますマニフェストINと古いデバイスメタデータの子供のための
関連する問題