Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share image not work. #9

Open
MistryHiral opened this issue Jan 24, 2019 · 3 comments
Open

Share image not work. #9

MistryHiral opened this issue Jan 24, 2019 · 3 comments

Comments

@MistryHiral
Copy link

only first time share, the app is launched.
When I try the second time, I am getting an error (in WahtsApp share ) 'this file format not support'.
And i am using AdvancedShare.generic() method

E/DatabaseUtils(19589): java.lang.SecurityException: Permission Denial: reading android.support.v4.content.FileProvider uri content://com.example.wordguess.adv_provider/cache_files/1548324566.png from pid=27166, uid=10202 requires the provider be exported, or grantUriPermission()
E/DatabaseUtils(19589): 	at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:646)
E/DatabaseUtils(19589): 	at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:493)
E/DatabaseUtils(19589): 	at android.content.ContentProvider$Transport.enforceFilePermission(ContentProvider.java:484)
E/DatabaseUtils(19589): 	at android.content.ContentProvider$Transport.openTypedAssetFile(ContentProvider.java:429)
E/DatabaseUtils(19589): 	at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:313)
E/DatabaseUtils(19589): 	at android.os.Binder.execTransact(Binder.java:453)

@turanmahmudov
Copy link

this also affects me

@jawand
Copy link

jawand commented Mar 1, 2019

seems like this repo is dead 😞

@turanmahmudov
Copy link

turanmahmudov commented Mar 1, 2019

@MistryHiral @jawand I fixed the issue with this way.
In "android/src/main/java/in/mertcan/advancedshare/shareintents/Base.java" change this:

if (checkKey("url")) {
...
} 

to

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());
           }
       }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants