Skip to main content
Documentation for version v73

RuStore

Note

The RuStore app must be installed on the device.

RuStore Developer Console Project Setup

Go to the RuStore Developer Console:



Add an app under the Application section:



Go to the Tools section in the developer console:



Select your created app and open Push Notifications:



Create a new project:



In the project setup, specify:

  • Project name
  • App package name
  • SHA-256 signature fingerprint (you can get it by running the ./gradlew signingReport command in the root of your app project)


Inside the created project, generate a service token:



Configuring the Altcraft Resource

In the Altcraft platform, create a resource or add a new communication channel — Push — to an existing one. Then, in the resource settings, select the Android platform and enable RuStore:



Scroll down to the RuStore settings and specify the Project ID and Password:



After making changes, don’t forget to save the resource.

Integrating RuStore Push Messaging into the App Project

Add repositories and dependencies to your Gradle files:


settings.gradle.kts (project settings)

dependencyResolutionManagement {
repositories {
// Other repositories..
maven("https://artifactory-external.vkpartner.ru/artifactory/maven")
}
}



build.gradle.kts (app level)

dependencies {
implementation("ru.rustore.sdk:pushclient:6.10.0")
}


Note

Information about the latest dependency versions is available here.

After adding the repository and dependencies, sync your Gradle changes.


Initializing RuStorePushClient

Initialize RuStorePushClient in Application.onCreate():

import ru.rustore.sdk.pushclient.RuStorePushClient

class App : Application() {
override fun onCreate() {
super.onCreate()
RuStorePushClient.init(this, "project_ID")
}
}

Creating a Class Extending RuStoreMessagingService()

Create a class that extends RuStoreMessagingService():

import ru.rustore.sdk.pushclient.messaging.model.RemoteMessage
import ru.rustore.sdk.pushclient.messaging.service.RuStoreMessagingService

/**
* RuStore service for handling push notifications.
*
* Extends [RuStoreMessagingService] and overrides key callbacks.
*/
class RuStoreService : RuStoreMessagingService() {
override fun onNewToken(token: String) {
super.onNewToken(token)
}

/**
* Called when a push message is received.
*
* Forwards the message to all receivers with added metadata.
*
* @param message The received RemoteMessage.
*/
override fun onMessageReceived(message: RemoteMessage) {
// Message
}
}

Updating the App Manifest

Add the RuStoreService declaration to your app’s AndroidManifest.xml:

<service
android:name="com.altcraft.rustore.RuStoreService"
android:exported="true"
tools:ignore="ExportedService">
<intent-filter>
<action android:name="ru.rustore.sdk.pushclient.MESSAGING_EVENT" />
</intent-filter>
</service>

Replace com.altcraft.rustore.RuStoreService with your package and class name. Note that the manifest must include the parameter android:exported="true".

Conditions for Proper RuStore Notification Functionality
  • The RuStore app is installed on the device.
  • The RuStore app has notification permissions.
  • The RuStore app is excluded from battery optimization.