Activity 无法从通知栏打开

Activity Not opening from the notification bar

期待: 我在通知栏中显示多个通知。在此通知中,我有三个按钮,如 1、2 和 3。从通知中,如果单击 1 按钮,则它必须进入第一个 activity 如果单击 2 按钮,它必须进入第二个 activity 与 3 相同按钮也。

但我被困在下面:

1.显示多个通知 => 没问题 2. 但是,如果我单击第一个按钮,它将进入第一个 activity。(现在应用程序正在打开)当我单击第一个按钮时,通知状态栏中显示的一些其他通知不会打开第一个 activity

AirshipReceiver(推送接收器)

 @Override
protected boolean onNotificationOpened(@NonNull Context context, @NonNull NotificationInfo notificationInfo, @NonNull ActionButtonInfo actionButtonInfo) {
    Log.i(TAG, "Notification action button opened. Button ID: " + actionButtonInfo.getButtonId() + ". NotificationId: " + notificationInfo.getNotificationId());
    Toast.makeText(context.getApplicationContext(),"Button Click",Toast.LENGTH_LONG).show();
    Log.e("@@@@@@@ID", String.valueOf(notificationInfo.getNotificationId()));
    Log.e("$$", String.valueOf(notificationInfo.getMessage().getAlert()));
    Log.e("eGSSSHKJHSHJS", (String) notificationInfo.getMessage().getPushBundle().get("AlarmJson"));
    String pushjson=(String) notificationInfo.getMessage().getPushBundle().get("AlarmJson");
    ***if(actionButtonInfo.getButtonId()!=null && actionButtonInfo.getButtonId().equalsIgnoreCase("Graph")) {
        Log.e("Graph","You clicked Graph");
        Toast.makeText(context.getApplicationContext(),"Graph Click",Toast.LENGTH_LONG).show();
        Intent i = new Intent(context.getApplicationContext(), **ResultActivity**.class);
        i.putExtra("From", "from@@#graphicViewRoute");
        i.putExtra("Pushjson","json@@"+pushjson);
        //i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK |Intent.FLAG_ACTIVITY_CLEAR_TOP |Intent.FLAG_ACTIVITY_SINGLE_TOP);
        context.startActivity(i);
        return true;***

    }
    else if(actionButtonInfo.getButtonId()!=null && actionButtonInfo.getButtonId().equalsIgnoreCase("DD"))
    {
        Log.e("DD","You clicked DD");
        Intent i = new Intent(context.getApplicationContext(), **ResultActivity**.class);
        i.putExtra("From", "from@@#ddviewRoute");
        i.putExtra("Pushjson","json@@"+pushjson);
        i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(i);

        return true;

    }

    // Return false here to allow Urban Airship to auto launch the launcher
    // activity for foreground notification action buttons
    return false;
}

ResultActivity.class:

public class ResultActivity extends CordovaActivity{
public static boolean mIsInForegroundMode;
public static String PREF_FILE = "eG_sp";
@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    Log.e("ResultActivity","You ResultActivity");
    Bundle extras = getIntent().getExtras();
    String pushPage = extras.getString("From");
    String pushJSON = extras.getString("Pushjson");
    Toast.makeText(getApplicationContext(),"ResultActivity Click",Toast.LENGTH_LONG).show();
    Log.e("ResultActivity",pushPage+pushJSON);

    //super.loadUrl("file:///android_asset/www/index.html");
    SharedPreferences.Editor editor = getSharedPreferences(PREF_FILE, MODE_APPEND).edit();
    editor.putString("pushPage", pushPage);
    editor.putString("pushJSON",pushJSON);
    editor.commit();
    super.loadUrl("file:///android_asset/www/index.html");
}
@Override
protected void onPause(){
    super.onPause();
    mIsInForegroundMode = false;
}
@Override
protected void onResume() {
    super.onResume();
    mIsInForegroundMode=true;
}
@Override
protected void onStop() {
    super.onStop();
    mIsInForegroundMode=false;
}
@Override
protected void onStart() {
    super.onStart();
    mIsInForegroundMode=true;
}
@Override
public void onDestroy() {
    LOG.d(TAG, "CordovaActivity.onDestroy()");
    super.onDestroy();
    mIsInForegroundMode=false;
}

}

我有如下所示的 setFloags。现在它正在工作。

 i.setFlags (Intent.FLAG_ACTIVITY_CLEAR_TASK| Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK | Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);