I am trying to implement google's in-app updates. When trying to run the app directly from AndroidStudio I got this exception:
com.google.android.play.core.install.InstallException: Install Error(-10): The app is not owned by any user on this device. An app is "owned" if it has been acquired from Play. (https://developer.android.com/reference/com/google/android/play/core/install/model/InstallErrorCode#ERROR_APP_NOT_OWNED)
I understand that google can't check for updates when the app wasn't installed from the play store. My goal is to disable this feature while the app is in a testing build that isn't installed from the play store because in these situations I don't care about app updates anyway.
How can I disable this check depending on the build flavor?
I have already read this guide but it doesn't mention anything that does what I want.
just define in app/build.gradle
some property for each build type
buildTypes {
debug {
buildConfigField 'boolean', 'UPDATE_ENABLED', 'false'
}
release {
buildConfigField 'boolean', 'UPDATE_ENABLED', 'true'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
after synchronization you can request if(BuildConfig.UPDATE_ENABLED)
and there check for update