Skip to content

Migration guide🔗

This document contains instructions for updating the MRGS SDK, in case any changes need to be made to the code or project settings.

5.x.x → 6.0.0🔗

Version 6.0.0 contains backward incompatible changes due to partially redesigned API: removed @Deprecated functionality, changed function names, fixed typos, the public API changed package, and the private API moved to internal.

Java packages🔗

All class packages of MRGS SDK was changed from ru.mail.mrgservice to games.my.mrgs.

MRGSMyTracker🔗

MRGSMyTracker was moved to his own module and no more provides by MRGService module. A new way to add MRGSMyTracker to your project:

Add a dependency in build.gradle file:

dependencies {
    def mrgsVersion = "6.0.0"

    implementation "games.my.mrgs:mytracker:$mrgsVersion"
}

Copy MRGSMyTracker file to the libs directory of your project. Add the necessary dependencies to the build file.gradle

dependencies {
    //...
    implementation(name: 'MRGSMyTracker', ext:'aar')
    implementation "com.my.tracker:mytracker-sdk:3.x.x"
}

Update SDK🔗

Main changes:

  • Class MRGSMyTracker moved from ru.mail.mrgservice to games.my.mrgs.my.tracker.
  • Class MRGSExternalSDKParams.MyTrackerParams renamed and moved to games.my.mrgs.my.tracker.MRGSMyTrackerParams.

The following example shows how your app might look before and after making these changes:

Before

import ru.mail.mrgservice.MRGSExternalSDKParams;
import ru.mail.mrgservice.MRGSExternalSDKParams.MyTrackerParams;
import ru.mail.mrgservice.MRGSPlatform;
import ru.mail.mrgservice.MRGService;
import ru.mail.mrgservice.MRGServiceParams;

final MRGServiceParams serviceParams
        = MRGServiceParams.init(<MRGS_APP_ID>, <CLIENT_SECRET>, MRGSPlatform.ANDROID);
serviceParams.setDebuggable(false);


// Setting External SDKS
final MRGSExternalSDKParams externalSDKParams = MRGSExternalSDKParams.newInstance();

// Setting MyTracker
final MyTrackerParams myTrackerParams = MyTrackerParams.init("MY_TRACKER_SDK_KEY");
myTrackerParams.setDebuggable(false);
externalSDKParams.myTrackerParams = myTrackerParams;

MRGService.service(context, serviceParams, externalSDKParams);

After

import java.util.ArrayList;
import java.util.List;

import games.my.mrgs.MRGSModuleParams;
import games.my.mrgs.MRGSPlatform;
import games.my.mrgs.MRGService;
import games.my.mrgs.MRGServiceParams;
import games.my.mrgs.my.tracker.MRGSMyTrackerParams;

final MRGServiceParams serviceParams
        = MRGServiceParams.init(<MRGS_APP_ID>, <CLIENT_SECRET>, MRGSPlatform.ANDROID);
serviceParams.setDebuggable(false);


// Settings for MRGSModules
final List<MRGSModuleParams> moduleParams = new ArrayList<>();

// Setting MyTracker
final MRGSMyTrackerParams myTrackerParams = MRGSMyTrackerParams.init("MY_TRACKER_SDK_KEY");
myTrackerParams.setDebuggable(false);
moduleParams.add(myTrackerParams);

MRGService.service(context, serviceParams, moduleParams);

MRGService🔗

Update SDK🔗

dependencies {
-   def mrgsVersion = "5.x.x"
+   def mrgsVersion = "6.0.0"

    implementation "games.my.mrgs:core:$mrgsVersion"
}

Update SDK🔗

Main changes:

  • Class ru.mail.mrgservice.MRGSExternalSDKParams removed.
  • Class ru.mail.mrgservice.MRGSExternalSDKParams.AmazonAuthParams renamed and moved into module MRGSAuthentication games.my.mrgs.authentication.MRGSAmazonAuthParams.
  • Class ru.mail.mrgservice.MRGSExternalSDKParams.AppsFlyerParams renamed and moved into module MRGSAnalytics games.my.mrgs.analytics.MRGSAppsFlyerParams.
  • Class ru.mail.mrgservice.MRGSExternalSDKParams.FacebookParams renamed and moved into module MRGSAuthentication games.my.mrgs.authentication.MRGSFacebookParams.
  • Class ru.mail.mrgservice.MRGSExternalSDKParams.GooglePlayGamesParams renamed and moved into module MRGSAuthenticationGoogleSignIn games.my.mrgs.authentication.google.signin.MRGSGooglePlayGamesParams.
  • Class ru.mail.mrgservice.authentication.googlegames.MRGSGoogleGames removed Google authorization moved to separate modules MRGSAuthenticationGoogleSignIn and MRGSAuthenticationGoogleSignIn
  • Class ru.mail.mrgservice.MRGSExternalSDKParams.GameCenterParams renamed and moved into module MRGSAuthentication games.my.mrgs.authentication.MRGSGameCenterParams.
  • Class ru.mail.mrgservice.MRGSExternalSDKParams.MyGamesAuthParams renamed and moved into module MRGSAuthentication games.my.mrgs.authentication.MRGSMyGamesAuthParams.
  • Class ru.mail.mrgservice.MRGSExternalSDKParams.MyTrackerParams renamed and moved into module MRGSMyTracker games.my.mrgs.my.tracker.MRGSMyTrackerParams.
  • Class ru.mail.mrgservice.MRGSExternalSDKParams.SamsungBillingParams renamed and moved into module MRGSBilling games.my.mrgs.billing.MRGSSamsungBillingParams.
  • Class ru.mail.mrgservice.MRGSExternalSDKParams.VKontakteParams renamed and moved into module MRGSAuthenticationVK games.my.mrgs.authentication.vk.MRGSVKontakteParams.

  • enum ru.mail.mrgservice.MRGServiceParams.BillingSubstitution removed. Use MRGSMyGamesBilling#useAsMainBilling() and MRGSVKPay#useAsMainBilling() instead.

  • Method MRGService#service(Context, MRGSServerDataDelegate, String, String) removed. Use MRGService#service(Context, String, String, MRGSServerDataDelegate) instead.

  • Method MRGService#service(Context, MRGSServerDataDelegate, String, String, Bundle) removed. Use MRGService#service(Context, MRGServiceParams, List<MRGSModuleParams>, MRGSServerDataDelegate loadDelegate) instead.
  • Method MRGService#service(Context, MRGSServerDataDelegate, String, String, Bundle, Bundle) removed. Use MRGService#service(Context, MRGServiceParams, List<MRGSModuleParams>, MRGSServerDataDelegate loadDelegate) instead.
  • Method MRGService#service(Context, MRGServiceParams, MRGSExternalSDKParams) removed. Use MRGService#service(Context, MRGServiceParams, List<MRGSModuleParams>) instead.
  • Method MRGService#service(Context, MRGServiceParams, MRGSExternalSDKParams, MRGSServerDataDelegate loadDelegate) removed. Use MRGService#service(Context, MRGServiceParams, List<MRGSModuleParams>, MRGSServerDataDelegate loadDelegate) instead.

  • Method ru.mail.mrgservice.MRGServiceParams#shouldUseMyGamesBillingOnly() removed.

  • Method ru.mail.mrgservice.MRGServiceParams#setUseMyGamesBillingOnly(boolean) removed. Use MRGSMyGamesBilling#useAsMainBilling() and MRGSVKPay#useAsMainBilling() instead.

  • Field ru.mail.mrgservice.MRGSSocial#ODNOKLASSNIKI removed.

  • Field ru.mail.mrgservice.MRGSSocial#MAILRU removed.
  • Field ru.mail.mrgservice.MRGSSocial#VKONTAKTE removed.
  • Field ru.mail.mrgservice.MRGSSocial#VKID removed.

The following example shows how your app might look before and after making these changes:

Before

import ru.mail.mrgservice.MRGSExternalSDKParams;
import ru.mail.mrgservice.MRGSExternalSDKParams.AppsFlyerParams;
import ru.mail.mrgservice.MRGSExternalSDKParams.MyTrackerParams;
import ru.mail.mrgservice.MRGSExternalSDKParams.FacebookParams;
import ru.mail.mrgservice.MRGSExternalSDKParams.GooglePlayGamesParams;
import ru.mail.mrgservice.MRGSPlatform;
import ru.mail.mrgservice.MRGService;
import ru.mail.mrgservice.MRGServiceParams;

// Setting MRGService
// Available MRGSPlatform: AMAZON, ANDROID, HUAWEI, SAMSUNG and FACEBOOK_CLOUD
final MRGServiceParams serviceParams
        = MRGServiceParams.init(<MRGS_APP_ID>, <CLIENT_SECRET>, MRGSPlatform.ANDROID);
serviceParams.setDebuggable(false);


// Setting External SDKS
final MRGSExternalSDKParams externalSDKParams = MRGSExternalSDKParams.newInstance();

// Setting MyTracker
final MyTrackerParams myTrackerParams = MyTrackerParams.init("MY_TRACKER_SDK_KEY");
myTrackerParams.setDebuggable(false);
externalSDKParams.myTrackerParams = myTrackerParams;

// Setting AppsFlyer
final AppsFlyerParams appsFlyerParams = AppsFlyerParams.init("DEV_KEY");
appsFlyerParams.setDebuggable(false);
appsFlyerParams.setForwardMetricsEnabled(true);
externalSDKParams.appsFlyerParams = appsFlyerParams;

// Setting other external SDKS
externalSDKParams.facebookParams = FacebookParams.init("FACEBOOK_APP_ID");
externalSDKParams.googlePlayGamesParams = GooglePlayGamesParams.init("GOOGLE_CLIENT_ID");

MRGService.service(context, serviceParams, externalSDKParams);

After

import java.util.ArrayList;
import java.util.List;

import games.my.mrgs.MRGSModuleParams;
import games.my.mrgs.MRGSPlatform;
import games.my.mrgs.MRGService;
import games.my.mrgs.MRGServiceParams;
import games.my.mrgs.analytics.MRGSAppsFlyerParams;
import games.my.mrgs.authentication.MRGSFacebookParams;
import games.my.mrgs.authentication.MRGSGooglePlayGamesParams;
import games.my.mrgs.my.tracker.MRGSMyTrackerParams;

// Setting MRGService
// Available MRGSPlatform: AMAZON, ANDROID, HUAWEI, SAMSUNG and FACEBOOK_CLOUD
final MRGServiceParams serviceParams
        = MRGServiceParams.init(<MRGS_APP_ID>, <CLIENT_SECRET>, MRGSPlatform.ANDROID);
serviceParams.setDebuggable(false);

// Settings for MRGS modules
final List<MRGSModuleParams> moduleParams = new ArrayList<>();

// Setting MyTracker
final MRGSMyTrackerParams myTrackerParams = MRGSMyTrackerParams.init("MY_TRACKER_SDK_KEY");
myTrackerParams.setDebuggable(false);
moduleParams.add(myTrackerParams);

// Setting AppsFlyer
final MRGSAppsFlyerParams appsFlyerParams = MRGSAppsFlyerParams.init("DEV_KEY");
appsFlyerParams.setDebuggable(false);
appsFlyerParams.setForwardMetricsEnabled(true);
moduleParams.add(appsFlyerParams);

// Setting other external SDKS
final MRGSFacebookParams facebookParams = MRGSFacebookParams.init("FACEBOOK_APP_ID");
moduleParams.add(facebookParams);

final MRGSGoogleSignInParams googleSignInParams = MRGSGoogleSignInParams.init("GOOGLE_CLIENT_ID");
moduleParams.add(googleSignInParams);

MRGService.service(context, serviceParams, moduleParams);

MRGSAdvertising🔗

Update SDK🔗

dependencies {
-   def mrgsVersion = "5.x.x"
+   def mrgsVersion = "6.0.0"

    implementation "games.my.mrgs:advertising:$mrgsVersion"
}

Update SDK🔗

Main changes:

  • Class MRGSAdvert moved from ru.mail.mrgservice.advertising to games.my.mrgs.advertising.
  • Class MRGSAdvertisingFactory moved from ru.mail.mrgservice.advertising to games.my.mrgs.advertising.

The following example shows how your app might look before and after making these changes:

Before

import ru.mail.mrgservice.advertising.MRGSAdvert;
import ru.mail.mrgservice.advertising.MRGSAdvertisingFactory;

final MRGSAdvert videoAdvert = MRGSAdvertisingFactory.createMRGSAdvertising(true);
videoAdvert.showContent();

After

import games.my.mrgs.advertising.MRGSAdvert;
import games.my.mrgs.advertising.MRGSAdvertisingFactory;

final MRGSAdvert videoAdvert = MRGSAdvertisingFactory.createMRGSAdvertising(true);
videoAdvert.showContent();

MRGSAnalytics🔗

Update SDK🔗

dependencies {
-   def mrgsVersion = "5.0.0"
+   def mrgsVersion = "6.0.0"

    implementation "games.my.mrgs:analytics:$mrgsVersion"
}

Update SDK🔗

Main changes:

  • Class AppsFlyerParams renamed to MRGSAppsFlyerParams and moved into MRGSAnalytics module.

  • Class MRGSAnalytics moved from ru.mail.mrgservice.analytics to games.my.mrgs.analytics.

  • Class MRGSAppsFlyer moved from ru.mail.mrgservice.analytics to games.my.mrgs.analytics.
  • Class MRGSAppsFlyerLinkGenerator moved from ru.mail.mrgservice.analytics to games.my.mrgs.analytics.

