-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new callback interfaces split from DeployGateCallback #95
Changes from 14 commits
b5ac092
c75248c
36e88dc
3d46edb
5d6efe5
9774b93
f7d85ba
69bd4fc
7a6f81d
6bee4f7
bcd6b86
41bdd9c
c361d01
3954e1c
4062288
1d45993
ee6bd30
0ff07a4
083c8f9
190ef4c
6af347c
12883ac
7d5d76b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
|
||
import com.deploygate.sdk.CustomAttributes; | ||
import com.deploygate.sdk.DeployGate; | ||
import com.deploygate.sdk.DeployGateCallback; | ||
import com.deploygate.sdk.DeployGateSdkConfiguration; | ||
|
||
import java.util.Locale; | ||
|
||
|
@@ -27,12 +27,10 @@ public void onCreate() { | |
// Note that you also need to edit your AndroidManifest.xml to activate customized initializer. | ||
// Refer the comment on stableReal/AndroidManifest.xml included in this sample. | ||
|
||
DeployGate.install(this, new DeployGateCallback() { | ||
// Please note that this callback is called iff you have removed the content provider. | ||
// For those who wanna use the content provider, SDK provides DeployGate#registerCallback for your use-case. | ||
|
||
@Override | ||
public void onInitialized(boolean isServiceAvailable) { | ||
DeployGateSdkConfiguration configuration = new DeployGateSdkConfiguration.Builder() | ||
// Please note that these callback is called if you have removed the content provider. | ||
// For those who wanna use the content provider, SDK provides DeployGate#registerXXXCallback for your use-case. | ||
.setInitializeCallback(isServiceAvailable -> { | ||
if (isServiceAvailable) { | ||
Log.i(TAG, "SDK is available"); | ||
DeployGate.logInfo("SDK is available"); | ||
|
@@ -44,49 +42,39 @@ public void onInitialized(boolean isServiceAvailable) { | |
Log.i(TAG, "SDK is unavailable"); | ||
DeployGate.logInfo("SDK is unavailable"); // this fails silently | ||
} | ||
} | ||
|
||
@Override | ||
public void onStatusChanged( | ||
boolean isManaged, | ||
boolean isAuthorized, | ||
String loginUsername, | ||
boolean isStopped | ||
) { | ||
}) | ||
.setStatusChangeCallback((isManaged, isAuthorized, loginUsername, isStopped) -> { | ||
Bundle bundle = new Bundle(); | ||
bundle.putBoolean("isManaged", isManaged); | ||
bundle.putBoolean("isAuthorized", isAuthorized); | ||
bundle.putString("loginUsername", loginUsername); | ||
bundle.putBoolean("isStopped", isStopped); | ||
|
||
String message = String.format(Locale.US, "onStatusChanged(%s)", bundle.toString()); | ||
String message = String.format(Locale.US, "onStatusChanged(%s)", bundle); | ||
|
||
Log.i(TAG, message); | ||
DeployGate.logInfo(message); | ||
} | ||
|
||
@Override | ||
public void onUpdateAvailable( | ||
int revision, | ||
String versionName, | ||
int versionCode | ||
) { | ||
}) | ||
.setUpdateAvailableCallback((revision, versionName, versionCode) -> { | ||
Bundle bundle = new Bundle(); | ||
bundle.putInt("revision", revision); | ||
bundle.putString("versionName", versionName); | ||
bundle.putInt("versionCode", versionCode); | ||
|
||
String message = String.format(Locale.US, "onUpdateAvailable(%s)", bundle.toString()); | ||
String message = String.format(Locale.US, "onUpdateAvailable(%s)", bundle); | ||
|
||
Log.i(TAG, message); | ||
DeployGate.logInfo(message); | ||
} | ||
}, true); | ||
}) | ||
.setEnabledOnNonDebuggableBuild(true) | ||
.build(); | ||
|
||
DeployGate.install(this, configuration); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
|
||
// If you want to prevent the app distributed by someone else, specify your username on DeployGate | ||
// as a second argument of DeployGate.install, like: | ||
// with setAuthor method when creating DeployGate SdkConfiguration. like: | ||
// | ||
// DeployGate.install(this, "YOURUSERNAME"); | ||
// builder.setAuthor("YOURUSERNAME") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. describe to use |
||
// | ||
// You can use DeployGate.isAuthorized() later to check the installation is valid or not. | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iff
is not a typo by the way. It's an abbreviation ofif and only if
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh.. reverted this change.