Silent SDK Commands

Synerise SDK has already implemented methods. For now the only one is requesting localization.

Silent Localization Command

To request localization let your application class implement OnLocationUpdateListener and also provide it to Synerise Builder.

public class App extends MultiDexApplication implements OnLocationUpdateListener {
    private static final String TAG = App.class.getSimpleName();
    @Override
    public void onCreate() {
        super.onCreate();
         Synerise.Builder.with(this, syneriseClientApiKey, appId)
                                .notificationIcon(R.drawable.ic_notification_icon)
                                .locationUpdateRequired(this)
                                ...
                                .build();
    }
    @Override
    public void onLocationUpdateRequired() {
        // your logic here
    }
}

Now anytime you send below frame from app.synerise.com then your application will receive callback onLocationUpdateRequired where your app can get device location. For example implementation check our sample application.

"data": {
    "issuer": "Synerise",
    "message-type": "dynamic-content",
    "content-type": "silent-sdk-command",
    "content": {
        "class_name": "com.synerise.sdk.injector.Injector",
        "method_name": "GET_LOCATION",
        "method_parameters": []
    }
}

Note that incoming silent push command will awake or launch you application in the background which causes in SDK initialization (if not already).
It means, for instance, that AppStartedEvent will be sent and/or banners will get fetched.
In addition, the location event may be sent automatically on demand. This is done with Synerise.locationAutomatic(boolean) initialization method.
For custom implementation, remember to send AppearedInLocationEvent in the onLocationUpdateRequired callback.

Note:

Synerise SDK asks for ACCESS_FINE_LOCATION permission. To remove this permission from your application, use following solution in your AndroidManifest:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" tools:node="remove"/>

Silent Sign Out Command

To force a sign out, send a silent push to the target device.

Note: This mechanism should be used only in specific situations, not as a standard solution.

When you send the below frame from app.synerise.com, the SDK will clear a customer’s token and sign them out.

"data": {
    "issuer": "Synerise",
    "message-type": "dynamic-content",
    "content-type": "silent-sdk-command",
    "content": {
        "class_name": "com.synerise.sdk.injector.Injector",
        "method_name": "SIGN_OUT",
        "method_parameters": []
    }
}

Note that an incoming silent push command awakes or launches your application in the background, which causes SDK initialization (if not already initialized).
It means, for example, that AppStartedEvent will be sent and/or banners will get fetched.

😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.