Android Integration Guide
π± Installation guide for Android
On Android, the best way to display the Blockchain.com Pay widget is using a Chrome Custom Tab
Here's some common ways to display a Chrome Custom Tab in your Android app:
Benefits:
Customizable UI for a consistent experience.
Speedy and secure with shared Chrome security settings.
Access to stored Chrome data like cards and passwords.
Google Pay integration for streamlined payments.
Jetpack Compose
Add the AndroidX Browser Library to your project
implementation 'androidx.browser:browser:<version>'Launch a Chrome Custom Tab
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
BcPaySampleTheme {
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
val context = LocalContext.current
Button(onClick = ::launchBcPay) {
Text("Launch Blockchain.com Pay")
}
}
}
}
}
private fun launchBcPay() {
val widgetUrl = "https://www.blockchain.com/pay/widget?apiKey=[your-api-key]"
val intent = CustomTabsIntent.Builder().build()
intent.launchUrl(
this@MainActivity,
Uri.parse(widgetUrl)
)
}
}Android View System
Add the AndroidX Browser Library to your project
Launch a Chrome Custom Tab
React Native
Customizing a Chrome Custom Tab (Android View System and Jetpack Compose)
Set the toolbar color for both light and dark modes:
Set the enter and exit animations for the tab:
For additional integration and customization instructions please refer to Google's Integration Guide for Chrome Custom Tabs.
Using these in-app chrome tabs can elevate your app's performance and user experience.
Last updated