Connect MRGS Facebook Cloud🔗
MRGS Facebook Cloud is an additional behavior for existing MGS modules. Therefore, it will be enough to set the billing type during the configuration and initialization of the MRGS SDK to change the behavior. On this page, only the main nuances of connecting and using the MRGS Facebook Cloud will be noted.
Facebook Cloud is available for Android and Desktop(Windows) platforms
Supported modules🔗
The following modules are currently supported:
- Collecting statistics (MRGService module)
- GDPR & CCPA (MRGSGDPR module). (Only for Android)
- Payments via Facebook Cloud (MRGSBilling module).
- Authorization in Facebook Cloud (MRGSAuthentication module) - Only the functionality of Facebook. Amazon, Google, VK and other authorizations are not supported.
- Facebook Cloud Notifications (MRGSNotifications module)
Creating a project🔗
-
To create a project in Facebook Cloud, follow the instructions
-
Then create a project in the MRGS website with the platform parameter "FacebookCloud".

- Fill in the Bundle ID by specifying the App ID from the project you created in Facebook Cloud.

Connect Facebook Cloud SDK (Android)🔗
- To work with authorization, payments and push notifications, you need to connect the Facebook Cloud SDK to your project in a gradle file.
dependencies {
// ... other libraries
implementation 'com.facebook.android:facebook-gamingservices:16.0.1'
}
- Also add parameters to your
manifestfile according to Facebook documentation
<application android:label="@string/app_name" ...>
...
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
<meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/>
...
</application>
- When initializing the MRGService SDK, it is extremely important to set the billing type, the behavior of all other modules depends on it.
using MRGS;
public class MasterController : MonoBehaviour
{
void Awake()
{
var serviceParams = new MRGServiceParams(appId: APP_ID, appSecret: APP_SECRET);
// Setting MRGServiceParams
// ...
// Requires Platform for Android application
// Available platforms: Amazon, Android, Huawei, Samsung, and FacebookCloud
serviceParams.AndroidExtraOptions.Platform = MRGSPlatformAndroid.FacebookCloud;
// Settings external SDK and initializing MRGS SDK
// ...
}
}
import games.my.mrgs.MRGSPlatform;
import games.my.mrgs.MRGService;
import games.my.mrgs.MRGServiceParams;
public class YourApplicationClass extends Application {
@Override
public void onCreate() {
super.onCreate();
// Setting MRGService
// Available MRGSPlatform: AMAZON, ANDROID, HUAWEI, SAMSUNG and FACEBOOK_CLOUD
final MRGServiceParams serviceParams
= MRGServiceParams.init(<MRGS_APP_ID>, <CLIENT_SECRET>, MRGSPlatform.FACEBOOK_CLOUD)
// Settings external SDK and initialization MRGS SDK
// ...
}
}
Connect Facebook Cloud SDK (Desktop)🔗
To enable work with Facebook Cloud, you need to set define MRGS_FACEBOOK_CLOUD_STORE, and also connect the games.my.mrgs.fbcloud module (available via UPM and as a unitypackage, like all other MRGS modules. Contains Facebook SDK for working with Cloud, it is important to note that this SDK cannot be in the project along with the official Facebook SDK version 12 and higher).
Also, when starting MRGS, you need to pass the facebook app id:
MRGSExternalSDKParams sdkParams = new MRGSExternalSDKParams();
// ...
sdkParams.FacebookParams = MRGSFacebookParams.initWithAppId("APP_ID");
// MRGS initialization
// ...
GDPR (Android)🔗
Since Facebook Cloud does not yet support opening external links, you need to set an additional flag in MRGSGDPR so that all clickable links in html open in WebView.
If you use your native dialogs to display GDPR, then you can use the following method to open GDPR links:
Attention!
When Facebook Cloud supports this functionality on its side, the links will be opened by their means, and the configuration code may change.
Authorization🔗
The authorization mechanism in the MRGS SDK has not undergone any changes, so to work with the MRGSAuthentication functionality, you can refer to the instructions.
Attention!
You should start working with the facebook functionality from MRGSAuthentication only after initializing the MRGService SDK.
Push-Notifications🔗
Configure push notifications according to Facebook documentation
Attention!
Of all the possible functionality that is available in MRGSNotifications, Facebook Cloud supports only sending local push messages.
Emoji in notifications
At the moment, Facebook does not support emoji.
Environment setting🔗
To receive App Secret to send push-notifications:
1) Go to the Facebook for Developers.
2) Go to your app.
3) On the left side of the panel, go to Settings -> Basic.
4) Copy the App Secret (See the screenshot below).

5) Open the MRGS website and go the application editing menu.

6) Go to the Additional features and copy the secret from the clipboard to the Key to send PUSH notifications field.

7) Press the Save button.
Push-notification icon🔗
If you want to use icons different from the application icons in the notifications, specify their file names when initializing MRGS (the name of the icon file; without the png extension; is in the res/drawable-nodpi/ directory of your project).
Attention!
Please note that you need to use the drawable-nodpi folder so that android does not change the size of your icons, since push data is displayed only in the user's account in the notifications section.
Payments🔗
- To create payments in Facebook Cloud and test them, follow the instructions.
Environment setting🔗
To receive App Secret to validate a payments:
1) Go to the Facebook for Developers.
2) Go to your app.
3) On the left side of the panel, go to Settings -> Basic.
4) Copy the App Secret (See the screenshot below).

5) Open the MRGS website and go the application editing menu.

6) Copy the secret from the clipboard to the Secret key for verification of payment field.

7) Press the Save button.
Making payments (Android)🔗
The payment mechanism in the SDK has not undergone any changes, so to work with the MRGSBilling functionality, you can refer to the instructions.
Upload build (Android)🔗
-
To download the distribution to Facebook Cloud, follow the instructions.
-
It is also worth noting that Facebook Cloud does not store the state of the application, unless you tell it which files and directories to save. Therefore, before filling in the application, specify all the files you need in a special field.

-
Add the following paths for the MRGS SDK to work correctly:
/data/data/<your_applicationId>/Documents/*
/data/data/<your_applicationId>/shared_prefs/HOST_SETTINGS.xml
/data/data/<your_applicationId>/shared_prefs/mrgs.gdpr.xml
/data/data/<your_applicationId>/shared_prefs/mrgsccpa.xml
/data/data/<your_applicationId>/shared_prefs/mrgsgdpr.xml
/data/data/<your_applicationId>/shared_prefs/open_udid_cache.xml
/data/data/<your_applicationId>/shared_prefs/idfa_cache.xml
/data/data/<your_applicationId>/shared_prefs/UserDefaultsKey.xml
Where <your_applicationId> - Bundle Id of your application(This is not the App ID that you specified in the MRGS console at the Creating a project step).
Finding problems (Android)🔗
- To test and debug the application, you can use the Cloud Game Debug Logs.
Attention!
It is worth noting that the logs in the log appear only after closing the application.
Created: 2021-07-16