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, location event may be sent automatically on demand. It is done with Synerise.locationAutomatic(boolean) initialization method.

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"/>
😕

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.