publishing and receiving message

Hi all,

  1. publishing message only to API subscriber
    http://backendless.com/documentation/messaging/android/messaging_message_publishing.htm

From above link, Publishing with message headers using below API shouldn’t send push notification right?
Below API sends push to iOS device. If I am wrong, is there way to publish message without push notification?
FYI, I use below API from server code.
Backendless.Messaging.publish( message, publishOptions);

  1. redundant message received when iOS app re-launches
    The same message is received if I exit app right after receiving a message(via iOS task manager) and then relaunched app.
    How do I resolve this issue?

Hi Scott,

For (1), what values did you set in “publishOptions”?

One way to separate push notifications from pub/sub is to use different message channels: one channel for pub/sub messages, and another for push notifications.

When you re-launch your app, I assume your code resubscribes to receive messages. When you re-subscribe, the backend does not know it is the same physical device. This explains why a message is received twice. Btw, a message on the server lives only for one minute. That means if you relaunch the app after more than one minute, this will not happen. A workaround is to remember last message(s) you received when app exists, and upon restart ignore them.

Regards,
Mark

Hi Mark,

Below is code for publishing message, there’s nothing about send push, but push is sent.
FYI, below code is running on server. (custom server code)

PublishOptions publishOptions = new PublishOptions();
publishOptions.setPublisherId(sid);
publishOptions.putHeader( “badge”, badgeCount!=null ? badgeCount.toString() : “0”);
publishOptions.putHeader( “type”, String.valueOf(MsgType.TEXT));
publishOptions.putHeader( “sentAt”,String.valueOf(System.currentTimeMillis()));//Integer.toString(System.currentTimeMillis()));
publishOptions.putHeader( “groupId”, group.getObjectId() );
publishOptions.putHeader( “messageId”, textMessage.getObjectId() );

MessageStatus ms = Backendless.Messaging.publish(rid, text, publishOptions);

Regards,
Scott

For now there is only one way to publish message with out push notification(pub/sub only), it is to send message on a chanell without registred devices.

Scott,

The headers you set in PublishOptions do not match any of the documented headers:
http://backendless.com/documentation/messaging/rest/messaging_publish_push_notifications.htm

As a result, it is not clear to me what type of devices (from the OS perspective), the push notifications would be delivered to. (Please clarify).

Also, as Sergey said, if you need to separate pub/sub messages from push notifications, you can simply use different messaging channels for that. One channel for pub/sub and another for push notifications.

Regards,
Mark