HOME.en.md
RuStore Unity Plugin for Cloud Application Configuration Service
RuStore Remote Config is a cloud service that allows you to change the behavior and appearance of your application without requiring users to download an application update. The SDK encapsulates the request for a configuration from the server, caching, and background updates.
Unity 6000+ versions are supported.
Installing the plugin in your project
- Download the ru.rustore.core-x.y.z.tgz and ru.rustore.remoteconfig-x.y.z.tgz files from the official repository on GitFlic.
- Import the downloaded packages into the project via Package Manager (Window → Package Manager → + → Add package from tarball…).
- Update project dependencies using External Dependency Manager (Assets → External Dependency Manager → Android Resolver → Force Resolve).
Installing External Dependency Manager
External Dependency Manager for Android is included in the RuStoreCore package. To install, follow these steps.
Open RuStoreCore in the Package Manager window (Window → Package Manager → Packages RuStore → RuStoreCore).
Go to the Sample tab.
Import the External Dependency Manager sample.
Project Setup
Open project settings: Edit → Project Settings → Player → Android Settings.
In the Publishing Settings section, enable the following settings.
- Custom Main Manifest.
- Custom Main Gradle Template.
- Custom Gradle Properties Template.
In the Other Settings section, configure:
- package name.
- Minimum API Level = 24.
- Target API Level = 34.
Open External Dependency Manager settings: Assets → External Dependency Manager → Android Resolver → Settings, enable the following settings.
- Use Jetifier.
- Patch mainTemplate.gradle.
- Patch gradleTemplate.properties.
SDK Initialization
Initialization of RuStoreUnityRemoteConfigClient with parameters UpdateBehaviour.Default and UpdateBehaviour.Snapshot must occur at the moment of Application.onCreate(), since the SDK must be initialized when starting background synchronization.
To do this, extend the Application class and add the following code to the onCreate method.
package ru.rustore.unitysdk;
import android.app.Application;
import ru.rustore.unitysdk.remoteconfigclient.RuStoreUnityRemoteConfigClient;
import ru.rustore.unitysdk.remoteconfigclient.model.RemoteConfigClientParameters;
import ru.rustore.unitysdk.remoteconfigclient.model.UnityRemoteConfigClientEventListener;
public class RuStoreRemoteConfigApplication extends Application {
public final String APP_ID = "a83c91d3-21b4-4891-841e-0ed0fc39a562";
public final int UPDATE_TIME = 15;
public final String UPDATE_BEHAVIOUR = "Default";
public RemoteConfigClientParameters parameters = null;
public UnityRemoteConfigClientEventListener listener = null;
@Override
public void onCreate() {
super.onCreate();
RuStoreUnityRemoteConfigClient.INSTANCE.init(APP_ID, UPDATE_TIME, UPDATE_BEHAVIOUR, parameters, listener, getApplicationContext());
}
}
To replace the Application class with RuStoreRemoteConfigApplication, add the android:name attribute to the application tag in your project’s manifest file Assets/Plugins/Android/AndroidManifest.xml.
Example AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools">
<application android:name="ru.rustore.unitysdk.RuStoreRemoteConfigApplication">
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:theme="@style/UnityThemeSelector">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
</application>
</manifest>
Plugin Initialization
To access SDK methods from C#, initialize the plugin using the Init method.
Calling the Init method
IRemoteConfigClientEventListener eventListener = /* Interface implementation */;
RuStoreRemoteConfigClient.Instance.Init(eventListener);
To work in UpdateBehaviour.Actual mode, initialization can be performed without creating an extension of the Application class. In this case, the APP_ID parameter must be passed from C#.
Calling the Init method
IRemoteConfigClientEventListener eventListener = /* Interface implementation */;
var settings = new RuStoreRemoteConfigClientSettings() {
appId = APP_ID,
account = ACCOUNT,
language = LANGUAGE
};
RuStoreRemoteConfigClient.Instance.Init(settings, eventListener);
Start learning the library documentation with the methods of the RuStoreRemoteConfigClient class. Or use the online guide.
Technical Support
Additional help and instructions are available in the RuStore documentation and by email at support@rustore.ru.
Distribution Terms
This software, including source codes, binary libraries and other files, is distributed under the MIT license. Licensing information is available in the MIT-LICENSE document.