How to use mobile app into whatsapp share link working?

流过昼夜 提交于 2019-12-11 17:46:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!