When i set the versionCode
to 2 the app still report it to be 1.
When I set the versionCode
to 3 the app detect that.
alo 5, 6 but not setting:
defaultConfig {
versionCode 2
Is not working with the number 2, I have cleaned the project and rebuilt but still same result.
What am I missing?
I want to detect when a new app version is released with this piece of Firebase code: Note that I run this in debug in Android Studio
ValueEventListener systemListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
App app = dataSnapshot.getValue(App.class);
if (app.getVersionCode() > BuildConfig.VERSION_CODE) {
SettingsManager.setForceAppUpdate(true);
for (OnForceAppUpdateListener l : Application.getInstance()
.getUIListeners(OnForceAppUpdateListener.class))
l.onForceAppUpdate();
} else { // TODO for testing
SettingsManager.setForceAppUpdate(false);
for (OnForceAppUpdateListener l : Application.getInstance()
.getUIListeners(OnForceAppUpdateListener.class))
l.onForceAppUpdate();
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
And when I went from versionCode 1 to versionCode 2 I notis the above BuildConfig.VERSION_CODE
being 1
I also try this:
Application.getInstance().getPackageManager()
.getPackageInfo(Application.getInstance()
.getPackageName(), 0).versionCode;
Also return 1 for versionCode