Skip to main content

Installation

Gradle

Add the Bit2Connect Android SDK to your app’s build.gradle:

Maven

If you’re using Maven, add the dependency to your pom.xml:

Setup

1. Initialize the SDK

Initialize the SDK in your Application class:
Don’t forget to register your Application class in your AndroidManifest.xml:
Add deep link handling to your main activity:

3. Configure Android Manifest

Add the following to your AndroidManifest.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 context
  • apiKey (String): Your Bit2Connect API key
  • projectId (String): Your project ID
Example:
getInitialLink(intent: Intent?): DynamicLinkData?
Get the initial dynamic link that launched the app (if any). Parameters:
  • intent (Intent?): The intent that launched the activity
Returns: DynamicLinkData? Example:
getLinkFromIntent(intent: Intent?): DynamicLinkData?
Extract dynamic link data from an intent. Parameters:
  • intent (Intent?): The intent containing the link data
Returns: DynamicLinkData? Example:
validateLink(url: String, callback: (Boolean, DynamicLinkData?) -> Unit)
Validate a dynamic link URL. Parameters:
  • url (String): The dynamic link URL to validate
  • callback (Function): Callback with validation result and link data
Example:

DynamicLinkData

Represents the data from a dynamic link.

Properties

  • shortUrl (String): The shortened Bit2Connect URL
  • originalUrl (String): The original URL that was shortened
  • payload (Map<String, Any>?): Custom data associated with the link
  • createdAt (Date): When the link was created
  • expiresAt (Date?): When the link expires (if applicable)

Advanced Configuration

You can customize how links are processed by implementing a custom link handler:

Analytics Integration

Track link performance and user engagement:

Testing

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

Solution: Verify that your intent filters are correctly configured and that your app is properly signed.

Debug Tips

  1. Enable debug mode to see detailed logging
  2. Test with the Bit2Connect dashboard link tester
  3. Verify your app’s deep link configuration
  4. Check that your API key has the correct permissions
  5. Use adb to test deep links: adb shell am start -W -a android.intent.action.VIEW -d "https://b2co.link/abc12345" com.yourapp.package

Examples

E-commerce App

Social Media App