android 友盟QQ分享失败

QQ图片存储失败,请检查图片或者检查是否有读写权限

1.设置AndroidManifest.xml


android.permission.WRITE_EXTERNAL_STORAGE

android.permission.READ_EXTERNAL_STORAGE

2.没有sd卡,qq不能分享本地图片Activtiy里手动添加

3.如果使用 targetSdkVersion 23或23以上,需要做6.0适配,手动获取WRITE_EXTERNAL_STORAGE权限,否则QQ不能进行图片分享

private static final intREQUEST_EXTERNAL_STORAGE=1;

private staticString[]PERMISSIONS_STORAGE= {

Manifest.permission.READ_EXTERNAL_STORAGE,

Manifest.permission.WRITE_EXTERNAL_STORAGE

};


intpermission = ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);

if(permission != PackageManager.PERMISSION_GRANTED) {

// We don't have permission so prompt the user

ActivityCompat.requestPermissions(

this,

PERMISSIONS_STORAGE,

REQUEST_EXTERNAL_STORAGE

);

}

推荐阅读更多精彩内容