0
我正在從oneignal接收來自服務發送的actionButton的通知。我如何處理這些按鈕並處理他們的事件?如何使用現有的動作按鈕
protected boolean onNotificationProcessing(final OSNotificationReceivedResult receivedResult) {
OverrideSettings overrideSettings = new OverrideSettings();
// here I am getting the data sent thtough oneSignal
final JSONObject additionalData = receivedResult.payload.additionalData;
// here I am getting my buttons
final List<OSNotificationPayload.ActionButton> actionButtons = receivedResult.payload.actionButtons;
overrideSettings.extender = new NotificationCompat.Extender() {
@Override
public NotificationCompat.Builder extend(NotificationCompat.Builder builder) {
try {
// Here I am creating my own button and adding it to the notification
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:" + phoneNumber));
PendingIntent pendingIntentCall = PendingIntent.getActivity(MyService.this, 12345, intent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.addAction(R.drawable.phone_notif,getString(R.string.call),pendingIntentCall);
} catch (Exception e) {
}
return builder;
}
};
return true
}
如何處理從一個信號接收到的actionButton事件?他們似乎,但是當我點擊他們時,他們的行爲就像我點擊通知一樣...