### API POST Request Example (Bash)
Source: https://github.com/streamize-llc/firebase-dynamic-link-alternative/blob/main/README.md
Demonstrates a simple POST request to the DEPL API to create a deeplink. Requires an authorization header with an API key and a JSON payload containing app parameters.
```bash
curl https://depl.link/api/deeplink \
-X POST \
-H "Authorization: Bearer API_KEY" \
-d '{"app_params": {"screen": "home"}}'
```
--------------------------------
### DEPL - iOS Universal Links Integration
Source: https://context7.com/streamize-llc/firebase-dynamic-link-alternative/llms.txt
Integrate DEPL's deep linking into your iOS application using native Universal Links. This guide explains how to configure your app to handle incoming deep link URLs without needing an SDK.
```APIDOC
## iOS Universal Links Integration
### Description
Handles deep links in iOS apps using native Universal Links. This integration intercepts incoming URLs and routes them to the correct content within the application.
### Method
N/A (Client-side integration)
### Endpoint
N/A (Configured via Associated Domains)
### Setup
1. **Add Associated Domains capability in Xcode:**
- Go to your app's target settings.
- Under 'Signing & Capabilities', add the 'Associated Domains' capability.
- Add your domain in the format `applinks:yourapp.depl.link`.
### Code Implementation
```swift
import UIKit
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
// Extract URL from Universal Link
guard let url = userActivity.webpageURL else { return false }
// Parse the slug from URL
let slug = url.lastPathSegment
// Fetch deep link parameters from your backend
fetchDeepLinkData(slug: slug) { params in
// Navigate to specific screen based on params
if let screen = params["screen"] as? String {
self.navigateToScreen(screen, params: params)
}
}
return true
}
func fetchDeepLinkData(slug: String?, completion: @escaping ([String: Any]) -> Void) {
guard let slug = slug else { return }
// Make API call to retrieve link parameters
// Replace with your actual backend endpoint
let url = URL(string: "https://your-backend.com/api/deeplink/(slug)")!
URLSession.shared.dataTask(with: url) {
data, response, error in
if let data = data,
let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any] {
DispatchQueue.main.async {
completion(json)
}
}
}.resume()
}
func navigateToScreen(_ screen: String, params: [String: Any]) {
// TODO: Implement navigation logic based on screen and parameters
// Example:
// switch screen {
// case "promo":
// let promoVC = PromoViewController()
// promoVC.promoId = params["promo_id"] as? String
// self.window?.rootViewController?.present(promoVC, animated: true)
// default:
// break
// }
print("Navigating to screen: \(screen) with params: \(params)")
}
}
```
### Notes
- Ensure your server is configured to serve the `apple-app-site-association` file for Universal Links to work correctly.
- The `fetchDeepLinkData` function is a placeholder and should be replaced with your actual data fetching mechanism.
```
--------------------------------
### E-commerce Deep Link Creation (JavaScript)
Source: https://github.com/streamize-llc/firebase-dynamic-link-alternative/blob/main/README.md
Provides an example of creating a deep link for an e-commerce product using a hypothetical `createDeepLink` function. It includes parameters for slug, app-specific routing, and social media metadata for rich sharing.
```javascript
// Create product link
const link = await createDeepLink({
slug: `product-${productId}`,
app_params: {
screen: 'product_detail',
product_id: productId
},
social_meta: {
title: product.name,
description: product.description,
thumbnail_url: product.image
}
});
```
--------------------------------
### Handle iOS Universal Links with DEPL (Swift)
Source: https://context7.com/streamize-llc/firebase-dynamic-link-alternative/llms.txt
This Swift code demonstrates how to handle Universal Links in an iOS application without a dedicated SDK. It shows how to configure associated domains in Xcode and uses the `UIApplicationDelegate` to intercept incoming URLs, parse the slug, fetch deep link parameters from a backend, and navigate to the appropriate screen.
```swift
// Add Associated Domains capability in Xcode:
// applinks:yourapp.depl.link
import UIKit
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
// Extract URL from Universal Link
guard let url = userActivity.webpageURL else { return false }
// Parse the slug from URL
let slug = url.lastPathSegment
// Fetch deep link parameters from your backend
fetchDeepLinkData(slug: slug) { params in
// Navigate to specific screen based on params
if let screen = params["screen"] as? String {
self.navigateToScreen(screen, params: params)
}
}
return true
}
func fetchDeepLinkData(slug: String?, completion: @escaping ([String: Any]) -> Void) {
guard let slug = slug else { return }
// Make API call to retrieve link parameters
let url = URL(string: "https://your-backend.com/api/deeplink/(slug)")!
URLSession.shared.dataTask(with: url) { data, response, error in
if let data = data,
let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any] {
completion(json)
}
}.resume()
}
func navigateToScreen(_ screen: String, params: [String: Any]) {
// Route to appropriate view controller
// Implementation depends on your navigation structure
}
}
```
--------------------------------
### Branch.io SDK - Deep Link Creation - JavaScript
Source: https://context7.com/streamize-llc/firebase-dynamic-link-alternative/llms.txt
Create deep links using the Branch.io SDK, which includes built-in attribution tracking. This method requires SDK integration and offers advanced features like A/B testing and fraud detection. It allows for defining custom app parameters and social sharing metadata.
```javascript
// Requires Branch SDK installation and initialization
// npm install branch-sdk
import branch from 'branch-sdk';
// Initialize Branch (typically in app startup)
branch.init('key_live_xxxxxxxxxxxxx', (err, data) => {
if (err) {
console.error('Branch initialization failed:', err);
return;
}
console.log('Branch initialized:', data);
});
// Create a deep link with attribution parameters
branch.link({
channel: 'instagram',
feature: 'sharing',
campaign: 'summer_campaign',
stage: 'promo',
tags: ['summer', 'sale', '2024'],
data: {
// Open Graph tags for social sharing
'$og_title': 'Summer Sale - 50% Off!',
'$og_description': 'Limited time offer on all products',
'$og_image_url': 'https://cdn.example.com/sale.jpg',
// Custom app parameters
screen: 'promo',
promo_id: 'summer2024',
discount_code: 'SUMMER50',
// Deep link routing
'$deeplink_path': 'promo/summer-sale',
'$ios_url': 'https://apps.apple.com/app/yourapp',
'$android_url': 'https://play.google.com/store/apps/details?id=com.yourapp'
}
}, (err, link) => {
if (err) {
console.error('Link creation failed:', err);
return;
}
console.log('Deep link created:', link);
// Output: https://yourapp.app.link/abc123xyz
});
// Pricing: Starting at $299/month for 10,000 MAU
// Setup time: ~2 hours
// SDK size: iOS ~2.5MB, Android ~500KB
```
--------------------------------
### E-commerce Product Deep Link Generation and Tracking
Source: https://context7.com/streamize-llc/firebase-dynamic-link-alternative/llms.txt
This JavaScript class implements a service for creating shareable deep links for e-commerce products, including rich social media previews. It also includes a method for tracking link clicks via analytics. The service handles API calls to DEPL and provides a fallback URL in case of errors.
```javascript
// Complete e-commerce product sharing implementation
const DEPL_API_KEY = 'your_api_key_here'; // Replace with your actual API key
class ProductDeepLinkService {
async createProductLink(product) {
try {
const response = await fetch('https://depl.link/api/deeplink', {
method: 'POST',
headers: {
'Authorization': `Bearer ${DEPL_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
slug: `product-${product.id}`,
app_params: {
screen: 'product_detail',
product_id: product.id,
product_sku: product.sku,
category: product.category,
source: 'share'
},
social_meta: {
title: `${product.name} - ${product.price}`,
description: product.description,
thumbnail_url: product.images[0],
keywords: product.tags.join(', ')
}
})
});
if (!response.ok) {
throw new Error(`API Error: ${response.status}`);
}
const data = await response.json();
return {
success: true,
url: data.deeplink_url,
slug: `product-${product.id}`
};
} catch (error) {
console.error('Failed to create deep link:', error);
return {
success: false,
error: error.message,
fallbackUrl: `https://yourwebsite.com/products/${product.id}` // Replace with your actual website domain
};
}
}
async trackLinkClick(slug) {
// Analytics tracking
await fetch(`https://your-analytics.com/track`, { // Replace with your analytics endpoint
method: 'POST',
body: JSON.stringify({
event: 'deep_link_clicked',
slug: slug,
timestamp: Date.now()
})
});
}
}
// Usage
const linkService = new ProductDeepLinkService();
const product = {
id: '12345',
sku: 'SHIRT-BLU-M',
name: 'Blue Cotton Shirt',
price: '$29.99',
description: 'Comfortable 100% cotton shirt, perfect for casual wear',
category: 'clothing',
tags: ['shirts', 'men', 'casual', 'blue'],
images: ['https://cdn.example.com/shirt.jpg']
};
// Assuming async context for await
(async () => {
const result = await linkService.createProductLink(product);
if (result.success) {
console.log('Share URL:', result.url);
// Output: https://yourapp.depl.link/product-12345
// When user clicks, track the event
await linkService.trackLinkClick(result.slug);
} else {
console.log('Fallback URL:', result.fallbackUrl);
}
})();
// The generated link will show rich preview on social media:
// - Title: "Blue Cotton Shirt - $29.99"
// - Description: "Comfortable 100% cotton shirt..."
// - Image: Product photo
// - Opens app directly to product detail screen
```
--------------------------------
### DEPL API Endpoint
Source: https://github.com/streamize-llc/firebase-dynamic-link-alternative/blob/main/README.md
Example of creating a deeplink using the DEPL API. This endpoint allows for custom app parameters and social media meta tags.
```APIDOC
## POST /api/deeplink
### Description
Creates a new deep link using the DEPL service. This is useful for directing users to specific content or screens within your application.
### Method
POST
### Endpoint
`https://depl.link/api/deeplink`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **app_params** (object) - Required - Parameters to be passed to the application. Example: `{"screen": "home"}`
- **social_meta** (object) - Optional - Social media metadata for link previews. Example: `{"title": "Product Name", "description": "Product Description", "thumbnail_url": "http://example.com/image.jpg"}`
### Request Example
```json
{
"app_params": {
"screen": "product_detail",
"product_id": "12345"
},
"social_meta": {
"title": "Awesome Gadget",
"description": "Check out this amazing gadget!",
"thumbnail_url": "https://example.com/gadget.png"
}
}
```
### Response
#### Success Response (200)
- **link** (string) - The generated deep link URL.
#### Response Example
```json
{
"link": "https://yourapp.depl.link/product-12345"
}
```
```
--------------------------------
### Integrate AppsFlyer OneLink for Deep Linking (JavaScript)
Source: https://context7.com/streamize-llc/firebase-dynamic-link-alternative/llms.txt
Integrate deep linking with AppsFlyer's attribution platform using their SDK. This snippet demonstrates initializing the SDK, creating OneLink deep links with campaign and deep link parameters, and handling incoming deep links for navigation. It requires the AppsFlyer SDK for React Native.
```javascript
// Requires AppsFlyer SDK installation
// npm install react-native-appsflyer
import appsFlyer from 'react-native-appsflyer';
// Initialize AppsFlyer SDK (required before creating links)
appsFlyer.initSdk({
devKey: 'your_appsflyer_dev_key',
isDebug: false,
appId: '123456789', // iOS App ID
onInstallConversionDataListener: true,
onDeepLinkListener: true,
timeToWaitForATTUserAuthorization: 10
}, (result) => {
console.log('AppsFlyer initialized:', result);
}, (error) => {
console.error('AppsFlyer initialization error:', error);
});
// Create OneLink deep link
function createAppsFlyerLink(campaignData) {
const oneLinkURL = 'https://yourapp.onelink.me/abc123'; // Your OneLink template
const params = {
// Campaign parameters
channel: campaignData.channel, // e.g., 'facebook'
campaign: campaignData.campaign, // e.g., 'summer_sale_2024'
ad: campaignData.adName, // e.g., 'carousel_ad_1'
ad_set: campaignData.adSet, // e.g., 'interests_audience'
// Deep link data
deep_link_value: 'promo/summer',
deep_link_sub1: 'summer2024',
deep_link_sub2: 'discount_50',
// Custom parameters
af_dp: 'yourapp://promo/summer', // Deep link path
af_web_dp: 'https://yoursite.com/summer', // Web fallback
// Attribution window (optional)
af_click_lookback: '7d'
};
// Build OneLink URL with parameters
const queryString = Object.entries(params)
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
.join('&');
const deepLinkURL = `${oneLinkURL}?${queryString}`;
console.log('OneLink created:', deepLinkURL);
return deepLinkURL;
// Output: https://yourapp.onelink.me/abc123?channel=facebook&campaign=summer_sale_2024...
}
// Handle incoming deep links
appsFlyer.onDeepLink((res) => {
if (res?.deepLinkStatus === 'FOUND') {
const { deep_link_value, deep_link_sub1, deep_link_sub2 } = res.data;
console.log('Deep link received:', {
path: deep_link_value,
promoId: deep_link_sub1,
discountCode: deep_link_sub2,
campaign: res.data.campaign,
mediaSource: res.data.media_source
});
// Navigate to appropriate screen
navigateToScreen(deep_link_value, res.data);
}
});
// Pricing: Starting at $299/month
// Setup time: ~3 hours
// Best for: Marketing teams with large ad budgets
```
--------------------------------
### Migrate Firebase Dynamic Links to DEPL Backend
Source: https://context7.com/streamize-llc/firebase-dynamic-link-alternative/llms.txt
This snippet shows the backend code transformation from Firebase Dynamic Links to DEPL's REST API. It handles the creation of short links, requiring only endpoint and authentication updates. No SDK is needed for mobile apps.
```javascript
// BEFORE: Firebase Dynamic Links
const admin = require('firebase-admin');
async function createFirebaseLink(productId, productData) {
const shortLink = await admin.dynamicLinks().createShortLink({
longDynamicLink: `https://example.page.link/?link=https://example.com/products/${productId}&apn=com.example.app&ibi=com.example.app`,
suffix: { option: 'SHORT' }
});
return shortLink.shortLink;
}
// AFTER: DEPL REST API
const DEPL_API_KEY = process.env.DEPL_API_KEY;
async function createDEPLLink(productId, productData) {
const response = await fetch('https://depl.link/api/deeplink', {
method: 'POST',
headers: {
'Authorization': `Bearer ${DEPL_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
slug: `product-${productId}`,
app_params: {
screen: 'product_detail',
product_id: productId,
category: productData.category
},
social_meta: {
title: productData.name,
description: productData.description,
thumbnail_url: productData.image
}
})
});
if (!response.ok) {
throw new Error(`DEPL API error: ${response.status}`);
}
const data = await response.json();
return data.deeplink_url;
// Returns: https://yourapp.depl.link/product-123
}
// Usage example
async function shareProduct(productId) {
const product = await getProduct(productId); // Assuming getProduct is defined elsewhere
const deepLink = await createDEPLLink(productId, {
name: product.title,
description: product.summary,
image: product.imageUrl,
category: product.category
});
console.log('Share this link:', deepLink);
return deepLink;
}
// Migration time: ~30 minutes for backend changes
// No SDK overhead: 0 KB added to mobile apps
```
--------------------------------
### Handle Universal Links in iOS (Swift)
Source: https://github.com/streamize-llc/firebase-dynamic-link-alternative/blob/main/README.md
This Swift code example shows how to handle Universal Links in an iOS application to manage deep links. It integrates with the `UIApplicationDelegate` to capture incoming web URLs, extract a 'slug' from the URL's last path segment, and suggests initiating a data fetch based on this slug. This approach does not require a dedicated SDK.
```swift
// Just handle Universal Links - no SDK needed
func application (_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
guard let url = userActivity.webpageURL else { return false }
let slug = url.lastPathSegment
fetchDeepLinkData(slug: slug) // Your own API call
return true
}
```
--------------------------------
### Create Deep Link via DEPL REST API (Bash)
Source: https://context7.com/streamize-llc/firebase-dynamic-link-alternative/llms.txt
This snippet demonstrates how to create a deep link using DEPL's REST API. It requires an API key for authentication and accepts parameters for the link slug, app-specific data, and social media metadata. The output includes a success status and the generated deep link URL.
```bash
# Create a deep link with app parameters and social metadata
curl https://depl.link/api/deeplink \
-X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"slug": "summer-sale",
"app_params": {
"screen": "promo",
"promo_id": "summer2024"
},
"social_meta": {
"title": "Summer Sale - 50% Off!",
"thumbnail_url": "https://cdn.example.com/sale.jpg"
}
}'
# Expected Response:
# {
# "success": true,
# "deeplink_url": "https://yourapp.depl.link/summer-sale"
# }
# Pricing:
# - Free: 100 links/month, 1,000 clicks
# - Pro: $9/month - 1,000 links, 50,000 clicks
# - Enterprise: Custom pricing
```
--------------------------------
### Android App Links Integration - Kotlin
Source: https://context7.com/streamize-llc/firebase-dynamic-link-alternative/llms.txt
Integrate native Android App Links to handle deep links without requiring an external SDK. This involves configuring intent filters in the AndroidManifest.xml and processing the incoming link data within an Activity. It allows for custom routing based on link parameters.
```kotlin
// AndroidManifest.xml
//
//
//
//
//
//
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.coroutines.launch
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import java.net.URL
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// Handle incoming deep link
handleDeepLink()
}
private fun handleDeepLink() {
val uri = intent.data ?: return
val slug = uri.lastPathSegment
if (slug != null) {
fetchDeepLinkData(slug) { params ->
// Navigate to appropriate screen
val screen = params["screen"] as? String
when (screen) {
"promo" -> navigateToPromo(params)
"product_detail" -> navigateToProduct(params)
else -> navigateToHome()
}
}
}
}
private fun fetchDeepLinkData(slug: String, callback: (Map) -> Unit) {
lifecycleScope.launch(Dispatchers.IO) {
try {
val url = URL("https://your-backend.com/api/deeplink/$slug")
val response = url.readText()
val params = parseJson(response) // Implement JSON parsing
withContext(Dispatchers.Main) {
callback(params)
}
} catch (e: Exception) {
// Handle error
}
}
}
private fun navigateToPromo(params: Map) {
// Navigate to promo screen with parameters
}
private fun navigateToProduct(params: Map) {
// Navigate to product detail screen
}
private fun navigateToHome() {
// Navigate to home screen
}
}
// Test deep link with ADB:
// adb shell am start -W -a android.intent.action.VIEW -d "https://yourapp.depl.link/summer-sale"
```
--------------------------------
### DEPL - REST API Deep Link Creation
Source: https://context7.com/streamize-llc/firebase-dynamic-link-alternative/llms.txt
Create deep links programmatically using DEPL's REST API. This endpoint allows you to generate deep links with custom slugs, app parameters, and social media metadata without requiring SDK integration.
```APIDOC
## POST /api/deeplink
### Description
Creates a deep link using the DEPL REST API. Supports custom slugs, app parameters, and social metadata for enhanced deep linking capabilities.
### Method
POST
### Endpoint
https://depl.link/api/deeplink
### Parameters
#### Headers
- **Authorization** (string) - Required - Bearer token for authentication.
- **Content-Type** (string) - Required - application/json
#### Request Body
- **slug** (string) - Required - The unique identifier for the deep link.
- **app_params** (object) - Optional - Parameters to be passed to the mobile application.
- **screen** (string) - Required within app_params - The target screen in the app.
- **promo_id** (string) - Optional - A specific promotion ID.
- **social_meta** (object) - Optional - Metadata for social media sharing.
- **title** (string) - Required within social_meta - The title for social previews.
- **thumbnail_url** (string) - Required within social_meta - The URL for the social media thumbnail.
### Request Example
```json
{
"slug": "summer-sale",
"app_params": {
"screen": "promo",
"promo_id": "summer2024"
},
"social_meta": {
"title": "Summer Sale - 50% Off!",
"thumbnail_url": "https://cdn.example.com/sale.jpg"
}
}
```
### Response
#### Success Response (200)
- **success** (boolean) - Indicates if the deep link creation was successful.
- **deeplink_url** (string) - The generated deep link URL.
#### Response Example
```json
{
"success": true,
"deeplink_url": "https://yourapp.depl.link/summer-sale"
}
```
```
--------------------------------
### Test Deep Links on Android using ADB (Bash)
Source: https://context7.com/streamize-llc/firebase-dynamic-link-alternative/llms.txt
Test deep link functionality on Android devices using ADB commands. This method allows simulating various deep link scenarios, including basic links, product links, campaign links, and links with query parameters. It also includes commands to verify app link configuration and clear app data.
```bash
# Basic deep link test
adb shell am start -W -a android.intent.action.VIEW \
-d "https://yourapp.depl.link/test"
# Test with specific product link
adb shell am start -W -a android.intent.action.VIEW \
-d "https://yourapp.depl.link/product-12345"
# Test with promo campaign link
adb shell am start -W -a android.intent.action.VIEW \
-d "https://yourapp.depl.link/summer-sale"
# Test with query parameters
adb shell am start -W -a android.intent.action.VIEW \
-d "https://yourapp.depl.link/promo?code=SUMMER50&source=email"
# Verify App Links are properly configured
adb shell dumpsys package d | grep yourapp.depl.link
# Expected output should show:
# - Domain verification status: verified
# - Your package name associated with the domain
# Clear app data before testing (useful for fresh install simulation)
adb shell pm clear com.yourapp.package
# Test referrer data (for attribution tracking)
adb shell am broadcast -a com.android.vending.INSTALL_REFERRER \
-n com.yourapp.package/com.yourapp.ReferrerReceiver \
--es "referrer" "utm_source=test&utm_campaign=summer"
# Common issues:
# - If link opens in browser: Check AndroidManifest.xml intent filters
# - If app doesn't open: Verify assetlinks.json is accessible at:
# https://yourapp.depl.link/.well-known/assetlinks.json
# - If wrong activity opens: Check android:launchMode in manifest
```
--------------------------------
### Branch.io SDK Initialization and Link Creation (JavaScript)
Source: https://github.com/streamize-llc/firebase-dynamic-link-alternative/blob/main/README.md
Shows how to initialize the Branch.io SDK with a live key and create a link using its API. This method requires prior SDK initialization.
```javascript
// Requires SDK initialization
branch.init('key_live_xxx');
branch.link({ data: {...} }, callback);
```
--------------------------------
### AppsFlyer SDK Initialization
Source: https://github.com/streamize-llc/firebase-dynamic-link-alternative/blob/main/README.md
Demonstrates the initialization process for the AppsFlyer SDK, which is necessary before utilizing its deep linking and attribution features. This involves configuring developer keys, app IDs, and listener settings.
```APIDOC
## AppsFlyer SDK Initialization
### Description
This code snippet shows how to initialize the AppsFlyer SDK. Proper initialization is crucial for enabling deep linking, conversion tracking, and other advanced features provided by AppsFlyer.
### Method
SDK Function
### Endpoint
N/A (SDK-based)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
N/A
### Request Example
```javascript
// Requires SDK + complex config
appsFlyer.initSdk({
devKey: 'YOUR_DEV_KEY',
isDebug: false,
appId: 'YOUR_APP_ID',
onInstallConversionDataListener: true,
onDeepLinkListener: true
});
```
### Response
This is an initialization function and does not return a direct response in the typical API sense. Success is usually indicated by the absence of errors during initialization and subsequent SDK operations.
```
--------------------------------
### Branch.io SDK Usage
Source: https://github.com/streamize-llc/firebase-dynamic-link-alternative/blob/main/README.md
Illustrates the basic initialization and link creation using the Branch.io SDK. Note that this requires SDK initialization with a live key.
```APIDOC
## Branch.io SDK Integration
### Description
This section provides a conceptual overview of using the Branch.io SDK for deep linking. It requires initialization with a live key and then allows for link creation via a callback function.
### Method
SDK Functions
### Endpoint
N/A (SDK-based)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
N/A
### Request Example
```javascript
// Requires SDK initialization
branch.init('key_live_xxx');
// Create a link
branch.link({
data: {
// Your custom data for the link
"screen": "home",
"product_id": "123"
}
}, function(err, link) {
if (err) {
console.error('Error generating link:', err);
return;
}
console.log('Generated Branch link:', link);
});
```
### Response
#### Success Response
- **link** (string) - The generated deep link URL.
#### Response Example
```json
{
"link": "https://your_branch_subdomain.app.link/your_generated_path"
}
```
```
--------------------------------
### AppsFlyer SDK Initialization (JavaScript)
Source: https://github.com/streamize-llc/firebase-dynamic-link-alternative/blob/main/README.md
Illustrates the initialization process for the AppsFlyer SDK, including essential configuration parameters such as developer key, app ID, and listeners for conversion and deep link data. This method requires SDK integration and complex configuration.
```javascript
// Requires SDK + complex config
appsFlyer.initSdk({
devKey: 'xxx',
isDebug: false,
appId: 'xxx',
onInstallConversionDataListener: true,
onDeepLinkListener: true
});
```
--------------------------------
### Create Short Link with Firebase Dynamic Links
Source: https://github.com/streamize-llc/firebase-dynamic-link-alternative/blob/main/README.md
Demonstrates how to create a short dynamic link using the Firebase Admin SDK. This code snippet is for the 'before' state during migration.
```javascript
const shortLink = await admin.dynamicLinks().createShortLink({
longDynamicLink: 'https://example.page.link/?link=...',
suffix: { option: 'SHORT' }
});
```
--------------------------------
### Handle App Links in Android
Source: https://github.com/streamize-llc/firebase-dynamic-link-alternative/blob/main/README.md
Demonstrates how to handle App Links natively in an Android application, replacing the Firebase Dynamic Links SDK. This involves updating the `build.gradle` file and adding an intent filter to the `AndroidManifest.xml`.
```kotlin
// Remove Firebase SDK from build.gradle
// implementation 'com.google.firebase:firebase-dynamic-links' ❌ Remove this
// Add intent filter in AndroidManifest.xml
```
--------------------------------
### Handle Universal Links in iOS
Source: https://github.com/streamize-llc/firebase-dynamic-link-alternative/blob/main/README.md
Shows how to handle Universal Links natively in an iOS application, replacing the Firebase Dynamic Links SDK. This involves configuring Associated Domains and implementing the `application(_:continue:restorationHandler:)` method.
```swift
// Remove Firebase SDK
// pod 'Firebase/DynamicLinks' ❌ Remove this
// Add Associated Domains in Xcode
// applinks:yourapp.depl.link
// Handle Universal Links (native iOS)
func application(_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
// Your handling code
}
```
--------------------------------
### Handle App Links in Android (Kotlin)
Source: https://github.com/streamize-llc/firebase-dynamic-link-alternative/blob/main/README.md
This Kotlin code snippet illustrates how to handle App Links in an Android application for deep linking. It's implemented within the `onCreate` method of an Activity, retrieves the deep link URI from the intent, extracts a 'slug' from the URI's last path segment, and suggests calling a function to fetch data based on the slug. This method avoids the need for an external SDK.
```kotlin
// Just handle App Links - no SDK needed
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val uri = intent.data
val slug = uri?.lastPathSegment
if (slug != null) {
fetchDeepLinkData(slug) // Your own API call
}
}
```
--------------------------------
### Test Deep Link on Android via ADB
Source: https://github.com/streamize-llc/firebase-dynamic-link-alternative/blob/main/README.md
Provides an ADB command to test deep links on an Android device, which is part of the migration testing phase.
```bash
adb shell am start -W -a android.intent.action.VIEW -d "https://yourapp.depl.link/test"
```
--------------------------------
### Generate Deep Link with Branch.io SDK
Source: https://github.com/streamize-llc/firebase-dynamic-link-alternative/blob/main/README.md
This JavaScript code snippet demonstrates how to generate a deep link using the Branch.io SDK. It requires the Branch SDK to be integrated into the project. The function takes parameters for the channel, feature, and data to be included in the link, and outputs the generated link.
```javascript
// Requires Branch SDK
branch.link({
channel: 'instagram',
feature: 'sharing',
data: {
'$og_title': 'Summer Sale',
'$og_description': '50% off',
screen: 'promo',
promo_id: 'summer2024'
}
}, (err, link) => {
console.log(link);
});
```
--------------------------------
### Create Deep Link with DEPL API (Bash)
Source: https://github.com/streamize-llc/firebase-dynamic-link-alternative/blob/main/README.md
This code snippet demonstrates how to create a deep link using the DEPL REST API. It requires an API key for authentication and sends a JSON payload containing link parameters and social media metadata. The expected output is a JSON response confirming success and providing the generated deep link URL.
```bash
curl https://depl.link/api/deeplink \
-X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"slug": "summer-sale",
"app_params": {
"screen": "promo",
"promo_id": "summer2024"
},
"social_meta": {
"title": "Summer Sale - 50% Off!",
"thumbnail_url": "https://cdn.example.com/sale.jpg"
}
}'
```
--------------------------------
### Create Deep Link with DEPL API
Source: https://github.com/streamize-llc/firebase-dynamic-link-alternative/blob/main/README.md
Illustrates how to create a deep link using DEPL's API. This 'after' state code replaces the Firebase Dynamic Links functionality.
```javascript
const response = await fetch('https://depl.link/api/deeplink', {
method: 'POST',
headers: {
'Authorization': `Bearer ${DEPL_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
slug: 'summer-sale',
app_params: {
screen: 'promo',
promo_id: 'summer2024'
}
})
});
const { deeplink_url } = await response.json();
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.