darryncampbell / darryncampbell-cordova-plugin-intent

General purpose intent shim layer for cordova appliations on Android. Handles various techniques for sending and receiving intents.
MIT License
86 stars 136 forks source link

Build breaks with FileProvider in manifest #61

Closed cabaird closed 5 years ago

cabaird commented 5 years ago

When building with another plugin or library that uses FileProvider, and has it in its manifest, the merge of these manifests fails. I saw that there was another issue brought up to address this, but was closed with the comment to install the camera plugin first. This solution may work for some, but not for others, and is not an option when using a library that has this provider defined in the manifest. My suggestion is that you create a custom FileProvider, which just extends FileProvider:

package com.darryncampbell.cordova.plugin.intent;

public class CordovaPluginIntentFileProvider extends android.support.v4.content.FileProvider {
}

and then change the name in the manifest to use the custom provider:

<provider
     android:name=".CordovaPluginIntentFileProvider"
     android:authorities="${applicationId}.darryncampbell.cordova.plugin.intent.fileprovider"
     android:exported="false"
     android:grantUriPermissions="true">
     <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/provider_paths"/>
</provider>

This will provide the exact same functionality, but avoid any issues with other FileProviders that may be in use.

darryncampbell commented 5 years ago

Thanks for the great suggestion! I don't have time right now to make the changes but I'll flag this as pending and hopefully get round to it at some point.

darryncampbell commented 5 years ago

Thanks again for the suggestion, I have made the change in 1.1.2