v0.8.2: added some basic support for demo and instant app functionality
This commit is contained in:
@@ -29,8 +29,16 @@ public abstract class UpdateService {
|
||||
public abstract void onConnectionFailed();
|
||||
}
|
||||
|
||||
//whether the app is updateable via an ingame prompt (e.g. not a demo or an android instant app)
|
||||
public abstract boolean isUpdateable();
|
||||
|
||||
public abstract void checkForUpdate( boolean useMetered, UpdateResultCallback callback );
|
||||
|
||||
public abstract void initializeUpdate( AvailableUpdateData update );
|
||||
|
||||
//whether the app installable via an ingame prompt (e.g. a demo, or an android instant app)
|
||||
public abstract boolean isInstallable();
|
||||
|
||||
public abstract void initializeInstall();
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,11 @@ public class DebugUpdates extends UpdateService {
|
||||
|
||||
private static AvailableUpdateData debugUpdateInfo;
|
||||
|
||||
@Override
|
||||
public boolean isUpdateable() {
|
||||
return false; //turn on to debug update prompts
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkForUpdate(boolean useMetered, UpdateResultCallback callback) {
|
||||
|
||||
@@ -37,18 +42,11 @@ public class DebugUpdates extends UpdateService {
|
||||
return;
|
||||
}
|
||||
|
||||
//turn on to test update UI
|
||||
if (false){
|
||||
debugUpdateInfo = new AvailableUpdateData();
|
||||
debugUpdateInfo.versionCode = Game.versionCode+1;
|
||||
debugUpdateInfo.URL = "http://www.google.com";
|
||||
debugUpdateInfo = new AvailableUpdateData();
|
||||
debugUpdateInfo.versionCode = Game.versionCode+1;
|
||||
debugUpdateInfo.URL = "http://www.google.com";
|
||||
|
||||
callback.onUpdateAvailable(debugUpdateInfo);
|
||||
} else {
|
||||
debugUpdateInfo = null;
|
||||
|
||||
callback.onNoUpdateFound();
|
||||
}
|
||||
callback.onUpdateAvailable(debugUpdateInfo);
|
||||
|
||||
}
|
||||
|
||||
@@ -57,4 +55,14 @@ public class DebugUpdates extends UpdateService {
|
||||
DeviceCompat.openURI( update.URL );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstallable() {
|
||||
return false; //turn on to test install prompts
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeInstall() {
|
||||
//does nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,6 +38,11 @@ public class GitHubUpdates extends UpdateService {
|
||||
private static Pattern descPattern = Pattern.compile("(.*?)(\r\n|\n|\r)(\r\n|\n|\r)---", Pattern.DOTALL + Pattern.MULTILINE);
|
||||
private static Pattern versionCodePattern = Pattern.compile("internal version number: ([0-9]*)", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
@Override
|
||||
public boolean isUpdateable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkForUpdate(boolean useMetered, UpdateResultCallback callback) {
|
||||
|
||||
@@ -120,4 +125,14 @@ public class GitHubUpdates extends UpdateService {
|
||||
DeviceCompat.openURI( update.URL );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstallable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeInstall() {
|
||||
//does nothing, always installed
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user