ManMohan
ManMohan

Reputation: 193

Android Cognito push sync

I am trying to integrate cognito with android app for sync the data. I am following the docs provided by AWS at this link

As per this docs there should be a BroadcastReceiver which will receive the push sync.

But I am already using the push notification in my app. And as per google documentation there is not mentioned for any broad cast receiver. All the notifications are received in the public void onMessageReceived(String from, Bundle data); method of GcmListenerService.

Can any one help me to clear about the broadcast receiver the aws push sync talking about ?

Upvotes: 0

Views: 246

Answers (1)

ast
ast

Reputation: 11

The BroadcastReceiver has been deprecated and AWS have not updated their docs yet. But you can simply create an Intent from the supplied data Bundle in the GcmListenerService:

@Override
public void onMessageReceived(String from, Bundle data) {
    CognitoSyncManager manager;
    try {
      manager = CognitoSyncClientManager.getInstance();
    } catch (IllegalStateException ise) {
      Log.w(TAG, "sync manager is not initialized");
      return;
    }

    Intent intent = new Intent();
    intent.putExtras(data);
    PushSyncUpdate update = manager.getPushSyncUpdate(intent);
    //...

Upvotes: 1

Related Questions