Installation
Gradle
Add the Bit2Connect Android SDK to your app’sbuild.gradle:
Maven
If you’re using Maven, add the dependency to yourpom.xml:
Setup
1. Initialize the SDK
Initialize the SDK in your Application class:AndroidManifest.xml:
2. Configure Deep Link Handling
Add deep link handling to your main activity:3. Configure Android Manifest
Add the following to yourAndroidManifest.xml:
API Reference
Bit2ConnectSDK
The main SDK class for handling dynamic links.Methods
initialize(context: Context, apiKey: String, projectId: String)
Initialize the Bit2Connect SDK with your API credentials.
Parameters:
context(Context): Application contextapiKey(String): Your Bit2Connect API keyprojectId(String): Your project ID
getInitialLink(intent: Intent?): DynamicLinkData?
Get the initial dynamic link that launched the app (if any).
Parameters:
intent(Intent?): The intent that launched the activity
DynamicLinkData?
Example:
getLinkFromIntent(intent: Intent?): DynamicLinkData?
Extract dynamic link data from an intent.
Parameters:
intent(Intent?): The intent containing the link data
DynamicLinkData?
Example:
validateLink(url: String, callback: (Boolean, DynamicLinkData?) -> Unit)
Validate a dynamic link URL.
Parameters:
url(String): The dynamic link URL to validatecallback(Function): Callback with validation result and link data
DynamicLinkData
Represents the data from a dynamic link.Properties
shortUrl(String): The shortened Bit2Connect URLoriginalUrl(String): The original URL that was shortenedpayload(Map<String, Any>?): Custom data associated with the linkcreatedAt(Date): When the link was createdexpiresAt(Date?): When the link expires (if applicable)
Advanced Configuration
Custom Link Handling
You can customize how links are processed by implementing a custom link handler:Analytics Integration
Track link performance and user engagement:Testing
Test Dynamic Links
You can test your integration using the Bit2Connect dashboard or API:Debug Mode
Enable debug logging to troubleshoot issues:Best Practices
Error Handling
Always handle potential errors when processing dynamic links
User Experience
Provide fallback navigation for invalid or expired links
Security
Validate link data before processing to ensure security
Performance
Cache link data when appropriate to improve app performance
Troubleshooting
Common Issues
Links not being received
Links not being received
Solution: Ensure your app is properly configured for deep linking and
the SDK is initialized before handling links.
App not opening from links
App not opening from links
Solution: Check that your Android manifest includes the correct intent
filters and that your app is set as the default handler for Bit2Connect links.
Intent filters not working
Intent filters not working
Solution: Verify that your intent filters are correctly configured and
that your app is properly signed.
Debug Tips
- Enable debug mode to see detailed logging
- Test with the Bit2Connect dashboard link tester
- Verify your app’s deep link configuration
- Check that your API key has the correct permissions
- Use
adbto test deep links:adb shell am start -W -a android.intent.action.VIEW -d "https://b2co.link/abc12345" com.yourapp.package