Reputation: 5
I've published an app in playstore, and then i want to make in upp update/version check for current app version and updated version from playstore like this
AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(this);
Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
appUpdateInfoTask.addOnSuccessListener(appUpdateInfo -> {
final String log = "packageName :" + appUpdateInfo.packageName() + ", " + "availableVersionCode :" + appUpdateInfo.availableVersionCode() + ", " + "updateAvailability :" + appUpdateInfo.updateAvailability() + ", " + "installStatus :" + appUpdateInfo.installStatus();
FirebaseCrashlytics.getInstance().recordException(new Throwable(log));
if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) {
FirebaseCrashlytics.getInstance().recordException(new Throwable("On Updating"));
update();
} else {
FirebaseCrashlytics.getInstance().recordException(new Throwable("Success but Update Unavailable " + log));
permCheck();
}
});
appUpdateInfoTask.addOnFailureListener(e -> {
final String log = "Update Failure " + e.getMessage();
final String log2 = "Update Failure " + e.getLocalizedMessage();
FirebaseCrashlytics.getInstance().recordException(new Throwable(log + " " + log2));
permCheck();
});
This is my gradle file
android {
signingConfigs {
release {
storeFile file(***)
storePassword '***'
keyAlias '***'
keyPassword '***'
}
}
compileSdk = 34
buildToolsVersion = "30.0.3"
flavorDimensions "2.1.6"
defaultConfig {
applicationId "id.***.android"
minSdkVersion 19
targetSdkVersion 34
versionCode 2405141
versionName "2.1.6"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
manifestPlaceholders = [ activityLabel:"APP NAME NEW"]
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
manifestPlaceholders = [ activityLabel:"APP NAME.Debug"]
applicationVariants.all { variant ->
variant.outputs.each { output ->
def appName = "APP NAME"
def fileName = appName + "-v" + defaultConfig.versionName + "-" + variant.buildType.name + ".apk"
output.outputFileName = fileName
}
}
}
}
productFlavors {
def addActivityLabelSuffix = { placeholders, suffix ->
def appName = placeholders.get("APP NAME")
placeholders.put("APP NAME", appName + suffix)
}
dev {
applicationId "APP NAME.dev"
ext.betaDistributionGroupAliases = "APP NAME.dev"
addActivityLabelSuffix getManifestPlaceholders(), ".Dev"
}
staging {
applicationId "APP NAME.stg"
addActivityLabelSuffix getManifestPlaceholders(), ".Staging"
}
production {
applicationId "APP NAME.new"
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
buildFeatures {
viewBinding true
}
namespace 'APPNAME'
}
but the error is
-10: 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)
My launched app version code is 2405221(2.1.9) which bigger from my current versionCode and versionName that i've added before
Upvotes: 0
Views: 342