从我的应用程序共享whatsapp时出错

时间:2016-06-13 16:00:51

标签: android

我正在尝试从我的应用分享图片和文字。数据来自服务器。我的网页链接是这个

<a rel="nofollow" href="whatsapp://send?text=Bhulne Ke Tujhe Najaane Kitne Waade Karte Hai, 
Kaise Bhulayun Tujhe Ye Sochkar Tujhe Yaad Karte Hai,
Jab Bhi Hota Hai Zikar Jamaane Me Pyar Aur Wafa Ka, 
To Tumhe Bewafa Ke Bahaane Yaad Karte Hai!
"><span class="whatsapp">&nbsp;</span></a>  

http://way2enjoy.com/app/jokestest.php

if (url.startsWith("whatsapp")) {
    Uri uri = Uri.parse(url);
    String result = uri.getQuery().split("=")[1];
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_TEXT, "" + result);
    intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + result));
    intent.setType("image/*");
    //  intent.setType("text/plain");
    intent.setPackage("com.whatsapp");
    startActivity(intent);
    return true;

但我收到错误&#34;分享失败请再试一次&#34; 。我已经允许存储

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

0 个答案:

没有答案