I have a shopping website with base on WordPress with Woo-commerce, and installed UPI Payment Plugin. and also I have make Android APP for my website using Web View.
****Problem****
WebView everything worked correctly but I used UPI payment link in one page to redirect to upi payments ("upi://pay?pn=DevShop&pa=eshop@kotak&tr=40766&tn=OrderID40766&am=1149&cu=INR") like this link and I'm getting ERR_UNKNOWN_URL_SCHEME error
I want My UPI Payment Link as above when clicked it open in default UPI APP like BHIM, PayTM, PhonePe or etc.. and Rest will handle through the above apps. following are the links of targeted apps.
https://play.google.com/store/apps/details?id=com.google.android.apps.nbu.paisa.user
https://play.google.com/store/apps/details?id=in.org.npci.upiapp
https://play.google.com/store/apps/details?id=net.one97.paytm
https://play.google.com/store/apps/details?id=com.phonepe.app
https://play.google.com/store/apps/details?id=com.mobikwik_new
https://play.google.com/store/apps/details?id=com.freecharge.android
Following is my Code in MainActivity.java
package com.shop.dev;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends AppCompatActivity {
private WebView myWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myWebView = (WebView) findViewById(R.id.webView);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setAppCacheEnabled(true);
myWebView.loadUrl("http://192.168.1.14/mzdec");
myWebView.setWebViewClient(new WebViewClient());
}
@Override
public void onBackPressed() {
if(myWebView.canGoBack()) {
myWebView.goBack();
} else {
super.onBackPressed();
}
}
}
Following is my Code in AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:usesCleartextTraffic="true" android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Help to resolve the Error.
Following are the Error When Payment Made via UPI Link.