Skip to content

Commit 1dafbd6

Browse files
authored
Merge pull request #67 from Dhaval2404/feature/v1.8
Fixed The application could not be installed: INSTALL_FAILED_CONFLICTING_PROVIDER issue
2 parents 209e90c + 2c2e555 commit 1dafbd6

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

imagepicker/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ android {
1313
defaultConfig {
1414
minSdkVersion 19
1515
targetSdkVersion 28
16-
versionCode 8
17-
versionName "1.7"
16+
versionCode 9
17+
versionName "1.7.1"
1818

1919
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2020
}
@@ -72,7 +72,7 @@ ext {
7272
siteUrl = 'https://github.com/Dhaval2404/ImagePicker/'
7373
gitUrl = 'https://github.com/Dhaval2404/ImagePicker.git'
7474

75-
libraryVersion = '1.7'
75+
libraryVersion = '1.7.1'
7676
//If you are uploading new library try : gradlew install
7777
//If you are updating existing library then execute: gradlew bintrayUpload
7878
//In both the case don't forgot to put bintray credentials in local.properties file.

imagepicker/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<provider
1919
android:name="com.github.dhaval2404.imagepicker.ImagePickerFileProvider"
20-
android:authorities="@string/image_picker_provider_authority"
20+
android:authorities="${applicationId}.imagepicker.provider"
2121
android:exported="false"
2222
android:grantUriPermissions="true">
2323

imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/IntentUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ object IntentUtils {
6767

6868
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
6969
// authority = com.github.dhaval2404.imagepicker.provider
70-
val authority = context.getString(R.string.image_picker_provider_authority)
70+
val authority = context.packageName + context.getString(R.string.image_picker_provider_authority_suffix)
7171
val photoURI = FileProvider.getUriForFile(context, authority, file)
7272
intent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI)
7373
} else {

imagepicker/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<string name="title_gallery">Gallery</string>
77
<string name="title_camera">Camera</string>
88

9-
<string name="image_picker_provider_authority">com.github.dhaval2404.imagepicker.provider</string>
9+
<string name="image_picker_provider_authority_suffix">.imagepicker.provider</string>
1010

1111
<string name="message_gallery_permission_denied">Read External Storage permissions is needed to select Image. Please turn on requested permissions from Settings > Permissions.</string>
1212
<string name="message_camera_permission_denied">Camera and External Storage permissions are needed to capture image. Turning off any permission won\'t allow application run smoothly. Please turn on all requested permissions from Settings > Permissions.</string>

sample/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ android {
1212
applicationId "com.github.dhaval2404.imagepicker.sample"
1313
minSdkVersion 19
1414
targetSdkVersion 28
15-
versionCode 8
16-
versionName "1.7"
15+
versionCode 9
16+
versionName "1.7.1"
1717
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1818
vectorDrawables.useSupportLibrary = true
1919
}

sample/src/main/kotlin/com.github.dhaval2404.imagepicker/sample/util/IntentUtil.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import android.content.Intent
55
import android.net.Uri
66
import androidx.browser.customtabs.CustomTabsIntent
77
import androidx.core.content.FileProvider
8+
import com.github.dhaval2404.imagepicker.R
89
import java.io.File
910

1011
/**
@@ -25,7 +26,8 @@ object IntentUtil {
2526
*/
2627
fun showImage(activity: Activity, file: File) {
2728
val intent = Intent(Intent.ACTION_VIEW)
28-
val uri = FileProvider.getUriForFile(activity, "${activity.packageName}.provider", file)
29+
val authority = activity.packageName + activity.getString(R.string.image_picker_provider_authority_suffix)
30+
val uri = FileProvider.getUriForFile(activity, authority, file)
2931
intent.setDataAndType(uri, "image/*")
3032
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
3133
activity.startActivity(intent)

0 commit comments

Comments
 (0)