The following example shows how your app might look before and after making these changes:

Before

import ru.mail.mrgservice.analytics.MRGSAnalytics;
import ru.mail.mrgservice.analytics.MRGSAppsFlyer;

final MRGSAnalytics analytics = MRGSAnalytics.getInstance();
analytics.sendEvent("<Event>", null);

MRGSAppsFlyer.forceCustomerUserId("custom_user_id");
final MRGSAppsFlyer appsFlyer = analytics.getAppsFlyer();
appsFlyer.sendEvent("<Event>", "<Value>");

After

import games.my.mrgs.analytics.MRGSAnalytics;
import games.my.mrgs.analytics.MRGSAppsFlyer;

final MRGSAnalytics analytics = MRGSAnalytics.getInstance();
analytics.sendEvent("<Event>", null);

MRGSAppsFlyer.forceCustomerUserId("custom_user_id");
final MRGSAppsFlyer appsFlyer = analytics.getAppsFlyer();
appsFlyer.sendEvent("<Event>", "<Value>");

MRGSAuthentications🔗

MRGSVK was moved to his own module and no more provides by MRGSAuthentication module. A new way to add MRGSVK to your project:

Add dependency in build.gradle file:

dependencies {
    def mrgsVersion = "6.0.0"

    implementation "games.my.mrgs:authentication-vk:$mrgsVersion"
}

Copy MRGSAuthenticationVK file to the libs directory of your project. Add the necessary dependencies to the build file.gradle

dependencies {
    //...
    implementation(name: 'MRGSAuthenticationVK', ext:'aar')
    implementation "com.vk:android-sdk-core:3.x.x"
}

MRGSGoogleGames has been renamed and moved to its own module and no longer comes with MRGSAuthentication. A new way to add MRGSGoogleSignIn to your project:

Add dependency in build.gradle file:

dependencies {
    def mrgsVersion = "6.0.0"

    implementation "games.my.mrgs:authentication-google-signin:$mrgsVersion"
}

Copy MRGSAuthenticationVK file to the libs directory of your project. Add the necessary dependencies to the build file.gradle

dependencies {
    //...
    implementation(name: 'MRGSAuthenticationGoogleSgnIn', ext:'aar')
    implementation "com.google.android.gms:play-services-auth:20.x.x"
    implementation "com.google.android.gms:play-services-games:22.x.x"
}

Update SDK🔗

dependencies {
-   def mrgsVersion = "5.0.0"
+   def mrgsVersion = "6.0.0"

    implementation "games.my.mrgs:authentication:$mrgsVersion"
}

Update SDK🔗

Main changes:

  • Class MRGSVK moved into his own MRGSAuthenticationVK module.
  • Class VKontakteParams renamed to MRGSVKontakteParams and moved into MRGSAuthenticationVK module.

  • Class MRGSAmazon moved from ru.mail.mrgservice.authentication.amazon to games.my.mrgs.authentication.amazon.

  • Class MRGSFacebook moved from ru.mail.mrgservice.authentication.facebook to games.my.mrgs.authentication.facebook.
  • Class MRGSGoogleGames moved from ru.mail.mrgservice.authentication.googlegames to games.my.mrgs.authentication.googlegames.
  • Class MRGSMyGames moved from ru.mail.mrgservice.authentication.mygames to games.my.mrgs.authentication.mygames.

  • Class MRGSUser moved from ru.mail.mrgservice.authentication to games.my.mrgs.authentication.

  • Class MRGSAuthInfo removed. Use MRGSAccessToken instead.

  • Interface MRGSAuthentication.ExternalLogoutCallback removed. Use MRGSAuthentication.OnExternalLogoutListener instead.

  • Interface MRGSSocial moved from ru.mail.mrgservice.authentication to games.my.mrgs.authentication.
  • Interface MRGSScore moved from ru.mail.mrgservice.authentication to games.my.mrgs.authentication.
  • Interface MRGSLeaderBoards moved from ru.mail.mrgservice.authentication to games.my.mrgs.authentication.
  • Interface MRGSAchievements moved from ru.mail.mrgservice.authentication to games.my.mrgs.authentication.

  • Enum MRGSAuthenticationNetwork removed.

  • Enum MRGSAuthenticationNetwork.UNKNOWN removed.
  • Enum MRGSAuthenticationNetwork.AMAZON removed. Use MRGSAmazon.SOCIAL_ID instead.
  • Enum MRGSAuthenticationNetwork.FACEBOOK removed. Use MRGSFacebook.SOCIAL_ID instead.
  • Enum MRGSAuthenticationNetwork.GOOGLE_GAMES removed. Use MRGSGoogleSignIn.SOCIAL_ID instead.
  • Enum MRGSAuthenticationNetwork.MY_GAMES removed. Use MRGSMyGames.SOCIAL_ID instead.
  • Enum MRGSAuthenticationNetwork.VKONTAKTE removed. Use MRGSVK.SOCIAL_ID instead.

  • Method MRGSAccessToken#getSocialId() now returns String instead MRGSAuthenticationNetwork.

  • Method MRGSAuthentication#getSocialId() now returns String instead MRGSAuthenticationNetwork.
  • Method MRGSAuthentication#loginWithScopes(List<String>, MRGSLoginCallback) removed. Use MRGSAuthentication#login(List<String>, MRGSLoginCallback) instead.
  • Method MRGSAuthentication#getAuthInfo(BiConsumer<MRGSAuthInfo, MRGSError>) removed. Use MRGSAuthentication#getAccessToken(BiConsumer<MRGSAccessToken, MRGSError>) instead.
  • Method MRGSAuthentication#getUserAvatar(MRGSUser, MRGSAvatarCallback, int, int) removed. Use MRGSAuthentication#getUserAvatar(MRGSUser, int, int, MRGSAvatarCallback) instead.
  • Method MRGSAuthentication#setOnExternalLogoutCallback(ExternalLogoutCallback) removed. Use MRGSAuthentication#setOnExternalLogoutListener(OnExternalLogoutListener) instead.
  • Method MRGSAuthentication.OnExternalLogoutListener#onUserLogout now requires String instead MRGSAuthenticationNetwork.

  • Method MRGSAmazon#tryUpdateToken() removed. Use MRGSAmazon#getAccessToken(BiConsumer<MRGSAccessToken, MRGSError>) instead.

  • Method MRGSAchievement#achievementId() removed. Use MRGSAchievement#getAchievementId() instead.

  • Method MRGSAchievement#name() removed. Use MRGSAchievement#getName() instead.
  • Method MRGSAchievement#description() removed. Use MRGSAchievement#getDescription() instead.
  • Method MRGSAchievement#state() removed. Use MRGSAchievement#getState() instead.
  • Method MRGSAchievement#currentSteps() removed. Use MRGSAchievement#getCurrentSteps() instead.
  • Method MRGSAchievement#totalSteps() removed. Use MRGSAchievement#getTotalSteps() instead.
  • Method MRGSAchievement#completionPercent() removed. Use MRGSAchievement#getCompletionPercent() instead.

  • Method MRGSCredentials#setUserId(String) removed.

  • Method MRGSCredentials#setUser(MRGSUser) removed.
  • Method MRGSCredentials#setAuthInfo(MRGSAuthInfo) removed.
  • Method MRGSCredentials#getAuthInfo() removed. Use MRGSCredentials#getAccessToken() instead.
  • Method MRGSCredentials#getSocialId() now returns String instead MRGSAuthenticationNetwork.

  • Method MRGSLeaderboard#leaderboardId() removed. Use MRGSLeaderboard#getLeaderboardId() instead.

  • Method MRGSLeaderboard#name() removed. Use MRGSLeaderboard#getName() instead.

  • Method MRGSScore#leaderboardId() removed. Use MRGSScore#getLeaderboardId() instead.

  • Method MRGSScore#rank() removed. Use MRGSScore#getRank() instead.
  • Method MRGSScore#displayRank() removed. Use MRGSScore#getDisplayRank() instead.
  • Method MRGSScore#rawScore() removed. Use MRGSScore#getRawScore() instead.
  • Method MRGSScore#displayScore() removed. Use MRGSScore#getDisplayScore() instead.
  • Method MRGSScore#player() removed. Use MRGSScore#getPlayer() instead.

  • Method MRGSUser#userId() removed. Use MRGSUser#getUserId() instead.

  • Method MRGSUser#nick() removed. Use MRGSUser#getNickName() instead.
  • Method MRGSUser#firstName() removed. Use MRGSUser#getFirstName() instead.
  • Method MRGSUser#lastName() removed. Use MRGSUser#getLastName() instead.
  • Method MRGSUser#middleName() removed. Use MRGSUser#getMiddleName() instead.
  • Method MRGSUser#fullName() removed. Use MRGSUser#getFullName() instead.
  • Method MRGSUser#displayName() removed. Use MRGSUser#getDisplayName() instead.
  • Method MRGSUser#gender() removed. Use MRGSUser#getGender() instead.
  • Method MRGSUser#birthDate() removed. Use MRGSUser#getBirthDate() instead.
  • Method MRGSUser#location() removed. Use MRGSUser#getLocation() instead.
  • Method MRGSUser#socialId() removed. Use MRGSUser#getSocialId() instead.
  • Method MRGSUser#getSocialId() now returns String instead MRGSAuthenticationNetwork.

The following example shows how your app might look before and after making these changes:

Before

import java.util.Arrays;

import ru.mail.mrgservice.MRGSError;
import ru.mail.mrgservice.authentication.MRGSAccessToken;
import ru.mail.mrgservice.authentication.MRGSAuthentication;
import ru.mail.mrgservice.authentication.MRGSAuthentication.OnExternalLogoutListener;
import ru.mail.mrgservice.authentication.MRGSAuthenticationNetwork;
import ru.mail.mrgservice.authentication.MRGSCredentials;
import ru.mail.mrgservice.authentication.MRGSLoginCallback;
import ru.mail.mrgservice.authentication.MRGSUser;
import ru.mail.mrgservice.utils.optional.BiConsumer;

final MRGSAuthentication authentication = AuthenticationImpl.getInstance();

// Set logout listener
authentication.setOnExternalLogoutListener(new OnExternalLogoutListener() {
    @Override
    public void onUserLogout(@NonNull MRGSAuthenticationNetwork network) {
        // Handle result
    }
});

// Common login
authentication.login(new MRGSLoginCallback() {
    @Override
    public void onSuccess(@NonNull MRGSCredentials credentials) {
        // Handle result
    }

    @Override
    public void onError(@NonNull MRGSError error) {
        // Handle error
    }
});

// Login with scopes
authentication.login(Arrays.asList("scope_1", "scope_2"), new MRGSLoginCallback() {
    @Override
    public void onSuccess(@NonNull MRGSCredentials credentials) {
        // Handle result
    }

    @Override
    public void onError(@NonNull MRGSError error) {
        // Handle error
    }
});

// Get current user's information
authentication.getCurrentUser(new MRGSAuthentication.UserCallback() {
    @Override
    public void onSuccess(@NonNull final MRGSUser user) {
        // Handle result
    }

    @Override
    public void onError(@NonNull MRGSError error) {
    }
});

// Get current user's authentication information
authentication.getAccessToken(new BiConsumer<MRGSAccessToken, MRGSError>() {
    @Override
    public void accept(@Nullable MRGSAccessToken accessToken, @Nullable MRGSError error) {
        if (error != null) {
            // Handle error
        } else {
            // Handle result
        }
    }
});

// Call logout
authentication.logout();

After

import java.util.Arrays;

import games.my.mrgs.MRGSError;
import games.my.mrgs.authentication.MRGSAccessToken;
import games.my.mrgs.authentication.MRGSAuthentication;
import games.my.mrgs.authentication.MRGSAuthentication.OnExternalLogoutListener;
import games.my.mrgs.authentication.MRGSAuthenticationNetwork;
import games.my.mrgs.authentication.MRGSCredentials;
import games.my.mrgs.authentication.MRGSLoginCallback;
import games.my.mrgs.authentication.MRGSUser;
import games.my.mrgs.utils.optional.BiConsumer;

final MRGSAuthentication authentication = AuthenticationImpl.getInstance();

// Set logout listener
authentication.setOnExternalLogoutListener(new OnExternalLogoutListener() {
    @Override
    public void onUserLogout(@NonNull MRGSAuthenticationNetwork network) {
        // Handle result
    }
});

// Common login
authentication.login(new MRGSLoginCallback() {
    @Override
    public void onSuccess(@NonNull MRGSCredentials credentials) {
        // Handle result
    }

    @Override
    public void onError(@NonNull MRGSError error) {
        // Handle error
    }
});

// Login with scopes
authentication.login(Arrays.asList("scope_1", "scope_2"), new MRGSLoginCallback() {
    @Override
    public void onSuccess(@NonNull MRGSCredentials credentials) {
        // Handle result
    }

    @Override
    public void onError(@NonNull MRGSError error) {
        // Handle error
    }
});

// Get current user's information
authentication.getCurrentUser(new MRGSAuthentication.UserCallback() {
    @Override
    public void onSuccess(@NonNull final MRGSUser user) {
        // Handle result
    }

    @Override
    public void onError(@NonNull MRGSError error) {
    }
});

// Get current user's authentication information
authentication.getAccessToken(new BiConsumer<MRGSAccessToken, MRGSError>() {
    @Override
    public void accept(@Nullable MRGSAccessToken accessToken, @Nullable MRGSError error) {
        if (error != null) {
            // Handle error
        } else {
            // Handle result
        }
    }
});

// Call logout
authentication.logout();

MRGSBilling🔗

Update SDK🔗

dependencies {
-   def mrgsVersion = "5.0.0"
+   def mrgsVersion = "6.0.0"

    implementation "games.my.mrgs:billing:$mrgsVersion"
}

Update SDK🔗

Main changes:

  • Class MRGSBilling moved from ru.mail.mrgservice.billing to games.my.mrgs.billing.
  • Class MRGSBillingProduct moved from ru.mail.mrgservice.billing to games.my.mrgs.billing.
  • Class MRGSBillingEntities moved from ru.mail.mrgservice.billing to games.my.mrgs.billing.
  • Class MRGSMyGamesBilling moved from ru.mail.mrgservice.billing to games.my.mrgs.billing.

  • Interface MRGSBillingDelegate moved from ru.mail.mrgservice.billing to games.my.mrgs.billing.

  • Field MRGSBilling.BILLING_VKPAY removed. Use MRGSVKPay.BILLING_VKPAY instead.

The following example shows how your app might look before and after making these changes:

Before

import java.util.Arrays;
import java.util.List;

import ru.mail.mrgservice.billing.MRGSBilling;
import ru.mail.mrgservice.billing.MRGSBillingDelegate;
import ru.mail.mrgservice.billing.MRGSBillingEntities.MRGSBankProductsRequest;
import ru.mail.mrgservice.billing.MRGSBillingEntities.MRGSBankPurchaseRequest;
import ru.mail.mrgservice.billing.MRGSBillingProduct;

final MRGSBilling billing = MRGSBilling.getInstance();

final MRGSBillingDelegate listener = new MRGSBillingDelegate() {
    ...
};
billing.setDelegate(listener);

// Request Products
final List<String> consumable = Arrays.asList(
        "games.my.mrgs.purchase1",
        "games.my.mrgs.purchase2",
        "android.test.purchased");
final List<String> nonConsumable = Arrays.asList("games.my.mrgs.mrgservisetest.noncons");
final List<String> subscriptions = Arrays.asList(
        "games.my.mrgs.subs1",
        "games.my.mrgs.subs2",
        "games.my.mrgs.subs3");

final MRGSBankProductsRequest productRequest = new MRGSBankProductsRequest();
productRequest.add(consumable, MRGSBillingProduct.CONS);
productRequest.add(nonConsumable, MRGSBillingProduct.NONCONS);
productRequest.add(subscriptions, MRGSBillingProduct.SUBS);

// The result of request will be sent to one of
// MRGSBillingDelegate#onReceiveProductsResponse(MRGSBankProductsResponse)
// or to MRGSBillingDelegate#onReceiveProductsError(MRGSBankProductsResponse)
billing.requestProductsInfo(productRequest);


// Buy product
final String sku = "games.my.mrgs.purchase1";
final String devPayload = "{\"item\": 123,\"store\": 456}";
final MRGSBankPurchaseRequest purchaseRequest = new MRGSBankPurchaseRequest(sku, devPayload);

// The result of request will be sent to one of
// MRGSBillingDelegate#onReceiveSuccessfulPurchase(MRGSBankPurchaseResult),
// MRGSBillingDelegate#onReceiveFailedPurchase(MRGSBankPurchaseResult),
// MRGSBillingDelegate#onReceivePendingPurchase(MRGSBankPurchaseResult),
// or MRGSBillingDelegate#onReceiveCancelledPurchase(MRGSBankPurchaseResult).
billing.buyItem(purchaseRequest);

After

import java.util.Arrays;
import java.util.List;

import games.my.mrgs.billing.MRGSBilling;
import games.my.mrgs.billing.MRGSBillingDelegate;
import games.my.mrgs.billing.MRGSBillingEntities.MRGSBankProductsRequest;
import games.my.mrgs.billing.MRGSBillingEntities.MRGSBankPurchaseRequest;
import games.my.mrgs.billing.MRGSBillingProduct;

final MRGSBilling billing = MRGSBilling.getInstance();

final MRGSBillingDelegate listener = new MRGSBillingDelegate() {
    ...
};
billing.setDelegate(listener);

// Request Products
final List<String> consumable = Arrays.asList(
        "games.my.mrgs.purchase1",
        "games.my.mrgs.purchase2",
        "android.test.purchased");
final List<String> nonConsumable = Arrays.asList("games.my.mrgs.mrgservisetest.noncons");
final List<String> subscriptions = Arrays.asList(
        "games.my.mrgs.subs1",
        "games.my.mrgs.subs2",
        "games.my.mrgs.subs3");

final MRGSBankProductsRequest productRequest = new MRGSBankProductsRequest();
productRequest.add(consumable, MRGSBillingProduct.CONS);
productRequest.add(nonConsumable, MRGSBillingProduct.NONCONS);
productRequest.add(subscriptions, MRGSBillingProduct.SUBS);

// The result of request will be sent to one of
// MRGSBillingDelegate#onReceiveProductsResponse(MRGSBankProductsResponse)
// or to MRGSBillingDelegate#onReceiveProductsError(MRGSBankProductsResponse)
billing.requestProductsInfo(productRequest);


// Buy product
final String sku = "games.my.mrgs.purchase1";
final String devPayload = "{\"item\": 123,\"store\": 456}";
final MRGSBankPurchaseRequest purchaseRequest = new MRGSBankPurchaseRequest(sku, devPayload);

// The result of request will be sent to one of
// MRGSBillingDelegate#onReceiveSuccessfulPurchase(MRGSBankPurchaseResult),
// MRGSBillingDelegate#onReceiveFailedPurchase(MRGSBankPurchaseResult),
// MRGSBillingDelegate#onReceivePendingPurchase(MRGSBankPurchaseResult),
// or MRGSBillingDelegate#onReceiveCancelledPurchase(MRGSBankPurchaseResult).
billing.buyItem(purchaseRequest);

MRGSFirebase🔗

Update SDK🔗

dependencies {
-   def mrgsVersion = "5.0.0"
+   def mrgsVersion = "6.0.0"

    implementation "games.my.mrgs:firebase:$mrgsVersion"
}

Update SDK🔗

Main changes:

  • Class MRGSFirebaseAnalytics moved from ru.mail.mrgservice.firebase to games.my.mrgs.firebase.

The following example shows how your app might look before and after making these changes:

Before

import java.util.Map;
import java.util.TreeMap;

import ru.mail.mrgservice.firebase.MRGSFirebaseAnalytics;

final Map<String, Object> params = new TreeMap<>();
params.put("someInfoKey", "someImportantInfo");
MRGSFirebaseAnalytics.getInstance().sendEvent("event_name", params);

After

import java.util.Map;
import java.util.TreeMap;

import games.my.mrgs.firebase.MRGSFirebaseAnalytics;

final Map<String, Object> params = new TreeMap<>();
params.put("someInfoKey", "someImportantInfo");
MRGSFirebaseAnalytics.getInstance().sendEvent("event_name", params);

MRGSGDPR🔗

Update SDK🔗

dependencies {
-   def mrgsVersion = "5.0.0"
+   def mrgsVersion = "6.0.0"

    implementation "games.my.mrgs:gdpr:$mrgsVersion"
}

Update SDK🔗

Main changes:

  • Class MRGSCCPA moved from ru.mail.mrgservice.ccpa to games.my.mrgs.ccpa.
  • Class MRGSCCPA moved from ru.mail.mrgservice.coppa to games.my.mrgs.coppa.
  • Class MRGSGDPR moved from ru.mail.mrgservice.gdpr to games.my.mrgs.gdpr.

  • Interface MRGSCOPPAParameters moved from ru.mail.mrgservice.coppa to games.my.mrgs.coppa.

  • Interface MRGSCOPPAShowResult moved from ru.mail.mrgservice.coppa to games.my.mrgs.coppa.

The following example shows how your app might look before and after making these changes:

Before

import ru.mail.mrgservice.gdpr.MRGSGDPR;

final MRGSGDPR gdpr = MRGSGDPR.getInstance();
gdpr.setDelegate(this);
gdpr.onlyEU(true);
gdpr.setBackgroundColor(255, 0, 0);
gdpr.withAdvertising(true);
gdpr.setLocalizationLanguage("en");

After

import games.my.mrgs.gdpr.MRGSGDPR;

final MRGSGDPR gdpr = MRGSGDPR.getInstance();
gdpr.setDelegate(this);
gdpr.onlyEU(true);
gdpr.setBackgroundColor(255, 0, 0);
gdpr.withAdvertising(true);
gdpr.setLocalizationLanguage("en");

MRGSNotifications🔗

Update SDK🔗

dependencies {
-   def mrgsVersion = "5.0.0"
+   def mrgsVersion = "6.0.0"

    implementation "games.my.mrgs:notifications:$mrgsVersion"
}

Update SDK🔗

Main changes:

  • Class MRGSNotificationCenter moved from ru.mail.mrgservice to games.my.mrgs.notifications.
  • Class MRGSNotificationChannel moved from ru.mail.mrgservice to games.my.mrgs.notifications.
  • Class MRGSNotificationChannelGroup moved from ru.mail.mrgservice to games.my.mrgs.notifications.
  • Class MRGSPushNotification moved from ru.mail.mrgservice to games.my.mrgs.notifications.
  • Class MRGSPushNotificationHandler moved from ru.mail.mrgservice to games.my.mrgs.notifications.

The following example shows how your app might look before and after making these changes:

Before

import ru.mail.mrgservice.MRGS;
import ru.mail.mrgservice.MRGSMap;
import ru.mail.mrgservice.MRGSNotificationCenter;
import ru.mail.mrgservice.MRGSNotificationChannel;
import ru.mail.mrgservice.MRGSNotificationChannelGroup;
import ru.mail.mrgservice.MRGSPushNotification;
import ru.mail.mrgservice.MRGSPushNotificationHandler.MRGSPushNotificationDelegate;

final MRGSNotificationCenter notificationCenter = MRGSNotificationCenter.getInstance();

// Create a listener for local and remote notification.
// You can create another listener to separate notifications or uses one and separate them
// with boolean isLocal
MRGSPushNotificationDelegate notifyDelegate = new MRGSPushNotificationDelegate() {
    @Override
    public void clickOnNotification(int idNotify, String title, String msg, MRGSMap developerPayload, boolean isLocal) {
        //Handle result.
    }

    @Override
    public void receivedNotification(int idNotify, String title, String msg, MRGSMap developerPayload, boolean isLocal) {
        //Handle result.
    }
};

notificationCenter.setLocalDelegate(notifyDelegate);
notificationCenter.setRemoteDelegate(notifyDelegate);

// Create notification channel group
final MRGSNotificationChannelGroup group = new MRGSNotificationChannelGroup("my_group_id", "My Group");
notificationCenter.createNotificationChannelGroup(context, group);

// Create notification channel
final MRGSNotificationChannel channel = new MRGSNotificationChannel("my_channel_id", "My Channel");
channel.setDescription("Description");
channel.setGroup("my_group_id");
channel.setSound("push_sound");
channel.enableLights(true);

notificationCenter.createNotificationChannel(context, channel);

// Create local push notification
final int time = MRGS.timeUnix() + 10;
MRGSPushNotification notification = MRGSPushNotification.create("Message number 1", 1, time);
notification.setGroupId(222);
notification.setGroupMessage("New resources arrived");
notification.setGroupTitle("Receive your resources");
notificationCenter.addLocalPush(notification);

After

import games.my.mrgs.MRGS;
import games.my.mrgs.MRGSMap;
import games.my.mrgs.notifications.MRGSNotificationCenter;
import games.my.mrgs.notifications.MRGSNotificationChannel;
import games.my.mrgs.notifications.MRGSNotificationChannelGroup;
import games.my.mrgs.notifications.MRGSPushNotification;
import games.my.mrgs.notifications.MRGSPushNotificationHandler.MRGSPushNotificationDelegate;

final MRGSNotificationCenter notificationCenter = MRGSNotificationCenter.getInstance();

// Create a listener for local and remote notification.
// You can create another listener to separate notifications or uses one and separate them
// with boolean isLocal
MRGSPushNotificationDelegate notifyDelegate = new MRGSPushNotificationDelegate() {
    @Override
    public void clickOnNotification(int idNotify, String title, String msg, MRGSMap developerPayload, boolean isLocal) {
        //Handle result.
    }

    @Override
    public void receivedNotification(int idNotify, String title, String msg, MRGSMap developerPayload, boolean isLocal) {
        //Handle result.
    }
};

notificationCenter.setLocalDelegate(notifyDelegate);
notificationCenter.setRemoteDelegate(notifyDelegate);

// Create notification channel group
final MRGSNotificationChannelGroup group = new MRGSNotificationChannelGroup("my_group_id", "My Group");
notificationCenter.createNotificationChannelGroup(context, group);

// Create notification channel
final MRGSNotificationChannel channel = new MRGSNotificationChannel("my_channel_id", "My Channel");
channel.setDescription("Description");
channel.setGroup("my_group_id");
channel.setSound("push_sound");
channel.enableLights(true);

notificationCenter.createNotificationChannel(context, channel);

// Create local push notification
final int time = MRGS.timeUnix() + 10;
MRGSPushNotification notification = MRGSPushNotification.create("Message number 1", 1, time);
notification.setGroupId(222);
notification.setGroupMessage("New resources arrived");
notification.setGroupTitle("Receive your resources");
notificationCenter.addLocalPush(notification);

MRGSRecommendations🔗

Update SDK🔗

dependencies {
-   def mrgsVersion = "5.0.0"
+   def mrgsVersion = "6.0.0"

    implementation "games.my.mrgs:recsys:$mrgsVersion"
}

Update SDK🔗

Main changes:

  • Class MRGSRecommendations moved from ru.mail.mrgservice.recsys to games.my.mrgs.recsys.
  • Class MRGSRecSysEvent moved from ru.mail.mrgservice.recsys to games.my.mrgs.recsys.
  • Class MRGSRecSysEvents moved from ru.mail.mrgservice.recsys to games.my.mrgs.recsys.

The following example shows how your app might look before and after making these changes:

Before

import ru.mail.mrgservice.recsys.MRGSRecSysEvent;
import ru.mail.mrgservice.recsys.MRGSRecSysEvents;
import ru.mail.mrgservice.recsys.MRGSRecommendations;

final MRGSRecommendations recSys = MRGSRecommendations.getInstance();
final MRGSRecSysEvent offerEvent = new MRGSRecSysEvents.OfferActionEvent("testOffer1", MRGSRecSysEvent.ACTION_TYPE_VIEW);
recSys.trackEvent(offerEvent);

final MRGSRecSysEvent offerClick = new MRGSRecSysEvents.OfferActionEvent("testOffer1", MRGSRecSysEvent.ACTION_TYPE_CLICK);
recSys.trackEvent(offerClick);

final MRGSRecSysEvent offerBuy = new MRGSRecSysEvents.OfferActionEvent("testOffer1", MRGSRecSysEvent.ACTION_TYPE_CLICK);
offerBuy.putParam("sku", "ru.mail.mrgstestpurchase");
offerBuy.putParam("gameOfferId", "offer123");
recSys.trackEvent(offerBuy);

After

import games.my.mrgs.recsys.MRGSRecSysEvent;
import games.my.mrgs.recsys.MRGSRecSysEvents;
import games.my.mrgs.recsys.MRGSRecommendations;

final MRGSRecommendations recSys = MRGSRecommendations.getInstance();
final MRGSRecSysEvent offerEvent = new MRGSRecSysEvents.OfferActionEvent("testOffer1", MRGSRecSysEvent.ACTION_TYPE_VIEW);
recSys.trackEvent(offerEvent);

final MRGSRecSysEvent offerClick = new MRGSRecSysEvents.OfferActionEvent("testOffer1", MRGSRecSysEvent.ACTION_TYPE_CLICK);
recSys.trackEvent(offerClick);

final MRGSRecSysEvent offerBuy = new MRGSRecSysEvents.OfferActionEvent("testOffer1", MRGSRecSysEvent.ACTION_TYPE_CLICK);
offerBuy.putParam("sku", "games.my.mrgstestpurchase");
offerBuy.putParam("gameOfferId", "offer123");
recSys.trackEvent(offerBuy);

MRGSShowcase🔗

Update SDK🔗

dependencies {
-   def mrgsVersion = "5.0.0"
+   def mrgsVersion = "6.0.0"

    implementation "games.my.mrgs:showcase:$mrgsVersion"
}

Update SDK🔗

Main changes:

  • Class MRGSShowcase moved from ru.mail.mrgservice.showcase to games.my.mrgs.showcase.

The following example shows how your app might look before and after making these changes:

Before

import ru.mail.mrgservice.showcase.MRGSShowcase;

final MRGSShowcase instance = MRGSShowcase.getInstance();
instance.setShowListener(this);
instance.setNewContentListener(this);

instance.showContent();

After

import games.my.mrgs.showcase.MRGSShowcase;

final MRGSShowcase instance = MRGSShowcase.getInstance();
instance.setShowListener(this);
instance.setNewContentListener(this);

instance.showContent();

MRGSSupport🔗

Update SDK🔗

dependencies {
-   def mrgsVersion = "5.0.0"
+   def mrgsVersion = "6.0.0"

    implementation "games.my.mrgs:support:$mrgsVersion"
}

Update SDK🔗

Main changes:

  • Class MRGSMyComSupport renamed to MRGSMyGamesSupport and moved from ru.mail.mrgservice to games.my.mrgs.support.
  • Class MRGSMyComSupportDialog removed, use MRGSMyGamesSupport instead.
  • Class MyComSupportParams removed, use MRGSMyGamesSupportWidgetConfig instead.
  • Class MRGSMyGamesSupportTicket moved from ru.mail.mrgservice.support to games.my.mrgs.support instead.

  • Interface MRGSMyGamesSupportDialog.MyComListener removed, use MRGSMyGamesSupport.show(Activity, Consumer<MRGSError>) instead.

  • Enum ru.mail.mrgservice.MRGSMyComSupport.Credential.SocialNetwork.VK removed.

  • Method MRGSMyComSupport#getMyComSupport() renamed to MRGSMyGamesSupport#getInstance().

  • Method MRGSMyGamesSupportDialog.setCode(String) removed, use MRGSMyGamesSupportWidgetConfig.setAuthCode(String) instead.

  • Method MRGSMyGamesSupportDialog.setFull(bool) removed, use MRGSMyGamesSupportWidgetConfig.setFullscreen(bool) instead.

  • Method MRGSMyGamesSupportDialog.addExtraParam(String) removed, use MRGSMyGamesSupportWidgetConfig.setExtraParameters(String) instead.

  • Method MRGSMyGamesSupportDialog.show() removed, use MRGSMyGamesSupport.show(Activity) instead.
  • Method MRGSMyGamesSupportDialog.showFeedback() removed, use MRGSMyGamesSupport.show(Activity, MRGSMyGamesSupportWidgetConfig) instead.
  • Method MRGSMyGamesSupportDialog.setLocalizationLanguage(String) removed, use WidgetConfig.setLanguage(String) instead.
  • Method MRGSMyGamesSupportDialog.setCategory(String) removed, use WidgetConfig.setPage(WidgetPage) instead.
  • Method MRGSMyGamesSupportDialog.setListener(OnUiListener) removed, use MRGSMyGamesSupport.show(Activity, Consumer<MRGSError>) instead.

  • Method MRGSMyGamesSupportDialog.setErrorTitle(String). removed, use MRGSMyGamesSupportLocalization.setErrorDialogParams(String, String, String) instead.

  • Method MRGSMyGamesSupportDialog.setErrorMessage(String) removed, use MRGSMyGamesSupportLocalization.setErrorDialogParams(String, String, String) instead.
  • Method MRGSMyGamesSupportDialog.setErrorButton(String) removed, use MRGSMyGamesSupportLocalization.setErrorDialogParams(String, String, String) instead.

  • Method MRGSMyGamesSupportDialog.setText(String) removed, because it is no longer used.

  • Method MRGSMyGamesSupportDialog.setWritePermissionRationaleDialogParams(String, String, String, String) removed, use MRGSMyGamesSupportLocalization.setWritePermissionRationaleDialogParams(String, String, String, String) instead.
  • Method MRGSMyGamesSupportDialog.setWritePermissionSettingsDialogParams(String, String, String, String) removed, use MRGSMyGamesSupportLocalization.setWritePermissionSettingsDialogParams(String, String, String, String) instead.

  • Method MRGSMyGamesSupportDialog.setRequestSettingClassName(String) removed, because it is no longer used.

  • Method MRGSMyGamesSupportDialog.setRequestRationalActivityClassName(String) removed, because it is no longer used.
  • Method MRGSMyGamesSupportDialog.setRequestRationalDialogParams(String, String, int) removed, because it is no longer used.
  • Method MRGSMyGamesSupportDialog.setRequestRationalDialogParams(String, String) removed, because it is no longer used.
  • Method MRGSMyGamesSupportDialog.setRequestSettingsDialogParams(String, String, String) removed, because it is no longer used.
  • Method MRGSMyGamesSupportDialog.setRequestSettingsDialogParams(String, String, String, int) removed, because it is no longer used.
  • Method MRGSMyGamesSupportDialog.setRequestSettingsDialogParams(String, String, String, int, String, String) removed, because it is no longer used.

The following example shows how your app might look before and after making these changes:

Before

import ru.mail.mrgservice.MRGSMyComSupportDialog;

final MRGSMyComSupportDialog dialog = new MRGSMyComSupportDialog(activity);
dialog.setCategory(<CATEGORY>);
dialog.setText(<TEXT>);
dialog.setListener(this);
dialog.show();

// Or show feedback
dialog.showFeedback();

After

import android.app.Activity;

import androidx.annotation.Nullable;

import games.my.mrgs.MRGSError;
import games.my.mrgs.support.MRGSMyGamesSupport;
import games.my.mrgs.support.MRGSMyGamesSupportWidgetConfig;
import games.my.mrgs.support.MRGSMyGamesSupportWidgetPage;
import games.my.mrgs.utils.optional.Consumer;

final MRGSMyGamesSupportWidgetConfig widgetConfig = MRGSMyGamesSupportWidgetConfig.newInstance();
widgetConfig.setExtraParameters(<Payload>);
MRGSMyGamesSupport.getInstance().show(activity, widgetConfig, new Consumer<MRGSError>() {
    @Override
    public void accept(@Nullable MRGSError error) {
        // Support widget was closed. 
        // Check if there was any errors
        if (error != null) {
            // Handle the error
        }
    }
});

// Or show feedback
widgetConfig.setPage(MRGSMyGamesSupportWidgetPage.FEEDBACK);
MRGSMyGamesSupport.getInstance().show(activity, widgetConfig, callback);

4.x.x → 5.0.0🔗

Version 5.0.0 contains backward incompatible changes due to partially redesigned API: removed @Deprecated functionality, changed function names, fixed typos, the public API changed package, and the private API moved to internal.

Java 8🔗

Also, to work with the SDK, you need to set to the project Java not lower than the version 8 in your application module. Most likely you already use Java 8 or higher, just check your application settings.

apply plugin: 'com.android.application'

android {
    compileSdkVersion ...
    buildToolsVersion ...

    defaultConfig { ... }
    buildTypes { ... }

+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_8
+        targetCompatibility JavaVersion.VERSION_1_8
+    }
}

Supported Maven repository🔗

Supported distributing the SDK through the Maven repository. To use it, add url to the root build.gradle (for com.android.tools.build:gradle:7.0.4 and below) or in settings.gradle (for com.android.tools.build:gradle:7.1.0 and higher)

allprojects {
    repositories {
        google()
        mavenCentral()
        // MRGS Maven repository.
+        maven { url 'https://mrgs-nexus.my.games/repository/maven2/' }
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        // MRGS Maven repository.
+        maven { url 'https://mrgs-nexus.my.games/repository/maven2/' }
    }
}

MRGService🔗

Update SDK🔗

Now the SDK can be downloaded via Maven repository, to do this, update your build.gradle file

dependencies {
    def mrgsVersion = "5.0.0"

-   implementation(name:'MRGService', ext:'aar')
+   implementation "games.my.mrgs:core:$mrgsVersion"
}

Update code🔗

Main changes:

  • Redesigned methods of MRGService initialization. Now it is similar to methods used in MRGS Unity SDK. Learn more

  • Interface MRGService.ActivityResultListener removed.

  • Interface Printable removed.
  • Interface MRGSIntegrationCheck.MRGSIntegrationCheckListener removed.
  • Class MRGSX509ExtendedTrustManager removed.
  • Class MRGSX509TrustManager removed.
  • Class MRGSAirLog removed.
  • Class MRGSExtSDK removed.

  • Method MRGService#instance() renamed to MRGService#getInstance().

  • Method MRGService#checkIntegration(MRGSIntegrationCheck.MRGSIntegrationCheckListener) removed. Use checkIntegration(@Nullable Consumer<MRGSIntegrationCheckResult>) instead.
  • Method MRGService#initialized() removed. Use MRGService#isInitialized() instead.
  • Method MRGService#registerResultListener(ActivityResultListener) removed.
  • Method MRGService#unregisterResultListener(ActivityResultListener) removed.
  • Method MRGService#onActivityRes(Activity, int, int, Intent) removed.
  • Method MRGService#registerTransferManagerDelegate(String, MRGSTransferManagerDelegate) removed.
  • Method MRGService#unregisterTransferManagerDelegate(MRGSTransferManagerDelegate) removed.
  • Method MRGService#getIsRunService() removed.
  • Method MRGService#setAppContext(Context) removed.
  • Method MRGService#onStart(Activity) removed.
  • Method MRGService#onStop(Activity) removed.
  • Method MRGService#getSharedPreferences(String) removed. Use MRGSSharedPreferences#newInstance(String) instead.
  • Method MRGService#getSharedPreferences(Context, String) removed. Use MRGSSharedPreferences#newInstance(Context, String) instead.
  • Method MRGService#sendHandleException(String) removed. Use MRGSCrashReports#sendHandleException(String) instead.
  • Method MRGService#sendHandleException(String, String) removed. Use MRGSCrashReports#sendHandleException(String, String) instead.

  • Method MRGSLog#log(String) removed.

  • Method MRGSMetrics.addPurchase(String, String, String) removed. Use MRGSMetrics.addPurchase(MRGSPurchaseEvent) instead.

  • Method MRGSUsers#instance() renamed to MRGSUsers#getInstance().

  • Method MRGSUsers#getCurrentUser() now returns MRGSUser instead of MRGSMap.

  • Method MRGSDevice#instance() renamed to MRGSDevice#getInstance().

  • Method MRGSDevice#useOldUDIDMethod() removed.
  • Method MRGSDevice#shouldUseOldUDIDMethod() removed.
  • Method MRGSDevice#generateDeviceIdOld(Context) removed.
  • Method MRGSDevice#getGoogleAccountPrimary() removed.
  • Method MRGSDevice#getODIN1() removed.
  • Method MRGSDevice#getIMEI() removed.
  • Method MRGSDevice#openSystemSettingsOfApplication() removed. MRGSDevice#openApplicationDetailsSettings(Context).
  • Method MRGSDevice#getOldOpenUDID() renamed to MRGSDevice#getDeviceIdOrUUID().

  • Method MRGSApplication#instance() renamed to MRGSApplication#getInstance().

  • Method MRGSApplication#getApplicationBundleName() will not return any more null.

  • Method MRGSServerData#instance() renamed to MRGSServerData#getInstance().

The following example shows how your app might look before and after making these changes:

Before

import android.os.Bundle;

import ru.mail.mrgservice.MRGSBillingDelegateEx;
import ru.mail.mrgservice.MRGService;

// Setting MRGService
final Bundle serviceParams = new Bundle();
serviceParams.putBoolean("debug", false);
serviceParams.putString("billing", "google");

// Setting External SDKS
final Bundle externalSDKParams = new Bundle();

// Setting MyTracker
final Bundle tracker = new Bundle();
tracker.putString("appId", "MY_TRACKER_SDK_KEY");
tracker.putString("enable", "true");
tracker.putString("debug", "false");

externalSDKParams.putBundle("MyTracker", tracker);

// Setting AppsFlyer
Bundle appsFlyer = new Bundle();
appsFlyer.putString("app_key", "<APPS_FLYER_DEVKEY>");
appsFlyer.putString("debug", "false");
appsFlyer.putString("enable", "true");

externalSDKParams.putBundle("AppsFlyer", appsFlyer);

// Setting other external SDKS
externalSDKParams.putBundle("Facebook", facebook);
externalSDKParams.putBundle("GoogleGames", googleGames);

MRGService.service(context, null, MRGS_APP_ID, CLIENT_SECRET, serviceParams, externalSDKParams);

After

import ru.mail.mrgservice.MRGSExternalSDKParams;
import ru.mail.mrgservice.MRGSExternalSDKParams.AppsFlyerParams;
import ru.mail.mrgservice.MRGSExternalSDKParams.MyTrackerParams;
import ru.mail.mrgservice.MRGSExternalSDKParams.FacebookParams;
import ru.mail.mrgservice.MRGSExternalSDKParams.GooglePlayGamesParams;
import ru.mail.mrgservice.MRGSPlatform;
import ru.mail.mrgservice.MRGService;
import ru.mail.mrgservice.MRGServiceParams;

// Setting MRGService
// Available MRGSPlatform: AMAZON, ANDROID, HUAWEI, SAMSUNG and FACEBOOK_CLOUD
final MRGServiceParams serviceParams
        = MRGServiceParams.init(<MRGS_APP_ID>, <CLIENT_SECRET>, MRGSPlatform.ANDROID)
serviceParams.setDebuggable(false);


// Setting External SDKS
final MRGSExternalSDKParams externalSDKParams = MRGSExternalSDKParams.newInstance();

// Setting MyTracker
final MyTrackerParams myTrackerParams = MyTrackerParams.init("MY_TRACKER_SDK_KEY");
myTrackerParams.setDebuggable(false);
externalSDKParams.myTrackerParams = myTrackerParams;

// Setting AppsFlyer
final AppsFlyerParams appsFlyerParams = AppsFlyerParams.init("DEV_KEY");
appsFlyerParams.setDebuggable(false);
appsFlyerParams.setForwardMetricsEnabled(true);
externalSDKParams.appsFlyerParams = appsFlyerParams;

// Setting other external SDKS
externalSDKParams.facebookParams = FacebookParams.init("FACEBOOK_APP_ID");
externalSDKParams.googlePlayGamesParams = GooglePlayGamesParams.init("GOOGLE_CLIENT_ID");

MRGService.service(context, serviceParams, externalSDKParams);

MRGSAdvertising🔗

Update SDK🔗

Now the SDK can be downloaded via Maven repository, to do this, update your build.gradle file

dependencies {
    def mrgsVersion = "5.0.0"

-   implementation(name:'MRGSAdvertising', ext:'aar')
+   implementation "games.my.mrgs:advertising:$mrgsVersion"
}

Update code🔗

Main changes:

  • Class MRGSAdvertisingConsts removed.
  • Class MRGSAdvertisingFactory moved from ru.mail.mrgservice to ru.mail.mrgservice.advertising.

The following example shows how your app might look before and after making these changes:

Before

import ru.mail.mrgservice.MRGSAdvertisingFactory;
import ru.mail.mrgservice.advertising.MRGSAdvert;

final MRGSAdvert videoAdvert = MRGSAdvertisingFactory.createMRGSAdvertising(true);
videoAdvert.showContent();

After

import ru.mail.mrgservice.advertising.MRGSAdvert;
import ru.mail.mrgservice.advertising.MRGSAdvertisingFactory;

final MRGSAdvert videoAdvert = MRGSAdvertisingFactory.createMRGSAdvertising(true);
videoAdvert.showContent();

MRGSAnalytics🔗

Update SDK🔗

Now the SDK can be downloaded via Maven repository, to do this, update your build.gradle file

dependencies {
    def mrgsVersion = "5.0.0"

-   implementation(name:'MRGSAnalytics', ext:'aar')
+   implementation "games.my.mrgs:analytics:$mrgsVersion"
}

Update code🔗

Main changes:

  • Class MRGSGoogleConversion removed.
  • Class MRGSAnalytics moved from ru.mail.mrgservice to ru.mail.mrgservice.advertising.
  • Class MRGSAppsFlyer moved from ru.mail.mrgservice to ru.mail.mrgservice.advertising.

  • Method MRGSAnalytics#getGoogleConversion() removed.

  • Method MRGSAppsFlyer#setCustomerUserId(String) removed. Use MRGSAppsFlyer#forceCustomerUserId(String) instead.

The following example shows how your app might look before and after making these changes:

Before

import ru.mail.mrgservice.MRGSAnalytics;
import ru.mail.mrgservice.MRGSAppsFlyer;


final MRGSAnalytics analytics = MRGSAnalytics.getInstance();
analytics.sendEvent("<Event>", null);

MRGSAppsFlyer.forceCustomerUserId("custom_user_id");
final MRGSAppsFlyer appsFlyer = analytics.getAppsFlyer();
appsFlyer.sendEvent("<Event>", "<Value>");

After

import ru.mail.mrgservice.analytics.MRGSAnalytics;
import ru.mail.mrgservice.analytics.MRGSAppsFlyer;

final MRGSAnalytics analytics = MRGSAnalytics.getInstance();
analytics.sendEvent("<Event>", null);

MRGSAppsFlyer.forceCustomerUserId("custom_user_id");
final MRGSAppsFlyer appsFlyer = analytics.getAppsFlyer();
appsFlyer.sendEvent("<Event>", "<Value>");

MRGSAuthentications🔗

Update SDK🔗

Now the SDK can be downloaded via Maven repository, to do this, update your build.gradle file

dependencies {
    def mrgsVersion = "5.0.0"

-   implementation(name:'MRGSAuthentication', ext:'aar')
+   implementation "games.my.mrgs:authentication:$mrgsVersion"
}

Update code🔗

Main changes:

  • Class MRGSAmazon moved from ru.mail.mrgservice.amazon to ru.mail.mrgservice.authentication.amazon.
  • Class MRGSFacebook moved from ru.mail.mrgservice.facebook to ru.mail.mrgservice.authentication.facebook..
  • Class MRGSGoogleGames moved from ru.mail.mrgservice.googlegames to ru.mail.mrgservice.authentication.googlegames.
  • Class MRGSMyGames moved from ru.mail.mrgservice.mygames to ru.mail.mrgservice.authentication.mygames.
  • Class MRGSVK moved from ru.mail.mrgservice.vk to ru.mail.mrgservice.authentication.
  • Class MRGSUser is interface now, and also moved from from ru.mail.mrgservice to ru.mail.mrgservice.authentication.amazon.
  • Class FacebookUser removed.
  • Class MRGSCredentials is interface now.
  • Class MRGSAuthInfo marked ad @Deprecated. Use MRGSAccessToken instead.

  • Interface MRGSAuthentication.ExternalLogoutCallback marked as @Deprecated. Use MRGSAuthentication.OnExternalLogoutListener instead.

  • Interface MRGSSocial moved from ru.mail.mrgservice.social to ru.mail.mrgservice.authentication.
  • Interface MRGSScore moved from ru.mail.mrgservice.games to ru.mail.mrgservice.authentication.
  • Interface MRGSLeaderBoards moved from ru.mail.mrgservice.games to ru.mail.mrgservice.authentication.
  • Interface MRGSAchievements moved from ru.mail.mrgservice.games to ru.mail.mrgservice.authentication.
  • Interface MRGSAuthInfoCallback.java removed.

  • Enum MRGSAuthenticationNetwork.MRGSAuthenticationNetworkAmazon renamed to MRGSAuthenticationNetwork.AMAZON.

  • Enum MRGSAuthenticationNetwork.MRGSAuthenticationNetworkFacebook renamed to MRGSAuthenticationNetwork.FACEBOOK.
  • Enum MRGSAuthenticationNetwork.MRGSAuthenticationNetworkGoogleGames renamed to MRGSAuthenticationNetwork.GOOGLE_GAMES.
  • Enum MRGSAuthenticationNetwork.MRGSAuthenticationNetworkMyGames renamed to MRGSAuthenticationNetwork.MY_GAMES.
  • Enum MRGSAuthenticationNetwork.MRGSAuthenticationNetworkVKontakte renamed to MRGSAuthenticationNetwork.VKONTAKTE.
  • Enum MRGSAuthenticationNetwork.Unknown renamed to MRGSAuthenticationNetwork.UNKNOWN.

  • Method MRGSAuthentication#loginWithScopes(List<String>, MRGSLoginCallback) marked as @Deprecated. Use MRGSAuthentication#login(List<String>, MRGSLoginCallback) instead.

  • Method MRGSAuthentication#getAuthInfo(BiConsumer<MRGSAuthInfo, MRGSError>) marked as @Deprecated. Use MRGSAuthentication#getAccessToken(BiConsumer<MRGSAuthInfo, MRGSError>) instead.
  • Method MRGSAuthentication#getUserAvatar(MRGSUser, MRGSAvatarCallback, int, int) marked as @Deprecated. Use MRGSAuthentication#getUserAvatar(MRGSUser, int, int, MRGSAvatarCallback) instead.
  • Method MRGSAuthentication#setOnExternalLogoutCallback(ExternalLogoutCallback) marked as @Deprecated. Use MRGSAuthentication#setOnExternalLogoutListener(OnExternalLogoutListener) instead.

  • Method MRGSAmazon#tryUpdateToken() removed. Use MRGSAmazon#getAccessToken(BiConsumer<MRGSAccessToken, MRGSError>) instead.

  • Method MRGSAchievement#achievementId() marked as @Deprecated. Use MRGSAchievement#getAchievementId() instead.

  • Method MRGSAchievement#name() marked as @Deprecated. Use MRGSAchievement#getName() instead.
  • Method MRGSAchievement#description() marked as @Deprecated. Use MRGSAchievement#getDescription() instead.
  • Method MRGSAchievement#state() marked as @Deprecated. Use MRGSAchievement#getState() instead.
  • Method MRGSAchievement#currentSteps() marked as @Deprecated. Use MRGSAchievement#getCurrentSteps() instead.
  • Method MRGSAchievement#totalSteps() marked as @Deprecated. Use MRGSAchievement#getTotalSteps() instead.
  • Method MRGSAchievement#completionPercent() marked as @Deprecated. Use MRGSAchievement#getCompletionPercent() instead.

  • Method MRGSCredentials#setUserId(String) removed.

  • Method MRGSCredentials#setUser(MRGSUser) removed.
  • Method MRGSCredentials#setAuthInfo(MRGSAuthInfo) removed.
  • Method MRGSCredentials#getAuthInfo() marked as @Deprecated. Use MRGSCredentials#getAccessToken() instead.

  • Method MRGSLeaderboard#leaderboardId() marked as @Deprecated. Use MRGSLeaderboard#getLeaderboardId() instead.

  • Method MRGSLeaderboard#name() marked as @Deprecated. Use MRGSLeaderboard#getName() instead.

  • Method MRGSScore#leaderboardId() marked as @Deprecated. Use MRGSScore#getLeaderboardId() instead.

  • Method MRGSScore#rank() marked as @Deprecated. Use MRGSScore#getRank() instead.
  • Method MRGSScore#displayRank() marked as @Deprecated. Use MRGSScore#getDisplayRank() instead.
  • Method MRGSScore#rawScore() marked as @Deprecated. Use MRGSScore#getRawScore() instead.
  • Method MRGSScore#displayScore() marked as @Deprecated. Use MRGSScore#getDisplayScore() instead.
  • Method MRGSScore#player() marked as @Deprecated. Use MRGSScore#getPlayer() instead.

  • Method MRGSUser#userId() marked as @Deprecated. Use MRGSUser#getUserId() instead.

  • Method MRGSUser#nick() marked as @Deprecated. Use MRGSUser#getNickName() instead.
  • Method MRGSUser#firstName() marked as @Deprecated. Use MRGSUser#getFirstName() instead.
  • Method MRGSUser#lastName() marked as @Deprecated. Use MRGSUser#getLastName() instead.
  • Method MRGSUser#middleName() marked as @Deprecated. Use MRGSUser#getMiddleName() instead.
  • Method MRGSUser#fullName() marked as @Deprecated. Use MRGSUser#getFullName() instead.
  • Method MRGSUser#displayName() marked as @Deprecated. Use MRGSUser#getDisplayName() instead.
  • Method MRGSUser#gender() marked as @Deprecated. Use MRGSUser#getGender() instead.
  • Method MRGSUser#birthDate() marked as @Deprecated. Use MRGSUser#getBirthDate() instead.
  • Method MRGSUser#location() marked as @Deprecated. Use MRGSUser#getLocation() instead.
  • Method MRGSUser#socialId() marked as @Deprecated. Use MRGSUser#getSocialId() instead.

The following example shows how your app might look before and after making these changes:

Before

import androidx.annotation.Nullable;

import java.util.Arrays;

import ru.mail.mrgservice.MRGSError;
import ru.mail.mrgservice.MRGSUser;
import ru.mail.mrgservice.authentication.MRGSAuthInfo;
import ru.mail.mrgservice.authentication.MRGSAuthentication;
import ru.mail.mrgservice.authentication.MRGSAuthenticationNetwork;
import ru.mail.mrgservice.authentication.MRGSCredentials;
import ru.mail.mrgservice.authentication.MRGSLoginCallback;
import ru.mail.mrgservice.utils.optional.BiConsumer;

final MRGSAuthentication authentication = AuthenticationImpl.getInstance();

// Set logout listener
authentication.setOnExternalLogoutCallback(new MRGSAuthentication.ExternalLogoutCallback() {
    @Override
    public void onUserLogout(MRGSAuthenticationNetwork network) {
        // Handle result
    }
});

// Common login
authentication.login(new MRGSLoginCallback() {
    @Override
    public void onSuccess(MRGSCredentials credentials) {
        // Handle result
    }

    @Override
    public void onError(MRGSError error) {
        // Handle error
    }
});

// Login with scopes
authentication.loginWithScopes(Arrays.asList("scope_1", "scope_2"), new MRGSLoginCallback() {
    @Override
    public void onSuccess(MRGSCredentials credentials) {
        // Handle result
    }

    @Override
    public void onError(MRGSError error) {
        // Handle error
    }
});

// Get current user's information
authentication.getCurrentUser(new MRGSAuthentication.UserCallback() {
    @Override
    public void onSuccess(final MRGSUser user) {
        // Handle result
    }

    @Override
    public void onError(MRGSError error) {
    }
});

// Get current user's authentication information
authentication.getAuthInfo(new BiConsumer<MRGSAuthInfo, MRGSError>() {
    @Override
    public void accept(@Nullable MRGSAuthInfo authInfo, @Nullable MRGSError error) {
        if (error != null) {
            // Handle error
        } else {
            // Handle result
        }
    }
});

// Call logout
authentication.logout();

After

import java.util.Arrays;

import ru.mail.mrgservice.MRGSError;
import ru.mail.mrgservice.authentication.MRGSAccessToken;
import ru.mail.mrgservice.authentication.MRGSAuthentication;
import ru.mail.mrgservice.authentication.MRGSAuthentication.OnExternalLogoutListener;
import ru.mail.mrgservice.authentication.MRGSAuthenticationNetwork;
import ru.mail.mrgservice.authentication.MRGSCredentials;
import ru.mail.mrgservice.authentication.MRGSLoginCallback;
import ru.mail.mrgservice.authentication.MRGSUser;
import ru.mail.mrgservice.utils.optional.BiConsumer;

final MRGSAuthentication authentication = AuthenticationImpl.getInstance();

// Set logout listener
authentication.setOnExternalLogoutListener(new OnExternalLogoutListener() {
    @Override
    public void onUserLogout(@NonNull MRGSAuthenticationNetwork network) {
        // Handle result
    }
});

// Common login
authentication.login(new MRGSLoginCallback() {
    @Override
    public void onSuccess(@NonNull MRGSCredentials credentials) {
        // Handle result
    }

    @Override
    public void onError(@NonNull MRGSError error) {
        // Handle error
    }
});

// Login with scopes
authentication.login(Arrays.asList("scope_1", "scope_2"), new MRGSLoginCallback() {
    @Override
    public void onSuccess(@NonNull MRGSCredentials credentials) {
        // Handle result
    }

    @Override
    public void onError(@NonNull MRGSError error) {
        // Handle error
    }
});

// Get current user's information
authentication.getCurrentUser(new MRGSAuthentication.UserCallback() {
    @Override
    public void onSuccess(@NonNull final MRGSUser user) {
        // Handle result
    }

    @Override
    public void onError(@NonNull MRGSError error) {
    }
});

// Get current user's authentication information
authentication.getAccessToken(new BiConsumer<MRGSAccessToken, MRGSError>() {
    @Override
    public void accept(@Nullable MRGSAccessToken accessToken, @Nullable MRGSError error) {
        if (error != null) {
            // Handle error
        } else {
            // Handle result
        }
    }
});

// Call logout
authentication.logout();

MRGSBilling🔗

Update SDK🔗

Now the SDK can be downloaded via Maven repository, to do this, update your build.gradle file

dependencies {
    def mrgsVersion = "5.0.0"

-   implementation(name:'MRGSBilling', ext:'aar')
+   implementation "games.my.mrgs:billing:$mrgsVersion"
}

Update code🔗

Main changes:

  • Class MRGSBilling moved from ru.mail.mrgservice to ru.mail.mrgservice.billing.
  • Class MRGSPurchaseItem renamed to MRGSBillingProduct and moved from ru.mail.mrgservice to ru.mail.mrgservice.billing.
  • Class MRGSBillingEntities moved from ru.mail.mrgservice to ru.mail.mrgservice.billing.
  • Class MRGSMyGamesBilling moved from ru.mail.mrgservice to ru.mail.mrgservice.billing.
  • Interface MRGSBillingDelegate removed.
  • Interface MRGSBillingDelegateEx renamed to MRGSBillingDelegate and moved from ru.mail.mrgservice to ru.mail.mrgservice.billing.

  • Method MRGSBilling#instance() renamed to MRGSBilling#getInstance().

  • Method MRGSBilling#requestProductsInfoWithRequest(MRGSBankProductsRequest) renamed to MRGSBilling#requestProductsInfo(MRGSBankProductsRequest).
  • Method MRGSBilling#buyItem(String sku, final String type) removed. Use MRGSBilling#buyItem(String sku) instead.
  • Method MRGSBilling#buyItem(String sku, String type, String developerPayload) removed. Use MRGSBilling#buyItem(String sku, String developerPayload) instead.
  • Method MRGSBilling#buyItem(final MRGSPurchaseItem purchase) removed. Use MRGSBilling#buyItem(MRGSBankPurchaseRequest) instead.
  • Method MRGSBilling#setDelegate(MRGSBillingDelegateEx) removed.
  • Method MRGSBilling#changeItem(String, String, String) removed. Use MRGSBilling#buyItem(MRGSBankPurchaseRequest) instead.
  • Method MRGSBilling#changeItem(String, String, String, String) removed. Use MRGSBilling#buyItem(MRGSBankPurchaseRequest) instead.
  • Method MRGSBilling#changeItem(MRGSPurchaseItem, MRGSPurchaseItem) removed. Use MRGSBilling#buyItem(MRGSBankPurchaseRequest) instead.
  • Method MRGSBilling#getProductsInfo(ArrayList<String>) removed. Use MRGSBilling#requestProductsInfo(MRGSBankProductsRequest) instead.
  • Method MRGSBilling#getProductsInfoWithTypes(ArrayList<Pair<String, String>>) removed. Use MRGSBilling#requestProductsInfo(MRGSBankProductsRequest) instead.
  • Method MRGSBilling#getProductsInfoFromPurchaseInfo(ArrayList<MRGSBillingProduct>) removed. Use MRGSBilling#requestProductsInfo(MRGSBankProductsRequest) instead.
  • Method MRGSBilling#notifyMRGSAboutConsume(MRGSPurchaseItem) changed on MRGSBilling#notifyMRGSAboutConsume(String sku, String transactionId)
  • Method MRGSBilling#closePayment(MRGSPurchaseItem) removed. Use MRGSBilling#notifyMRGSAboutConsume(String sku, String transactionId) instead.

  • Method MRGSBillingProduct#createWithPurchaseInfo(String) removed.

  • Method MRGSBillingProduct#createWithPurchaseInfoWithType(String, String) removed.
  • Method MRGSBillingProduct#fromJSON(String) removed.
  • Method MRGSBillingProduct#setSku(String) removed.
  • Method MRGSBillingProduct#setIntroductoryPeriod(String) removed.
  • Method MRGSBillingProduct#setType(String) removed.
  • Method MRGSBillingProduct#getDictionary() removed.
  • Method MRGSBillingProduct#getPurchaseToken() removed.
  • Method MRGSBillingProduct#setPurchaseToken(String token) removed.
  • Method MRGSBillingProduct#getTransactionId() removed. Use MRGSBankTransaction#getTransactionIdentifier() instead.
  • Method MRGSBillingProduct#getTransactionReceipt() removed.
  • Method MRGSBillingProduct#getResultCode() removed.
  • Method MRGSBillingProduct#getRawPurchaseInfo() removed. Use MRGSBankTransaction#getRawPurchaseResult() instead.
  • Method MRGSBillingProduct#getDeveloperPayload() removed. Use MRGSBankPurchaseResult#getDeveloperPayload() instead.
  • Method MRGSBillingProduct#setDeveloperPayload(String) removed.
  • Method MRGSBillingProduct#getUserId() removed.

  • Method MRGSBillingDelegate#onReceiveProductsResponce renamed to MRGSBillingDelegate#onReceiveProductsResponse.

  • Method MRGSBillingDelegate#onReceiveSuccessfullPurchase renamed to MRGSBillingDelegate#onReceiveSuccessfulPurchase.

The following example shows how your app might look before and after making these changes:

Before

import java.util.Arrays;
import java.util.List;

import ru.mail.mrgservice.MRGSBilling;
import ru.mail.mrgservice.MRGSBillingDelegateEx;
import ru.mail.mrgservice.MRGSBillingEntities.MRGSBankProductsRequest;
import ru.mail.mrgservice.MRGSBillingEntities.MRGSBankPurchaseRequest;
import ru.mail.mrgservice.MRGSPurchaseItem;

final MRGSBilling billing = MRGSBilling.instance();

final MRGSBillingDelegateEx listener = new MRGSBillingDelegateEx() {
    ...
};
billing.setDelegateEx(listener);

// Request Products
final List<String> consumable = Arrays.asList(
        "ru.mail.games.mrgservisetest.purchase1",
        "ru.mail.games.mrgservisetest.purchase2",
        "android.test.purchased");
final List<String> nonConsumable = Arrays.asList("ru.mail.games.mrgservisetest.noncons");
final List<String> subscriptions = Arrays.asList(
        "ru.mail.mrgs.subs1",
        "ru.mail.mrgs.subs2",
        "ru.mail.mrgs.subs3");

final MRGSBankProductsRequest productRequest = new MRGSBankProductsRequest();
productRequest.add(consumable, MRGSPurchaseItem.CONS);
productRequest.add(nonConsumable, MRGSPurchaseItem.NONCONS);
productRequest.add(subscriptions, MRGSPurchaseItem.SUBS);

// The result of request will be sent to one of
// MRGSBillingDelegateEx#onReceiveProductsResponce(MRGSBankProductsResponse)
// or to MRGSBillingDelegateEx#onReceiveProductsError(MRGSBankProductsResponse)
billing.requestProductsInfoWithRequest(productRequest);


// Buy product
final String sku = "ru.mail.games.mrgservisetest.purchase1";
final String devPayload = "{\"item\": 123,\"store\": 456}";
final MRGSBankPurchaseRequest purchaseRequest = new MRGSBankPurchaseRequest(sku, devPayload);

// The result of request will be sent to one of
// MRGSBillingDelegateEx#onReceiveSuccessfullPurchase(MRGSBankPurchaseResult),
// MRGSBillingDelegateEx#onReceiveFailedPurchase(MRGSBankPurchaseResult),
// MRGSBillingDelegateEx#onReceivePendingPurchase(MRGSBankPurchaseResult),
// or MRGSBillingDelegateEx#onReceiveCancelledPurchase(MRGSBankPurchaseResult).
billing.buyItem(purchaseRequest);

After

import java.util.Arrays;
import java.util.List;

import ru.mail.mrgservice.billing.MRGSBilling;
import ru.mail.mrgservice.billing.MRGSBillingDelegate;
import ru.mail.mrgservice.billing.MRGSBillingEntities.MRGSBankProductsRequest;
import ru.mail.mrgservice.billing.MRGSBillingEntities.MRGSBankPurchaseRequest;
import ru.mail.mrgservice.billing.MRGSBillingProduct;

final MRGSBilling billing = MRGSBilling.getInstance();

final MRGSBillingDelegate listener = new MRGSBillingDelegate() {
    ...
};
billing.setDelegate(listener);

// Request Products
final List<String> consumable = Arrays.asList(
        "ru.mail.games.mrgservisetest.purchase1",
        "ru.mail.games.mrgservisetest.purchase2",
        "android.test.purchased");
final List<String> nonConsumable = Arrays.asList("ru.mail.games.mrgservisetest.noncons");
final List<String> subscriptions = Arrays.asList(
        "ru.mail.mrgs.subs1",
        "ru.mail.mrgs.subs2",
        "ru.mail.mrgs.subs3");

final MRGSBankProductsRequest productRequest = new MRGSBankProductsRequest();
productRequest.add(consumable, MRGSBillingProduct.CONS);
productRequest.add(nonConsumable, MRGSBillingProduct.NONCONS);
productRequest.add(subscriptions, MRGSBillingProduct.SUBS);

// The result of request will be sent to one of
// MRGSBillingDelegate#onReceiveProductsResponse(MRGSBankProductsResponse)
// or to MRGSBillingDelegate#onReceiveProductsError(MRGSBankProductsResponse)
billing.requestProductsInfo(productRequest);


// Buy product
final String sku = "ru.mail.games.mrgservisetest.purchase1";
final String devPayload = "{\"item\": 123,\"store\": 456}";
final MRGSBankPurchaseRequest purchaseRequest = new MRGSBankPurchaseRequest(sku, devPayload);

// The result of request will be sent to one of
// MRGSBillingDelegate#onReceiveSuccessfulPurchase(MRGSBankPurchaseResult),
// MRGSBillingDelegate#onReceiveFailedPurchase(MRGSBankPurchaseResult),
// MRGSBillingDelegate#onReceivePendingPurchase(MRGSBankPurchaseResult),
// or MRGSBillingDelegate#onReceiveCancelledPurchase(MRGSBankPurchaseResult).
billing.buyItem(purchaseRequest);

MRGSFirebase🔗

Update SDK🔗

Now the SDK can be downloaded via Maven repository, to do this, update your build.gradle file

dependencies {
    def mrgsVersion = "5.0.0"

-   implementation(name:'MRGSFirebase', ext:'aar')
+   implementation "games.my.mrgs:firebase:$mrgsVersion"
}

Update code🔗

Main changes:

  • Class MRGSFirebaseAnalytics moved from ru.mail.mrgservice to ru.mail.mrgservice.firebase.

The following example shows how your app might look before and after making these changes:

Before

import java.util.Map;
import java.util.TreeMap;

import ru.mail.mrgservice.MRGSFirebaseAnalytics;

final Map<String, Object> params = new TreeMap<>();
params.put("someInfoKey", "someImportantInfo");
MRGSFirebaseAnalytics.getInstance().sendEvent("event_name", params);

After

import java.util.Map;
import java.util.TreeMap;

import ru.mail.mrgservice.firebase.MRGSFirebaseAnalytics;

final Map<String, Object> params = new TreeMap<>();
params.put("someInfoKey", "someImportantInfo");
MRGSFirebaseAnalytics.getInstance().sendEvent("event_name", params);

MRGSGameCenter🔗

Update SDK🔗

Now the SDK can be downloaded via Maven repository, to do this, update your build.gradle file

dependencies {
    def mrgsVersion = "5.0.0"

-   implementation(name:'MRGSGameCenter', ext:'aar')
+   implementation "games.my.mrgs:gamecenter:$mrgsVersion"
}

Update code🔗

No changes.

MRGSGDPR🔗

Update SDK🔗

Now the SDK can be downloaded via Maven repository, to do this, update your build.gradle file

dependencies {
    def mrgsVersion = "5.0.0"

-   implementation(name:'MRGSGDPR', ext:'aar')
+   implementation "games.my.mrgs:gdpr:$mrgsVersion"
}

Update code🔗

Main changes:

  • Class MRGSGDPR moved from ru.mail.mrgservice to ru.mail.mrgservice.gdpr.
  • Class MRGSGDPR.MRGSGDPRFactory removed. Use MRGSGDPR#getInstance() instead.
  • Interface MRGSCOPPA.OnResponseCallback removed from the public API, as it's intended for internal work.

  • Method MRGSGDPR#showAgreementAtActivity(Activity, String, String, int) removed. Use MRGSGDPR#showAgreementAtActivity(Activity, String, String) instead.

  • Method MRGSGDPR#shouldShowGDPRForVersion(Activity, String, int, boolean, MRGSGDPRAsyncStatus) removed. Use MRGSGDPR#shouldShowGDPRForVersion(Activity, String, boolean, MRGSGDPRAsyncStatus) instead.
  • Method MRGSGDPR#setUserHasAcceptedAgreementWithVersion(Context, int, boolean, boolean, String) removed. Use MRGSGDPR#setUserHasAcceptedAgreementWithVersion(Context, boolean, boolean, String) instead.
  • Method MRGSCCPA#fetchCountyIfNeeded() removed from the public API, as it's intended for internal work.
  • Method MRGSCOPPA#isUnderUk(Consumer<Boolean>) removed from the public API, as it's intended for internal work.
  • Method MRGSCOPPA#shouldShowCoppa(Consumer<Boolean>) removed from the public API, as it's intended for internal work.
  • Method MRGSCOPPA#shouldShowCoppa(Context, Consumer<Boolean>) removed from the public API, as it's intended for internal work.
  • Method MRGSCOPPA#sendEmail(String, OnResponseCallback<MRGSSendEmailResult>) removed from the public API, as it's intended for internal work.
  • Method MRGSCOPPA#checkEmails(List<String>, OnResponseCallback<MRGSCheckEmailResult>) removed from the public API, as it's intended for internal work.

The following example shows how your app might look before and after making these changes:

Before

import ru.mail.mrgservice.MRGSGDPR;

final MRGSGDPR gdpr = MRGSGDPR.getInstance();
gdpr.setDelegate(this);
gdpr.onlyEU(true);
gdpr.setBackgroundColor(255, 0, 0);
gdpr.withAdvertising(true);
gdpr.setLocalizationLanguage("en");

After

import ru.mail.mrgservice.gdpr.MRGSGDPR;

final MRGSGDPR gdpr = MRGSGDPR.getInstance();
gdpr.setDelegate(this);
gdpr.onlyEU(true);
gdpr.setBackgroundColor(255, 0, 0);
gdpr.withAdvertising(true);
gdpr.setLocalizationLanguage("en");

MRGSMyTarget🔗

  • Was removed.

MRGSNotifications🔗

Update SDK🔗

Now the SDK can be downloaded via Maven repository, to do this, update your build.gradle file

dependencies {
    def mrgsVersion = "5.0.0"

-   implementation(name:'MRGSNotifications', ext:'aar')
+   implementation "games.my.mrgs:notifications:$mrgsVersion"
}

Update code🔗

Main changes:

  • Class MRGSGDPR moved from ru.mail.mrgservice to ru.mail.mrgservice.gdpr.
  • Class MRGSPushNotifications removed. Use MRGSNotificationCenter instead.
  • Class MRGSLocalPushService removed. Use MRGSNotificationCenter instead.
  • Class MRGSLocalPushAutoStartReceiver removed.
  • Class MRGSPushNotification.MRGSPushNotificationChannel removed. Use ru.mail.mrgservice.MRGSNotificationChannel instead.
  • Class MRGSPushNotification.MRGSPushNotificationChannelsGroup removed. Use ru.mail.mrgservice.MRGSNotificationChannelGroup instead.

  • Interface MRGSPushNotificationHandler.MRGSPushNotificationDelegate removed.

  • Interface MRGSPushNotificationHandler.MRGSPushNotificationDelegateEx renamed to MRGSPushNotificationHandler.MRGSPushNotificationDelegate.

  • Interface MRGSPushNotificationHandler.MRGSPushNotificationGroupDelegate removed.

  • Interface MRGSPushNotificationHandler.MRGSPushNotificationExGroupDelegate renamed to MRGSPushNotificationHandler.MRGSPushNotificationGroupDelegate.

  • Method MRGSNotificationCenterImpl.getInstance() removed. Use MRGSNotificationCenter.getInstance() instead.

  • Method MRGSPushNotification.getCutomTextStrings() renamed to MRGSPushNotification.getCustomTextStrings().
  • Method MRGSPushNotificationHandler#setDelegate(MRGSPushNotificationDelegateEx) removed.

The following example shows how your app might look before and after making these changes:

Before

import ru.mail.mrgservice.MRGS;
import ru.mail.mrgservice.MRGSMap;
import ru.mail.mrgservice.MRGSNotificationCenter;
import ru.mail.mrgservice.MRGSNotificationCenterImpl;
import ru.mail.mrgservice.MRGSPushNotification;
import ru.mail.mrgservice.MRGSPushNotification.MRGSPushNotificationChannel;
import ru.mail.mrgservice.MRGSPushNotification.MRGSPushNotificationChannelsGroup;
import ru.mail.mrgservice.MRGSPushNotificationHandler.MRGSPushNotificationExDelegate;

final MRGSNotificationCenter notificationCenter = MRGSNotificationCenterImpl.getInstance();

// Create a listener for local and remote notification.
// You can create another listener to separate notifications or uses one and separate them
// with boolean isLocal
MRGSPushNotificationExDelegate notifyDelegate = new MRGSPushNotificationExDelegate() {
    @Override
    public void clickOnNotification(int idNotify, String title, String msg, MRGSMap developerPayload, boolean isLocal) {
        //Handle result.
    }

    @Override
    public void receivedNotification(int idNotify, String title, String msg, MRGSMap developerPayload, boolean isLocal) {
        //Handle result.
    }
};

notificationCenter.setLocalDelegate(notifyDelegate);
notificationCenter.setRemoteDelegate(notifyDelegate);

// Create notification channel group
final MRGSPushNotificationChannelsGroup group = new MRGSPushNotificationChannelsGroup();
group.Id = "my_group_id";
group.Name = "My Group";

notificationCenter.createNotificationChannelGroup(context, group);

// Create notification channel
final MRGSPushNotificationChannel channel = new MRGSPushNotificationChannel();
channel.Id = "my_channel_id";
channel.Name= "My Channel";
channel.Description = "Description";
channel.Group = "my_group_id";
channel.Sound = "push_sound";
channel.ShowLights = true;

notificationCenter.createNotificationChannel(context, channel);

// Create local push notification
final int time = MRGS.timeUnix() + 10;
MRGSPushNotification notification = MRGSPushNotification.create("Message number 1", 1, time);
notification.setGroupId(222);
notification.setGroupMessage("New resources arrived");
notification.setGroupTitle("Receive your resources");
notificationCenter.addLocalPush(notification);`

After

import ru.mail.mrgservice.MRGS;
import ru.mail.mrgservice.MRGSMap;
import ru.mail.mrgservice.MRGSNotificationCenter;
import ru.mail.mrgservice.MRGSNotificationChannel;
import ru.mail.mrgservice.MRGSNotificationChannelGroup;
import ru.mail.mrgservice.MRGSPushNotification;
import ru.mail.mrgservice.MRGSPushNotificationHandler.MRGSPushNotificationDelegate;

final MRGSNotificationCenter notificationCenter = MRGSNotificationCenter.getInstance();

// Create a listener for local and remote notification.
// You can create another listener to separate notifications or uses one and separate them
// with boolean isLocal
MRGSPushNotificationDelegate notifyDelegate = new MRGSPushNotificationDelegate() {
    @Override
    public void clickOnNotification(int idNotify, String title, String msg, MRGSMap developerPayload, boolean isLocal) {
        //Handle result.
    }

    @Override
    public void receivedNotification(int idNotify, String title, String msg, MRGSMap developerPayload, boolean isLocal) {
        //Handle result.
    }
};

notificationCenter.setLocalDelegate(notifyDelegate);
notificationCenter.setRemoteDelegate(notifyDelegate);

// Create notification channel group
final MRGSNotificationChannelGroup group = new MRGSNotificationChannelGroup("my_group_id", "My Group");
notificationCenter.createNotificationChannelGroup(context, group);

// Create notification channel
final MRGSNotificationChannel channel = new MRGSNotificationChannel("my_channel_id", "My Channel");
channel.setDescription("Description");
channel.setGroup("my_group_id");
channel.setSound("push_sound");
channel.enableLights(true);

notificationCenter.createNotificationChannel(context, channel);

// Create local push notification
final int time = MRGS.timeUnix() + 10;
MRGSPushNotification notification = MRGSPushNotification.create("Message number 1", 1, time);
notification.setGroupId(222);
notification.setGroupMessage("New resources arrived");
notification.setGroupTitle("Receive your resources");
notificationCenter.addLocalPush(notification);

MRGSRecommendations🔗

Update SDK🔗

Now the SDK can be downloaded via Maven repository, to do this, update your build.gradle file

dependencies {
    def mrgsVersion = "5.0.0"

-   implementation(name:'MRGSRecommendations', ext:'aar')
+   implementation "games.my.mrgs:recsys:$mrgsVersion"
}

Update code🔗

Main changes:

  • Class MRGSRecommendations moved from ru.mail.mrgservice to ru.mail.mrgservice.recsys.

  • Method MRGSRecommendations#offerView(String, MRGSMap) removed. Use MRGSRecommendations#trackEvent(MRGSRecSysEvent) instead.

  • Method MRGSRecommendations#offerClick(String, MRGSMap) removed. Use MRGSRecommendations#trackEvent(MRGSRecSysEvent) instead.
  • Method MRGSRecommendations#offerBuy(String, MRGSMap) removed. Use MRGSRecommendations#trackEvent(MRGSRecSysEvent) instead.

The following example shows how your app might look before and after making these changes:

Before

import ru.mail.mrgservice.MRGSMap;
import ru.mail.mrgservice.MRGSRecommendations;

final MRGSRecommendations recSys = MRGSRecommendations.getInstance();
recSys.offerView("testOffer1", null);
recSys.offerClick("testOffer1", null);

final MRGSMap buyParams = new MRGSMap();
buyParams.put("sku", "ru.mail.mrgstestpurchase");
buyParams.put("gameOfferId", "offer123");
recSys.offerBuy("testOffer1", buyParams);

After

import ru.mail.mrgservice.recsys.MRGSRecSysEvent;
import ru.mail.mrgservice.recsys.MRGSRecSysEvents;
import ru.mail.mrgservice.recsys.MRGSRecommendations;

final MRGSRecommendations recSys = MRGSRecommendations.getInstance();
final MRGSRecSysEvent offerEvent = new MRGSRecSysEvents.OfferActionEvent("testOffer1", MRGSRecSysEvent.ACTION_TYPE_VIEW);
recSys.trackEvent(offerEvent);

final MRGSRecSysEvent offerClick = new MRGSRecSysEvents.OfferActionEvent("testOffer1", MRGSRecSysEvent.ACTION_TYPE_CLICK);
recSys.trackEvent(offerClick);

final MRGSRecSysEvent offerBuy = new MRGSRecSysEvents.OfferActionEvent("testOffer1", MRGSRecSysEvent.ACTION_TYPE_CLICK);
offerBuy.putParam("sku", "ru.mail.mrgstestpurchase");
offerBuy.putParam("gameOfferId", "offer123");
recSys.trackEvent(offerBuy);

MRGSShowcase🔗

Update SDK🔗

Now the SDK can be downloaded via Maven repository, to do this, update your build.gradle file

dependencies {
    def mrgsVersion = "5.0.0"

-   implementation(name:'MRGSShowcase', ext:'aar')
+   implementation "games.my.mrgs:showcase:$mrgsVersion"
}

Update code🔗

No changes.

MRGSSupport🔗

Update SDK🔗

Now the SDK can be downloaded via Maven repository, to do this, update your build.gradle file

dependencies {
    def mrgsVersion = "5.0.0"

-   implementation(name:'MRGSSupport', ext:'aar')
+   implementation "games.my.mrgs:support:$mrgsVersion"
}

Update code🔗

Main changes:

  • Constructor MRGSMyComSupportDialog(Activity, String) removed. Use MRGSMyComSupportDialog(Activity) instead.
  • Constructor MRGSMyComSupportDialog(Activity, String, boolean) removed. Use MRGSMyComSupportDialog(Activity) instead.

The following example shows how your app might look before and after making these changes:

Before

import ru.mail.mrgservice.MRGSMyComSupportDialog;

final MRGSMyComSupportDialog dialog = new MRGSMyComSupportDialog(activity,  "<SECRET>", true);
dialog.setCategory(<CATEGORY>);
dialog.setText(<TEXT>);
dialog.setListener(this);
dialog.show();

After

import ru.mail.mrgservice.MRGSMyComSupportDialog;

final MRGSMyComSupportDialog dialog = new MRGSMyComSupportDialog(activity);
dialog.setCategory(<CATEGORY>);
dialog.setText(<TEXT>);
dialog.setListener(this);
dialog.show();

4.1.x → 4.1.3🔗

In version 4.1.3, the user interface API was completely reworked. Now there is no need to register and then authorize the user. It is enough to call the setUserId method. However, to correctly calculate statistics on the MyTracker side, you must call trackRegistrationEvent and trackLoginEvent methods of the MRGSMyTracker class. Read the details in the documentation in the User Authorization section.

4.0.x → 4.1🔗

The main change - MRGService now depends on the androidx series libraries, instead of support-library.

Edit your build.gradle file to remove old dependencies, such as:

'com.google.android.gms:play-services-ads-identifier:16.0.0'
'com.android.support:support-v4:28.0.0'
'com.android.support:recyclerview-v7:28.0.0'
'com.android.support:appcompat-v7:28.0.0'
'com.android.support:support-vector-drawable:28.0.0'
'com.android.support:multidex:1.0.3'

and add new ones:

'androidx.appcompat:appcompat:1.1.0'
'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
'androidx.recyclerview:recyclerview:1.0.0'
'androidx.vectordrawable:vectordrawable:1.1.0'
'androidx.multidex:multidex:2.0.0'

Firebase (which also now depends on androidx) was updated in this version. Remove old dependencies:

'com.google.firebase:firebase-core:16.0.9'
'com.google.firebase:firebase-messaging:18.0.0'

Add new ones:

'com.google.firebase:firebase-analytics:17.2.1'
'com.google.firebase:firebase-messaging:20.0.0'

MyTracker was updated to version 1.5.12. Replace

'com.my.tracker:mytracker-sdk:1.5.8'

with

'com.my.tracker:mytracker-sdk:1.5.12'

3.8.x → 4.0🔗

The main change - now MRGService consists of a set of modules (aar library). The main module is MRGService.aar. The remaining modules can be added only if necessary.

If you already use all the functions of MRGS, the easiest way is to add all the aar files from the archive to your project.

Delete the MRGServiceDependencies.aar library if you have one.

Since MRGS is now distributed only as aar files, the first thing to do is to remove everything related to MRGS from your AndroidManifest.xml file:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>

<uses-permission android:name="com.android.vending.BILLING"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<activity
    android:name="ru.mail.mrgservice.MRGSGoogleBillingActivity"
    android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
    android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
<activity
    android:name="ru.mail.mrgservice.MRGSCafebazaarBillingActivity"
    android:configChanges="keyboardHidden|orientation"
    android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
<activity
    android:name="ru.mail.mrgservice.MRGSSendFeedbackActivity"
    android:configChanges="keyboardHidden|orientation"
    android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"/>
<activity
    android:name="ru.mail.mrgservice.MRGSGCMActivity"
    android:configChanges="keyboardHidden|orientation"
    android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"/>
<activity
    android:name="ru.mail.mrgservice.MRGSMyComSupportUtilActivity"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>

<activity android:name="ru.mail.mrgservice.gc.GCActivity"
          android:configChanges="keyboardHidden|orientation|screenSize"
          android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"/>

<activity android:name="ru.mail.mrgservicetest.PermissionRationaleActivity"/>
<activity android:name="ru.mail.mrgservicetest.ShowSettingActivity"/>

<activity android:name="ru.mail.mrgservice.advertising.MRGSAdvertisingActivity"
          android:configChanges="keyboardHidden|orientation|screenSize"
          android:theme="@style/TranslucentTheme"
          />
<!--android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"-->
<activity android:name="ru.mail.mrgservice.advertising.MRGSAdvertisingSliderActivity"
          android:configChanges="keyboardHidden|orientation|screenSize"
          android:theme="@style/NotTranslucentTheme"
          />

<!-- MyTarget activity -->
<activity android:name="com.my.target.common.MyTargetActivity" />

<!-- Firebase push notification -->
<service
    android:name="ru.mail.mrgservice.MRGSFirebaseInstanceIdService">
    <intent-filter>
        <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
    </intent-filter>
</service>

<service
    android:name="ru.mail.mrgservice.MRGSFCMIntentService">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>
<!-- END: Firebase push notification -->

<!-- tracking users -->
<receiver
    android:name="ru.mail.mrgservice.MRGSBroadcastReceiver"
    android:exported="true">
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER"/>
    </intent-filter>
</receiver>

<service android:name="com.google.android.gms.analytics.CampaignTrackingService"/>
<service android:name="com.my.tracker.campaign.CampaignService"/>

<!-- Local Push -->
<receiver android:name="ru.mail.mrgservice.MRGSLocalPushBroadcastReceiver"/>
<receiver android:name="ru.mail.mrgservice.MRGSNotificationDeleteReceiver"/>

<!-- Samsung billing !-->
<activity
    android:name="ru.mail.mrgservice.MRGSSamsungBillingActivity"
    android:configChanges="keyboardHidden|orientation"
    android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>

<!-- Amazon In-App Purchases !-->
<receiver android:name = "com.amazon.device.iap.ResponseReceiver" >
    <intent-filter>
        <action android:name = "com.amazon.inapp.purchasing.NOTIFY"/>
    </intent-filter>
</receiver>

MyTracker🔗

the MRGService.instance().getMyTracker() method is removed, instead use

MRGSMyTracker.getInstance()

Working with notifications🔗

To subscribe to events from server push notifications, you need to replace the call

MRGService.instance().initPushEx(notifyDelegate); or MRGService.instance().initPush(notifyDelegate);

to

MRGSPushNotifications.getInstance().initPushNotifications(notifyDelegate);

Analytics🔗

  • The MRGSGoogleAnalytics class was removed,
  • The MRGSChartboost class was removed,
  • The MRGSFlurry class was removed,
  • The MRGSSendFeedbackActivity class was removed,
  • The sendGASocEvent method of the MRGService class was removed,
  • The sendGATimings method of the MRGService class was removed.

  • Added the MRGSAnalytics class. Use this class to add custom events to third-party SDK.

  • The sendAFEvent method that was used for sending events to AppsFlyer was removed of the MRGService class, instead use

MRGSAnalytics.getInstance().getAppsFlyer().sendEvent

Note that the arguments of the sendEvent method also changed. The method used to accept two String parameters - name, value. Now the method accepts String name, and value is the java.util.Map type. Example of use:

MRGSMap params = new MRGSMap();
params.put("param1", button.getText().toString());
MRGSAnalytics.getInstance().getAppsFlyer().sendEvent("press_button", params);

You can also call the method

MRGSAnalytics.getInstance().sendEvent()

And then the event will be connected to all third-party analytical SDKs (currently only AppsFlyer, in the near future there will be Firebase support)

Billing🔗

The isBillingAvailable method of the MRGSBilling class is not static now. To call it, you need to call

MRGSBilling.instance().isBillingAvailable()

The getBillingName method of the MRGSBilling class is not static now. To call it, you need to call

MRGSBilling.instance().getBillingName()

The sendPaymentInfo method was removed. Now you need to use the MRGSMetrics.addPurchase method. Note that the addPurchase method accepts 3 parameters! You can find detailed description of these parameters in the Installing the MRGS library for Android documentation.

Piligrim🔗

Removed the createMRGSAdvertising and getMRGSAdvertising methods from the MRGService class. They were moved to the MRGSAdvertisingFactory class.

MRGSAdvertisingFactory.createMRGSAdvertising()
MRGSAdvertisingFactory.getMRGSAdvertising()

GameCenter🔗

Delete the MRGServicePlayCenter.aar library and add the MRGSGameCenter.aar. Removed the getGameCenter method from the MRGService class, now you need to access the MRGSGameCenter class through the getInstance method.

MRGSGameCenter.getInstance()

3.6.5 → 3.7🔗

In this version, changes related to receiving Push notifications were made to the client-side.

  1. Delete the gcm.jar library and connect Google Play Services instead, if they have not already been connected (the source files are in the MRGS archive).
  2. Update the android-support-v4.jar (also located in the archive).
  3. Rename the ru.mail.mrgservice.MRGSGCMBroadcastReceiver receiver into com.google.android.gms.gcm.GcmReceiver and add the following attribute: android:exported="true".
  4. Add the android:exported="false" attribute to the ru.mail.mrgservice.MRGSGCMIntentService service, also add the intent-filter:
<intent-filter>
    <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
</intent-filter>
  1. Add the service:
<service
        android:name="ru.mail.mrgservice.MRGSInstanceIDListenerService"
        android:exported="false">
    <intent-filter>
        <action android:name="com.google.android.gms.iid.InstanceID"/>
    </intent-filter>
</service>
  1. Make sure the tag

<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

is version 7571000. Ideally, if Google Play Services is connected with the source files and, accordingly, resources, then instead of manually changing the version number, you can simply leave @integer/google_play_services_version (as in the example above). 7. Permissions section remains unchanged.

As a result, AndroidManifest.xml should look like this:

...
<!-- push notification -->
<receiver
        android:name="com.google.android.gms.gcm.GcmReceiver"
        android:exported="true"
        android:permission="com.google.android.c2dm.permission.SEND" >
    <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>

        <category android:name="ru.mail.mrgservicetest"/>
    </intent-filter>
</receiver>

<service
        android:name="ru.mail.mrgservice.MRGSGCMIntentService"
        android:exported="false">
    <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
    </intent-filter>
</service>

<service
        android:name="ru.mail.mrgservice.MRGSInstanceIDListenerService"
        android:exported="false">
    <intent-filter>
        <action android:name="com.google.android.gms.iid.InstanceID"/>
    </intent-filter>
</service>
<!-- END: push notification -->
...

To check if the AndroidManifest.xml is valid, use the mrgsmanifest utility located in the archive with MRGService.


Last update: 2023-10-25
Created: 2020-01-16