@Override
public void handleBroadcast(Context context, Intent intent) throws JSONException {
ApptentiveLog.d(NOTIFICATION_INTERACTIONS, "Received broadcast");
logIntent(intent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
ContextUtils.getNotificationManager(context).createNotificationChannel(NotificationChannelHolder.getInstance());
}
Interaction.Type interactionType = Interaction.Type.parse(intent.getStringExtra(Constants.NOTIFICATION_EXTRA_INTERACTION_TYPE));
String interactionDefinition = intent.getStringExtra(NOTIFICATION_EXTRA_INTERACTION_DEFINITION);
if (interactionDefinition == null) {
ApptentiveLog.w("Interaction Notification Intent is missing extra %s", NOTIFICATION_EXTRA_INTERACTION_DEFINITION);
return;
}
InteractionNotificationAdapter interactionNotificationAdapter;
switch (interactionType) {
case TextModal:
interactionNotificationAdapter = DEFAULT_ADAPTER_NOTE;
break;
default:
ApptentiveLog.w("Attempted to launch Interaction as Notification, but that is not supported for the interaction type: %s", interactionDefinition);
return;
}
interactionNotificationAdapter.handleInteractionNotificationAction(context, NOTIFICATION_CHANNEL_DEFAULT, intent);
}