This document details the APIs to enable Consent or Pay on your app or website.
ChoiceCmp.setUserSubscriptionStatus(SUBSCRIPTION_STATE)
ChoiceCmp.setUserSubscriptionStatus(SUBSCRIPTION_STATE);
We recommend you use this API:
onActionButtonClicked
will be triggered when the user clicks any of the Action buttons. The parameter actionButton
will contain the info about whether it’s ActionButton1 or ActionButton2.
override fun onActionButtonClicked(actionButton: ActionButton) {
/* code */
}
@Override
public void onActionButtonClicked(@NonNull ActionButton actionButton) {
// code
}
Ensure consent or pay is enabled in the portal and applicable for the country. To know more about Consent or Pay, see Overview.
[[ChoiceCmp shared] setUserLoginOrSubscriptionStatus:(BOOL)];
ChoiceCmp.shared.setUserLoginOrSubscriptionStatus(Bool)
This API is recommended to be used:
startChoice
API).
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Initialise InMobiCMP
[[ChoiceCmp shared] setUserLoginOrSubscriptionStatus:true];
[self startChoice];
return YES;
}
@main
class AppDelegate: UIResponder, UIApplicationDelegate, ChoiceCmpDelegate, CCPADelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ChoiceCmp.shared.setUserLoginOrSubscriptionStatus(true)
ChoiceCmp.shared.startChoice(pcode: "< YOUR PCODE >", delegate: self)
return true
}
}
ActionButtons
update.
(void) didReceiveActionButtonTapWithAction:(enum ActionButtons)action {
switch (action) {
case ActionButtonsAction1:
// Your implementation here..
break;
case ActionButtonsAction2:
// Your implementation here..
break;
default:
break;
}
}
func didReceiveActionButtonTap(action: ActionButtons) {
switch action {
case .action1:
// Your implementation here..
case .action2:
// Your implementation here..
}
}
didReceiveActionButtonTap
will be triggered when the user clicks any of the Action buttons. The parameter actionButton
will contain the info about whether it’s ActionButton1
or ActionButton2
.
(void) didReceiveActionButtonTapWithAction:(enum ActionButtons)action {
switch (action) {
case ActionButtonsAction1:
// Your implementation here..
break;
case ActionButtonsAction2:
// Your implementation here..
break;
default:
break;
}
}
func didReceiveActionButtonTap(action: ActionButtons) {
switch action {
case .action1:
// Your implementation here..
case .action2:
// Your implementation here..
}
}
If the user has consent or pay enabled, moves to more options screen, then rejects all the consents, and then saves and exits, it will be treated as action button 1 press, and the same delegate will be called with ActionButton
value as action1.
To indicate whether the user is subscribed, the publisher can set a JavaScript variable in the global window object. This can be used by the Consent Management Platform (CMP) to determine whether or not to display the consent popup.
window.__user_status = 'subscribed';
window.__user_status = 'subscribed';
when a user is confirmed to be subscribed.window.__user_status === 'subscribed'
), the CMP skips the consent popup display.By installing this SDK update, you agree that your Children Privacy Compliance setting remains accurate or that you will update that setting, whenever there is a change in your app's audience. You may update the app's Children Privacy Compliance settings at https://publisher.inmobi.com/my-inventory/app-and-placements.