Open jmall opened 6 years ago
yess i'm too.. share image work only once...
I'm experiencing the same thing. This is the exception that is printed to console:
java.lang.SecurityException: Permission Denial: reading android.support.v4.content.FileProvider uri content://com.example.my_app.adv_provider/cache_files/1533772610.png from pid=1196, uid=10117 requires the provider be exported, or grantUriPermission
Same here, this needs fixing, it's useless without the fix. There is PR #4 that should fix this issue, however it did not work for me anyway, unfortunately. It works 100 % in emulator, but on my device (Xiaomi Mi A1) it crashes same as for the other guys.
Same problem with me. The solution only works twice.
My temporary fix is to store the image separately in external storage instead of using the cached one.
same ..
@lizhuoyuan @adiranas @jmall @gofur Hi, you can try a edit that for me fix the problem?
`public int share(Map params) { this.params = params; fileHelper = getFileHelper(params);
if (checkKey("title")) {
title = (String) params.get("title");
}
if (checkKey("msg")) {
intent.putExtra(Intent.EXTRA_TEXT, (String) params.get("msg"));
}
if (checkKey("subject")) {
intent.putExtra(Intent.EXTRA_SUBJECT, (String) params.get("subject"));
}
if (checkKey("url")) {
if (fileHelper.isFile()) {
List<ResolveInfo> resInfoList = registrar.context().getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
for (ResolveInfo resolveInfo : resInfoList) {
String packageName = resolveInfo.activityInfo.packageName;
registrar.context().grantUriPermission(packageName, fileHelper.getUri(), Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.putExtra(Intent.EXTRA_STREAM, fileHelper.getUri());
intent.setType(fileHelper.getType());
}
}
return 0;
}`
find and replace the share method of Base.java class. for me work, i will want a confirm from yuo. thank you
@juani21 Also works for me, thank you!
It would be perfect if you could share it with facebook and instagram.
Where to place this Share() method in a flutter and i am using this method
AdvancedShare.generic(msg: message, url: base64ImageUrl).then((response) {
handleResponse(response);
});
@lizhuoyuan @adiranas @jmall @gofur Hi, you can try a edit that for me fix the problem?
`public int share(Map params) { this.params = params; fileHelper = getFileHelper(params);
if (checkKey("title")) { title = (String) params.get("title"); } if (checkKey("msg")) { intent.putExtra(Intent.EXTRA_TEXT, (String) params.get("msg")); } if (checkKey("subject")) { intent.putExtra(Intent.EXTRA_SUBJECT, (String) params.get("subject")); } if (checkKey("url")) { if (fileHelper.isFile()) { List<ResolveInfo> resInfoList = registrar.context().getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); for (ResolveInfo resolveInfo : resInfoList) { String packageName = resolveInfo.activityInfo.packageName; registrar.context().grantUriPermission(packageName, fileHelper.getUri(), Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); } intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.putExtra(Intent.EXTRA_STREAM, fileHelper.getUri()); intent.setType(fileHelper.getType()); } } return 0; }`
find and replace the share method of Base.java class. for me work, i will want a confirm from yuo. thank you
@juani21 where is the Base.java file is located in the flutter project please
facing the same issue, anyone found the solution??
This works perfect, but only for the first time the app is launched. When I try the second time, I am getting an error (In gmail for instance) 'couldn't attach file' If I kill the App and restart, the sharing works again only once. Why?