问题
How do you use an HTML link to open the whatsapp on a mobile app ? this link works on website Example link:<a href="whatsapp://send?text=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F51533526%2Fhow-to-use-html-link-into-whatsapp-mobile-app%2F51533716%3Fnoredirect%3D1">Whatsapp Share </a>
This link is failing in the WhatsApp mobile app.
This is the error message:
ERR_UNKNOWN_URL_SCHEME
(same error => app into phone number click) I want to solve this problem on the front end side.
回答1:
The below code directly shares the Text to the Whatsapp app using Intent.
Intent textIntent = new Intent(Intent.ACTION_SEND);
textIntent.setType("text/plain");
textIntent.setPackage("com.whatsapp");
textIntent.putExtra(Intent.EXTRA_TEXT, "Your text here");
startActivity(textIntent);
来源:https://stackoverflow.com/questions/51607703/how-to-use-mobile-app-into-whatsapp-share-link-working