I have an app in which I open a UPI app when user wants to purchase something. My app functionality of buying something works on most Android devices - user clicks buy, Android pops up a box prompting users to select a payment app, user selects the payment app of their choice, makes payment, and our app resumes. BUT on some Android devices triggering that upi:// scheme results in "no app can perform this action" - the payment app does not open; neither does the prompt to select a payment app.
Have tried various code approaches. Approach 1 was Application.OpenURL(), a function provided by Unity. The second was going native and using the below code. Both fail.
Question: "What" tells the Android OS that upi:// is a scheme and that some apps are able to "respond" to that. Is it baked inside Android, like http:// is? Or something else?
On the devices where upi:// does NOT work, a more direct deeplink specifically asking for an app, e.g. gpay://upi/pay? (Google Pay) does launch the intended app (Google Pay).
One devices where the upi:// works, the Android pops up a selection box asking users to select from various UPI applications installed on the system.
UPI == Unified Payment Interface; a system in place in India allowing people to pay money via their phones.
if (!url.startsWith("https") || !url.startsWith("http")) {
try {
Log.i("OctroPlugin","mitali shouldOverrideUrlLoading");
Intent i = new Intent(Intent.ACTION_VIEW,Uri.parse(url));
i.setData(Uri.parse(url));
startActivityForResult(Intent.createChooser(i, "Pay with..."), 2);