Skip to content

Instantly share code, notes, and snippets.

@aabhasr1
Created June 23, 2022 10:57
Show Gist options
  • Save aabhasr1/9a8be690f0c7735f23f70d2ee53021d5 to your computer and use it in GitHub Desktop.
Save aabhasr1/9a8be690f0c7735f23f70d2ee53021d5 to your computer and use it in GitHub Desktop.
String url = "upi://";
String gpay = "com.google.android.apps.nbu.paisa.user";
String phonepe = "com.phonepe.app";
String paytm = "net.one97.paytm";
String bhim = "in.org.npci.upiapp";
String others = "others.upiapp";
final Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
runOnUiThread(() -> {
if ("others.upiapp".equals(appPkg)) {
Intent chooser = Intent.createChooser(intent, "Pay with");
startActivityForResult(chooser, REQ_CODE_UPI);
} else {
intent.setPackage(appPkg);
startActivityForResult(intent, REQ_CODE_UPI);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment