2022-03-17DzoSDK Android Native Change Log
Config:
Up version API to 2.13
Change function TrackEventGame_CompleteRegistration() to TrackEventGame_CompleteRegistration(string _content = "").
Change callback in function Init SDK
public interface DzoInitCallback {
public void OnInitSuccess();
public void OnLoginSuccess();
public void OnDisconnect();
public void OnDebugLog(boolean _isLogError, String _tag, String _msg);
}
Example:
// ------ Init DzoSDK ------- //
if(!DzoSDK.GetInstance().IsConnected()){
DzoSDK.GetInstance().Init(this, new DzoInitCallback() {
@Override
public void OnInitSuccess() {
// --- Init Successful --- //
// … Your code … //
DzoSDK.GetInstance().Login(); // After Init SDK Successful, you can call Login.
}
@Override
public void OnLoginSuccess() { // Callback Login Successful, change NEXT SCENE
// --- Login Successful --- //
// … Your code … //
}
@Override
public void OnDisconnect() { // Callback Disconnect SDK, SDK auto logout your account and you need to change LoginActivity
// --- Disconnect From SDK --- //
// … Your code … //
}
@Override
public void OnDebugLog(boolean _isLogError, String _tag, String _msg) {
If (_isLogError){
Log.e(_tag, _msg);
}else {
Log.d(_tag, _msg);
}
}
});
} else {
DzoSDK.GetInstance().Login();
}
// -------------------------- //
// … Your code … //
}
Add to dependencies of build.grade(Module.app)
dependencies {
…
// --- DzoSDK Library --- //
implementation 'com.android.volley:volley:1.2.1'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
implementation 'com.facebook.android:facebook-login:11.1.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.google.android.gms:play-services-auth:20.0.0'
implementation "com.android.billingclient:billing:3.0.0"
implementation 'com.appsflyer:af-android-sdk:6.5.0'
implementation platform('com.google.firebase:firebase-bom:29.0.3')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-dynamic-links' // <--- NEW UPDATE ---
// ------------------------- //
…
}
apply plugin: 'com.google.gms.google-services' // --- Add this at bottom ---
Add:
Feature renew token when login continous.
Feature detect device rooted.
Feature Track Appsflyer Deeplink, Track Firebase Deeplink.
Add some method TrackEventGame:
TrackEventGame_CompleteRegistration()
TrackEventGame_CompleteTutorial(String _content)
TrackEventGame_CompleteTutorial(String _content)
TrackEventGame_ReEngagements(String _content)
See more in Document (TRACKING EVENT GAME) for detail.
Add feature : Buy Item by DzoDong. See more in Document for detail
Change Constructor IAPProduct:
public IAPProduct(String _sku, String _itemID, ProductType _productType)
Change Method PurchaseDzoViProduct. See more in Document (DZOVI PAYMENT) for detail.
DzoSDK.GetInstance().PurchaseDzoViProduct(_sku, _itemID, _roleID, _gameTransaction, new DzoViPayCallback() {
@Override
public void callbackResult(int _status, String _msg, String _transactionID, String _sku, String _gameTransaction) {
Log.d(DzoSDK.TAG, "Result ViDzoPay status: " + _status + " | msg: " + _msg + " | transactionID: " + _transactionID
+ " | sku: " + _sku + " | gameTransaction: " + _gameTransaction);
if (_status == 0) { // Purchase Successful
// --- YOUR CODE --- //
}else{ // Error
// --- YOUR CODE --- //
}
}
});
Change Method IAPPurchase. See more in Document (IAP PAYMENT) for detail.
IAPManager.GetInstance().Purchase(_sku, _itemID, _roleID, _gameTransaction, new DzoIAPPurchaseCallback() {
@Override
public void callbackOnResult(Result _result) {
if(_result.status == Result.Status.Success){
Log.d(DzoSDK.TAG, ">>> Pay Success --- money: " + _result.money
+ " | transactionID: " + _result.transactionID + " | sku: " + _result.sku + " | lastHashID: " + _result.lastHashID);
}else if(_result.status == Result.Status.Success_Payment_OtherAccount){
Log.d(DzoSDK.TAG, ">>> Pay Success_Payment_OtherAccount --- money: " + _result.money
+ " | transactionID: " + _result.transactionID + " | sku: " + _result.sku + " | lastHashID: " + _result.lastHashID);
}else if(_result.status == Result.Status.CheckLogicError){
Log.d(DzoSDK.TAG, ">>> Call method error: --- errorCode: " + _result.errorCode);
}else if(_result.status == Result.Status.ErrorProcessToStore){
Log.d(DzoSDK.TAG, ">>> Process to Store error: --- errorCode: " + _result.errorCode);
}else{ // In-App Success but verify to server error. You must save this receiptData and re-send to server
Log.e(DzoSDK.TAG, ">>> In-App Purchase Success but verify to server error. You must save this receiptData and re-send to server.\nsku: " + _result.paymentResendData.sku + " | itemID: " + _result.paymentResendData.itemID + " | roleID: " + _result.paymentResendData.roleID + " | gameTransaction: " + _result.paymentResendData.gameTransaction
+ " | errorCode" + _result.errorCode + " | jsonStringPayment: " + _result.paymentResendData.jsonStringPayment);
}
}
});
Change Language To Vietnamese In Popup Login
Fix some bugs
Add Firebase Analytics to SDK. See more in Document (Import Dzo SDK) for detail.
Config TrackEventGame. See more in Document (TrackEventGame) for detail.
Add AppsFlyer to SDK. See more in Document (Import Dzo SDK) for detail.
Add options to config in string.xml
<string name="DzoSDKServer">0</string> <!-- 0 : Server Test | 1 : Server Real-->
<string name="publicKeyTest">{PUBLIC_KEY_TEST}</string> <!-- public key use to Server Test -->
<string name="publicKeyReal">{PUBLIC_KEY_REAL}</string> <!-- public key use to Server Real -->
With:
DzoSDKServer = 0 : Server Test, use publicKeyTest
DzoSDKServer = 1 : Server Real, use publicKeyReal
<string name="useDefaultButtonDzoHome">1</string> <!-- 0 : false| 1 : true -->
<string name="useDefaultTag18Plus">1</string> <!-- 0 : false| 1 : true -->
<string name="useDefaultBroadcast">1</string> <!-- 0 : false| 1 : true -->
With:
useDefaultButtonDzoHome / useDefaultTag18Plus / useDefaultBroadcast Value = 1 : Use default From DzoSDK
useDefaultButtonDzoHome / useDefaultTag18Plus / useDefaultBroadcast Value = 0 : Don’t use default From DzoSDK
Optimize Method Init DzoSDK
Add this code in string.xml to easy config Method Share Photo On Facebook
<string name="fb_ContentProvider">com.facebook.app.FacebookContentProvider{YOUR FB APP ID}</string>
Example:
<string name="fb_ContentProvider">com.facebook.app.FacebookContentProvider123456</string>
Fix bug show Popup Login
Update Facebook SDK version 11.1.1
Add feature Share Photo On Facebook
Example:
byte[] _bitmapdata = {...};
DzoSDK.GetInstance().FBSharePhoto(_bitmapdata, new DzoFBSharePhotoCallback() {
@Override
public void callbackResult(Status _result, int _code, String _msg) {
if(_result == Status.Success){
// - Your Code - //
Log.d(DzoSDK.TAG, ">>> FB Share Photo | msg: " + _msg + " | code: " + _code);
}else if(_result == Status.Cancel){
// - Your Code - //
Log.d(DzoSDK.TAG, ">>> FB Share Photo | msg: " + _msg + " | code: " + _code);
}else{
// - Your Code - //
Log.e(DzoSDK.TAG, ">>> FB Share Photo | msg: " + _msg + " | code: " + _code);
}
}
});
Add method ShowBroadcast from DzoSDK.
Example:
DzoSDK.GetInstance().ShowBroadcast();
Config method IAPManager.GetInstance(activity).InitProducts(ArrayList
Example:
private void InitIAPProductsToSDK(ArrayList
_listIAPProduct){
IAPManager.GetInstance(this).InitProducts(_listIAPProduct, new DzoIAPInitProductsCallback() {
@Override
public void callbackOnResult(boolean _isSuccess, int _errorCode) {
if(_isSuccess){
Log.d(DzoSDK.TAG, ">>> InitProducts Successful");
}else{
Log.e(DzoSDK.TAG, ">>> InitProducts Failed, errorCode: : " + _errorCode);
// --- You can call Re-InitProducts again --- //
InitIAPProductsToSDK(_listIAPProduct);
}
}
});
}
Add more case check in callback when call Purchase IAP (Result.Status.CheckLogicError, Result.Status.ErrorProcessToStore and Result.Status.ErrorProcessToServer). See more in doccument (title IAP PAYMENT) for detail.
Example:
IAPManager.GetInstance(this).Purchase("skutest_20k_vnd", "Item01", new DzoIAPPurchaseCallback() {
@Override
public void callbackOnResult(Result _result) {
if(_result.status == Result.Status.Success){
Log.d(DzoSDK.TAG, ">>> Pay Success --- money: " + _result.money
+ " | transactionID: " + _result.transactionID + " | sku: " + _result.sku + " | lastHashID: " + _result.lastHashID);
}else if(_result.status == Result.Status.Success_Payment_OtherAccount){
Log.d(DzoSDK.TAG, ">>> Pay Success_Payment_OtherAccount --- money: " + _result.money
+ " | transactionID: " + _result.transactionID + " | sku: " + _result.sku + " | lastHashID: " + _result.lastHashID);
}else if(_result.status == Result.Status.CheckLogicError){
Log.d(DzoSDK.TAG, ">>> Call method error: --- errorCode: " + _result.errorCode);
}else if(_result.status == Result.Status.ErrorProcessToStore){
Log.d(DzoSDK.TAG, ">>> Process to Store error: --- errorCode: " + _result.errorCode);
}else{ // In-App Success but verify to server error. You must save this receiptData and re-send to server
Log.e(DzoSDK.TAG, ">>> In-App Purchase Success but verify to server error. You must save this receiptData and re-send to server.\nsku: " + _result.paymentResendData.sku + " | itemID: " + _result.paymentResendData.itemID + " | roleID: " + _result.paymentResendData.roleID + " | gameTransaction: " + _result.paymentResendData.gameTransaction
+ " | errorCode" + _result.errorCode + " | jsonStringPayment: " + _result.paymentResendData.jsonStringPayment);
}
}
});
Change method Call Init IAP Products (see more in Doccment - title IAP PAYMENT), call callback when init droduct.
Example:
IAPManager.GetInstance(this).InitProducts(_listIAPProduct, new DzoIAPInitProductsCallback() {
@Override
public void callbackOnResult(boolean _isSuccess) {
if(_isSuccess){
// init successful
}else{
// init failed
}
}
});
Add method change roleID, gameTransaction of IAP Product
Example:
IAPProduct _tmpProduct = IAPManager.GetInstance(this).GetProduct("skutest_20k_vnd","Item01");
if(_tmpProduct != null){
_tmpProduct.SetRoleID("newRoleID");
_tmpProduct.SetGameTransaction("newGameTransaction");
}
Change method Call PurchaseDzoViProduct and In-App Purchase, and method VerifyIAPPay (see more in Doccument - DzoViPayment and In-App Payment)
Config layout popup Login
Add Floating DzoMenu and Tag 18+
Add code to function onStart(...), onResume(...), onDestroy(...) of each Activities. See more in doccument (step 2 and step 3)
Example:
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState) ;
DzoSDK.GetInstance().OnCreate(this);
// … Your code … //
}
@Override
protected void onStart() {
super.onStart();
DzoSDK.GetInstance().OnStart(this);
// … Your code … //
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.d(DzoSDK.TAG, "onActivityResult >>> requestCode:" + requestCode + " | resultCode: " + resultCode);
super.onActivityResult(requestCode, resultCode, data);
if(DzoSDK.IsMyRequestCode(requestCode)){
DzoSDK.GetInstance().OnActivityResult(requestCode, resultCode, data);
}else{
// … Your code … //
}
}
@Override
protected void onResume() {
super.onResume();
DzoSDK.GetInstance().OnResume(this);
// … Your code … //
}
@Override
protected void onDestroy() {
super.onDestroy();
DzoSDK.GetInstance().OnDestroy(this);
// … Your code … //
}
Payment
Tracking event game
Change Logic Init to DzoSDK
Login to SDK