-2
予想: 通知バーに複数の通知を表示しています。この通知では、1、2、3のような3つのボタンがあります。通知から1ボタンをクリックすると、2ボタンをクリックすると3ボタンのように2番目のアクティビティに移動する必要があります。再びアクティビティ通知バーから開くのではありません
1つ以上の通知=>いいえ問題 2を表示しないが、私はそれが第一の活動を行っている1番目のボタンをクリックした場合(これでアプリが開いている):
しかし、私は下に立ち往生しています。それが第一の活動
AirshipReceiverを開いていない通知のステータスバーに表示されているように、私は1回目のボタンにいくつかの他の通知をクリックしたときに
@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", "[email protected]@#graphicViewRoute");
i.putExtra("Pushjson","[email protected]@"+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", "[email protected]@#ddviewRoute");
i.putExtra("Pushjson","[email protected]@"+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;
}
}
通知の作成に使用するコードを投稿してください。 –
@David Wasser投稿を更新しました。 plsそれをチェックしてください –
申し訳ありませんが、私はここに**通知**を作成するコードは表示されません。通知を作成するコードを投稿してください –