Everything works as it should just except the messenger chat, tel: and mailto: in webview here is the code
if (url.startsWith("mailto:")) {
//Handle mail Urls
startActivity(new Intent(Intent.ACTION_SENDTO, Uri.parse(url)));
return false;
} else {
if (url.startsWith("www.messenger.com")) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
return false;
} else {
if (url.startsWith("tel:")) {
startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse(url)));
return false;
}
I also tried using ACTION_VIEW in every case but still the same. And also this Uri.parse(url).getHost().equals("www.messenger.com") still the same For Messenger
2020-08-27 11:15:25.579 7442-7442/com.mesports.ga E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mesports.ga, PID: 7442
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=intent://user/102700191461284/?intent_trigger=mme&ref=c4254e87a85bef8dd4c3e74bc771d099dda9c6bb22e340c644&nav=discover&source=customer_chat_plugin&source_id=1507329&metadata={"referer_uri":"https:\/\/m-esports.ga\/f1ea937767db2f4"} }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2014)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1675)
at android.app.Activity.startActivityForResult(Activity.java:4586)
at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:676)
at android.app.Activity.startActivityForResult(Activity.java:4544)
at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:663)
at android.app.Activity.startActivity(Activity.java:4905)
at android.app.Activity.startActivity(Activity.java:4873)
at com.mesports.ga.MainActivity$MyWebviewClient.shouldOverrideUrlLoading(MainActivity.java:234)
at android.webkit.WebViewClient.shouldOverrideUrlLoading(WebViewClient.java:77)
at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(chromium-Monochrome.aab-stable-414712573:16)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:326)
at android.os.Looper.loop(Looper.java:160)
at android.app.ActivityThread.main(ActivityThread.java:6762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2020-08-27 11:15:27.238 7442-7442/com.mesports.ga I/Process: Sending signal. PID: 7442 SIG: 9
Edit : Mail and tel works now by declaring them earlier in code For messenger even this doesnt show the option to open with messenger
if (url.startsWith("intent")){
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_VIEW);
if (sendIntent.resolveActivity(getPackageManager()) != null) {
startActivity(sendIntent);
}
return true;
}
通过在其他条件之前声明它们来修复 tel 和 mailto
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.