Skip to main content

iOS Integration

On this page you'll find integration guides for iOS platforms. Use the tabs to pick your framework.

React Native Integration

You will get the Consent URL after the Consent Creation API call.

Consent URL: https://www.indiaconsent.com/consent?cr_id=...&mobile_app=true&app_scheme=myapp

React Native Basic Implementation

import { useEffect } from 'react';
import { Linking, View } from 'react-native';

export default function ConsentScreen() {

useEffect(() => {

const CONSENT_URL = redirectUrl + '&mobile_app=true&app_scheme=myapp';
Linking.openURL(CONSENT_URL).catch(err =>
console.error('Failed to open URL:', err)
);

}, []);

return <View />;
}

Configure Info.plist:

<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.example.myapp</string>
<key>CFBundleURLSchemes</key>
<array>
<string>myapp</string>
</array>
</dict>
</array>

Listen for callbacks:

import { useEffect } from 'react';
import { Linking, View, Text } from 'react-native';

export default function ConsentDeepLinkHandler() {
useEffect(() => {
const handleDeepLink = ({ url }) => {
// URL comes from the deep link when app is opened via custom scheme (e.g., myapp://consent/callback?status=granted)
const isConsentCallback = url && url.includes('myapp://consent/callback');
if (isConsentCallback) {
const params = new URLSearchParams(url.split('?')[1]);
const status = params.get('status');

console.log('Consent completed:', { status });
}
};

const subscription = Linking.addEventListener('url', handleDeepLink);

Linking.getInitialURL().then((url) => {
if (url) {
handleDeepLink({ url });
}
});

return () => subscription?.remove();
}, []);

return (
<View>
<Text>Listening for consent deep links...</Text>
</View>
);
}