react-native-chottulink-sdk
v1.0.5
Published
ChottuLink - Best DeepLink provider and drop-in replacement for Firebase Dynamic Links. Comprehensive DeepLink solution for Native Android, iOS, Flutter, and React Native. One link for both Apple Store and Google Play Store. Number one developer's choice
Downloads
309
Readme
ChottuLink React Native SDK LEGACY
ChottuLink is the best DeepLink provider and drop-in replacement for Firebase Dynamic Links. Our comprehensive DeepLink solution supports Native Android, iOS, Flutter, and React Native applications with one link for both Apple Store and Google Play Store.
✨ Key Features
🔥 Drop-in Replacement for Firebase Dynamic Links - Seamless migration from Firebase
💻📱 Cross-Platform Support - Native Android, iOS, Flutter, and React Native
🔗 One Link, Multiple Stores - Single link works for both Apple Store and Google Play Store
⚡ Lightning Fast - Optimized for performance and reliability
📊 Advanced Analytics - Comprehensive tracking and insights
🛡️ Enterprise Ready - Scalable solution for businesses of all sizes
📲 App Deep Linking - Navigate users directly to specific app screens
📧 Marketing Campaigns - Track email campaigns with custom parameters
📱 Social Media Sharing - Share app content with dynamic links
🛒 E-commerce - Drive users to specific products or offers
🔄 Firebase Migration - Easy migration from Firebase Dynamic Links
React Native Compatibility
- React Native: Minimum version 0.67.3
- Node.js: Minimum version 16
Expo Compatibility
⚠️ Important: This SDK requires custom native modules and is not compatible with Expo Go.
Supported:
- ✅ Expo Dev Build - Full functionality available
- ✅ Bare React Native - Full functionality available
- ❌ Expo Go - Not supported
For Expo users: Use Expo Dev Build instead of Expo Go.
📦 Installation
$ npm install react-native-chottulink-sdk --save
iOS Configuration
To enable deep link handling on iOS, you need to add the following methods to your AppDelegate.m:
// ... existing imports ...
#import "React/RCTLinkingManager.h"
@implementation AppDelegate
// ... existing code ...
// Add these methods for deep link handling
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [RCTLinkingManager application:app openURL:url options:options];
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
return [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
}
@endAndroid Configuration
If you encounter build issues on Android, try the following:
- Update Gradle version in
android/build.gradle:
buildscript {
ext {
// Change gradle to 7.4.2
gradleVersion = "7.4.2"
}
}- Add exclusion configuration in
android/app/build.gradle:
android {
// ... existing config
configurations.all {
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
}
}🚀 Quick Start
1. Initialize the SDK
import { initializeChottuLink } from 'react-native-chottulink-sdk';
// Initialize with your API key
initializeChottuLink('your-api-key-here');2. Create Dynamic Links
⚠️ Deprecated: The
createLinkfunction has been deprecated. Please usecreateDynamicLinkinstead.
Using createDynamicLink (Recommended)
import { createDynamicLink } from 'react-native-chottulink-sdk';
const linkConfig = {
destinationURL: 'https://your-app.com/screen/123',
domain: 'your-domain.chottu.link',
iosBehaviour: 2, // 1 = browser, 2 = app
androidBehaviour: 1, // 1 = browser, 2 = app
linkName: 'custom-link-name', // Optional: Custom name for the link
selectedPath: 'custom-path', // Optional: Custom path for the link
socialTitle: 'Check out this amazing content!',
socialDescription: 'Discover what\'s new in our app',
socialImageUrl: 'https://your-domain.com/image.jpg',
utmSource: 'email',
utmMedium: 'newsletter',
utmCampaign: 'welcome',
utmContent: 'header',
utmTerm: 'new-user'
};
try {
const result = await createDynamicLink(linkConfig);
console.log('Generated link:', result.shortURL);
} catch (error) {
console.error('Failed to create link:', error);
}Using createLink (Deprecated)
// ⚠️ This function is deprecated. Use createDynamicLink instead.
import { createLink } from 'react-native-chottulink-sdk';
const linkConfig = {
destinationURL: 'https://your-app.com/screen/123',
domain: 'your-domain.chottu.link',
iosBehaviour: 2, // 1 = browser, 2 = app
androidBehaviour: 1, // 1 = browser, 2 = app
socialTitle: 'Check out this amazing content!',
socialDescription: 'Discover what\'s new in our app',
socialImageUrl: 'https://your-domain.com/image.jpg',
utmSource: 'email',
utmMedium: 'newsletter',
utmCampaign: 'welcome',
utmContent: 'header',
utmTerm: 'new-user'
};
try {
const shortLink = await createLink(linkConfig);
console.log('Generated link:', shortLink);
} catch (error) {
console.error('Failed to create link:', error);
}3. Set up Event Listeners for the SDK
import { handleLink } from 'react-native-chottulink-sdk';
import { Linking } from 'react-native';
useEffect(() => {
const handleInitialURL = async () => {
const initialUrl = await Linking.getInitialURL();
if (initialUrl) {
handleLink(initialUrl);
}
};
handleInitialURL().then();
}, []);
useEffect(() => {
const subscription = Linking.addEventListener('url', event => {
handleLink(event.url);
});
return () => subscription?.remove();
}, []);4. Handle Incoming Links
import { NativeEventEmitter, NativeModules } from 'react-native';
const { ChottuLinkEventEmitter } = NativeModules;
const eventEmitter = new NativeEventEmitter(ChottuLinkEventEmitter);
// Called when a deep link or deferred link is successfully resolved
const deepLinkSubscription = eventEmitter.addListener(
'ChottuLinkDeepLinkResolved',
data => {
// Tip: ➡️ Navigate to a specific page or take action based on the link
console.log('Deep link resolved:', data);
console.log('URL:', data.url);
console.log('Metadata:', data.metadata);
},
);
// Called when there's an error resolving the deep link
const deepLinkErrorSubscription = eventEmitter.addListener(
'ChottuLinkDeepLinkError',
data => {
console.log('❌ Deep link error:', data);
console.log('Original URL:', data.originalURL);
console.log('Error:', data.error);
},
);5. (Optional) Get AppLink Data from the Deeplink URL directly
import { getAppLinkDataFromUrl } from 'react-native-chottulink-sdk';
try {
const linkData = await getAppLinkDataFromUrl('https://your-domain.chottu.link/abc123');
console.log('Link data:', linkData);
} catch (error) {
console.error('Failed to extract link data:', error);
}Expected Output:
{
"isDeferred": false,
"link": "https://your-app.com/screen/123",
"shortLink": "your-domain.chottu.link/abc123",
"shortLinkRaw": "https://your-domain.chottu.link/abc123?fbclid=12345678"
}🏷️ Keywords
deep link, dynamic link, firebase replacement, react native deep link, ios deep link, android deep link, flutter deep link, app linking, universal link, app store link, play store link, campaign tracking, deeplink sdk, mobile deep linking, cross platform deep link
