Support Topics Documentation Slack YouTube Blog

Pub/Sub question


(FlipTrip) #1

In this topic you described difference between pub/sub and push notifications:

Pub/Sub messages:

    App which receives messages must be running.
Does this mean that in case the app is closed I shouldn't get messages? Because when I close the app I'm still receiving them (they are shown as push notification in Android status bar). This is how I send message:
public static void sendJoinRequest(String groupId) {
        String channel = "ch"+ groupId;
        String senderName = User.getName();

        Group group = (Group) User.getUser().getProperty("group");

        PushObject pushObject = new PushObject();
        pushObject.setSenderName(senderName);
        pushObject.setSenderId(User.getUser().getObjectId());
        pushObject.setSendersGroup(group.getObjectId());
        pushObject.setPushType(PushObject.JOIN_REQUEST);

        Backendless.Messaging.publish(channel, new Gson().toJson(pushObject), new AsyncCallback<MessageStatus>() {
            @Override
            public void handleResponse(MessageStatus response) {
                BusProvider.getInstance().post(new BackendlessCallbackEvent(true));
                Log.d(LOG_TAG, response.toString());
            }

            @Override
            public void handleFault(BackendlessFault fault) {
                Log.e(LOG_TAG + ".sendJoinRequest", fault.toString()); 
            }
        });
    }

<receiver android:name=".utilities.PushReceiver"
                  android:permission="com.google.android.c2dm.permission.SEND">
            &lt;intent-filter&gt;
                <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
                <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>

                &lt;category android:name=&quot;com.fliptripapp.fliptrip&quot;/&gt;
            &lt;/intent-filter&gt;
        &lt;/receiver&gt;

Am I missing something here?


(Arthur Dzidzoiev) #2

Hello,
You must set PushPolicy because by default it is ALSO which means pus and pub/sub.
Please look at documentation - https://backendless.com/documentation/messaging/ios/messaging_overview.htm
Artur