我的问题很简单,但我找不到答案。任务是从通知午餐活动,但如果活动正在运行,只需将数据传递给该活动。我的应用程序只是一个接一个的午餐活动,并不适合我。
Intent notificationIntent = new Intent(this, com.inyourcells.finelife.MainDesk.class);
notificationIntent.putExtra(MainDesk.CONFIRM_INDEX_PARAM, confirmIndex);
pIntent = PendingIntent.getActivity(this, id, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
builder = new Notification.Builder(getApplicationContext())
.setContentTitle(getString(R.string.new_operation))
.setContentText(getString(R.string.press_new_operation)+sum+MainDesk.CUR)
.setTicker(getString(R.string.ticker_new_operation)).setWhen(System.currentTimeMillis())
.setContentIntent(pIntent)
.setDefaults(Notification.DEFAULT_SOUND|Notification.DEFAULT_VIBRATE|Notification.DEFAULT_LIGHTS).setAutoCancel(true)
.setSmallIcon(R.drawable.accounts_icon);
}
答案 0 :(得分:2)
请尝试使用Manifest中的活动:
android:launchMode="singleTop"