@Override public boolean launch(Context context, Interaction interaction) { if (!NotificationUtils.isNotificationChannelEnabled(context, NOTIFICATION_CHANNEL_DEFAULT)) { ApptentiveLog.e(NOTIFICATIONS, "Unable to engage notification interaction: notification channel is disabled"); return false; } final Intent launchIntent = new Intent(context, ApptentiveNotificationInteractionBroadcastReceiver.class); launchIntent.setAction(NOTIFICATION_ACTION_DISPLAY); launchIntent.putExtra(NOTIFICATION_EXTRA_INTERACTION_TYPE, interaction.getType().name()); launchIntent.putExtra(NOTIFICATION_EXTRA_INTERACTION_DEFINITION, interaction.toString()); context.sendBroadcast(launchIntent); return true; } }
deleteIntent.putExtra(NOTIFICATION_EXTRA_INTERACTION_TYPE, interaction.getType().name()); deleteIntent.putExtra(NOTIFICATION_EXTRA_INTERACTION_DEFINITION, interaction.toString()); deleteIntent.setAction(NOTIFICATION_ACTION_DELETE); intent.putExtra(NOTIFICATION_EXTRA_INTERACTION_TYPE, interaction.getType().name()); intent.putExtra(NOTIFICATION_EXTRA_INTERACTION_DEFINITION, interaction.toString()); intent.putExtra(NOTIFICATION_EXTRA_NOTE_ACTION_INDEX, i);
@Override public void handleInteractionNotificationAction(Context context, String channelId, Intent intent) { String action = intent.getAction(); String interactionString = intent.getStringExtra(NOTIFICATION_EXTRA_INTERACTION_DEFINITION); TextModalInteraction interaction; try { interaction = new TextModalInteraction(intent.getStringExtra(NOTIFICATION_EXTRA_INTERACTION_DEFINITION)); } catch (JSONException e) { ApptentiveLog.w(NOTIFICATION_INTERACTIONS, "Unable to parse interaction: %s", interactionString); logException(e); return; } if (StringUtils.equal(action, NOTIFICATION_ACTION_DISPLAY)) { actionDisplayNotification(context, channelId, interaction); } else if (StringUtils.equal(action, NOTIFICATION_ACTION_DELETE)) { actionDelete(context, interaction); } else if (StringUtils.equal(action, NOTIFICATION_ACTION_NOTE_BUTTON_PRESSED)) { actionButtonPressed(context, intent, interaction); } else { ApptentiveLog.w(NOTIFICATION_INTERACTIONS, "Unsupported action %s for Interaction type %s", action, interaction.getType().name()); } }
public static synchronized boolean engageInternal(Context context, Conversation conversation, Interaction interaction, String eventName) { return engage(context, conversation, "com.apptentive", interaction.getType().name(), interaction.getId(), eventName, null, null, (ExtendedData[]) null); }
public static synchronized boolean engageInternal(Context context, Conversation conversation, Interaction interaction, String eventName, String data) { return engage(context, conversation, "com.apptentive", interaction.getType().name(), interaction.getId(), eventName, data, null, (ExtendedData[]) null); }