* Registers/subscribes the application for receiving BPS pushes
*/
public void registerBPSPush(final String appId, final String BPDSUri,
final String contentUri, final String listenUri) {
NonBlockingReceiverDestination listenDest = null;
NonBlockingSenderDestination bpsServerDest = null;
try {
final MessageListener bpsListener =
new DestinationListener("BPS", true);
final InboundDestinationConfiguration config1 =
InboundDestinationConfigurationFactory
.createBPSConfiguration(true, true, false, appId,
BPDSUri); // serverUrl
listenDest =
DestinationFactory.createNonBlockingReceiverDestination(
config1, URI.create(listenUri), bpsListener);
final MessageListener subscriptionListener =
new SubscriptionResponseListener("Subscription");
bpsServerDest =
DestinationFactory.createNonBlockingSenderDestination(
_context, URI.create(contentUri),
subscriptionListener);
final ByteMessage subscrMsg =
BpsSubscriptionMessageBuilder
.createByteSubscriptionMessage(bpsServerDest,
listenDest, "user", "pwd");
((HttpMessage) subscrMsg).setQueryParam("field1", "xxxxx");
((HttpMessage) subscrMsg).setQueryParam("osversion", "6.0");
bpsServerDest.send(subscrMsg);
} catch (final Exception e) {
alertDialog(e.toString());
}
}