Steps:
1: In your application Add code sinpet in manifest:
<queries>
<package android:name="com.payment.sdk" />
</queries>
2:In main Activity call SDK and pass parameters code snipet below:
fun startApplication(packageName: String) {
try {
val intent = Intent("android.intent.action.MAIN")
intent.addCategory("android.intent.category.LAUNCHER")
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION)
valresolveInfoList = packageManager.queryIntentActivities(intent, 0)
for (info in resolveInfoList) if (info.activityInfo.packageName.equals(
packageName, ignoreCase = true)) {
launchComponent(info.activityInfo.packageName, info.activityInfo.name)
return
}
// No match, so application is not installed
showInMarket(packageName)
} catch (e: Exception) {
showInMarket(packageName)
}
}
private fun launchComponent(packageName: String, name: String) {
val bundle = Bundle()
bundle.putString("amountStr",amountStr) // amount =0 for Balance Inquiry or Mini Statement
bundle.putString("transType",transactionType) // BE - BalanceEnquiry // CW - CashWithDrawal // MN - MiniStatement // AP - AadhaarPay // CD - CashDeposit
bundle.putString("orderID",binding.orderId.text.toString())
bundle.putString("submerchantID",binding.submerchantID.text.toString())
bundle.putString("shopName",binding.shopName.text.toString())
bundle.putString("brandName",binding.brandName.text.toString())
bundle.putString("sdkKey",binding.sdkKey.text.toString())
bundle.putString("merchantName",binding.merchantName.text.toString())
bundle.putString("merchantLoc",binding.merchantLoc.text.toString())
bundle.putString("serviceType",serviceType) //AEPS
val intent = Intent("android.intent.action.MAIN")
intent.addCategory("android.intent.category.LAUNCHER")
intent.component= ComponentName(packageName, name)
intent.putExtras(bundle)
intent.flags= Intent.FLAG_ACTIVITY_NEW_TASK
startActivity(intent)
}
private fun showInMarket(packageName: String) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=$packageName"))
intent.flags= Intent.FLAG_ACTIVITY_NEW_TASK
startActivity(intent)
}