Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
New Developer
Posts: 31
Registered: ‎09-20-2013
My Device: Z10
My Carrier: NA
Accepted Solution

Registering a client device in a java app with BES/MDS

Hi all,

 

I've put this thread here as my application is a java application but it could have been also put under the Push Development section as well.

I have a part of my app that needs to connect to the BES of a certain company to receive push messages. The app works fine setting up a listener and receiving pushes through the MDS simulator and I also added more code to register the device with the BIS (bpas) based on Simon Hain's BIS example.

 

I originally thought that the we had to register with the BES much like how we register with the BIS except changing a few settings, like not adding an app ID etc. I created a basic push app for the Z10 and remember that the coding was the same for both BIS and BES except that the BIS address and app ID were left blank. But now after a bit of research I believe that with Blackberry 6/7 we don't need to onboard with a BES connection (except if some middleware program requires us to send some onboarding data) to receive a Push message, we just need to open a connector to the port number using the deviceside=false parameter and wait for a push to arrive.

I've looked all over the net and the forums for a direct answer to this question but can't seem to find one so that's why I am asking here to confirm.

Quite simply, using Simon's example as a base, if I were to connect a client device to a BES (where the server application doesn't need any onboarding information from the device, its function is to just send a JSON style message to the MDS with the device PIN to be pushed to the device) would I need to register the client device with BES/MDS, like Simon does with his registerWithBpas() function to register with the BIS/BPAS, or could I just go straight to opening a connection to a port with the paramter ;deviceside=false attached, and wait for a Push message to arrive.

Of course the devic has already been registered in the BES with its ID, email address of the person using that device, etc.

Simon if you get a chance to personally answer this, that would be great! Smiley Wink

Thanks everyone for your time and help.

Rob

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Registering a client device in a java app with BES/MDS

You do not need to register the device, just push with the PIN to the MDS and the push message will turn up on the device.  As you rightly point out, the device is already on the BES, and should be using the MDS to get to the internet anyway. 

New Developer
Posts: 31
Registered: ‎09-20-2013
My Device: Z10
My Carrier: NA

Re: Registering a client device in a java app with BES/MDS

Excellent!

Thanks so much for the quick and precise reply Peter, I really appreciate it. That was the answer I was hoping to hear!

New Developer
Posts: 31
Registered: ‎09-20-2013
My Device: Z10
My Carrier: NA

Re: Registering a client device in a java app with BES/MDS

Just as an added on question, 

 

It took me a bit to get my head wrapped around the idea, but if I understand correctly, if we use the MDS as a connection type for making HTTP connections, we do not need to specify how we will be connecting to the MDS (as in we don't need to add interface=wifi, etc, only deviceside=false) as the MDS code in the API will automatically connect to a wifi connection if possible or otherwise a wap connection to transfer the data through the MDS, right?

 

I originally thought to connect to the MDS we needed to be connected to a LAN in which the MDS was installed, or at least specify another connection type such as wifi or wap2 if we wanted to connect to it through a WAN. I didn't know that Blackberry through their Data Service had agreements with carriers to use there towers to exchange information from a device to a BES and then on to the internet. I thought the carrier would still count this data as used data. Or does Blackberry have its own towers installed through which data is transferred? Someone explained to me that Blackberry has its own towers installed in certain location for connecting to the BIS, but I don't know how true this is.

Thanks.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Registering a client device in a java app with BES/MDS

I am not a BlackBerry employee, I don't have any relationship with BB, nor do I have any knowledge that is not public domain regarding this.  So read the following with that caution, here is my take.

 

Be aware that this is only really applicable to BB7 and earlier devices, BB10 is different. 

 

Each carrier networks is really a packet switched network, with the packets being sent from the towers to some 'gateway' where they are effectively made available to the 'internet.  Each carrier has a gateway to support WAP and normal TCP, WAP being optimized for what was the relatively low bandwidth available on carrier networks.  The phones of course were carrier generic, so one of the things you had to do with all phones was configure your TCP gateway (APN, Access Point Network?) settings.  Otherwise you would not get data. 

 

Where a carrier agreed to support BlackBerry devices, BlackBerry would arrange for one of its Servers to act as another gateway providing data traffic optimized for BlackBerry devices.  Now the carriers could not measure this traffic, so they could not charge for the data - as a result BlackBerry plans which included this access, were priced a bit higher than normal data plans. 

 

On the device, when you say ";deviceside=false", you are effectively saying, use the BlackBerry gateway rather than your carrier's gateway.  Your email client and the Browser applications on the phone say this automatically, so that this is how they get the data, at no extra charge. 

 

Because BlackBerry code on the device manages the communication from the phone to the BlackBerry gateway, if it finds it is on a WiFi network, and it has previously confirmed that this really is a BlackBerry device that has access to the BlackBerry gateway, it will redirect the traffic over WiFi where it can, instead of the wireless.  The fact that it has connected previously is important.  If you start a phone up, connect and the BlackBerry device registers that it is a real BlackBerry device with a BlackBerry data plan, it will then swap to WiFi, and you can turn the cellular communication off and the device will continue to receive data.  But if you then hard restart the BlackBerry, it will not get data until you turn the cellular communication back on.

 

You can confirm that the BlackBerry is talking to the BlackBerry gateway by looking for the '4 dots' as one of the communication indicators (like the signal strength). 

 

With this in mind, here are the answers to your questions.

 

"we do not need to specify how we will be connecting to the MDS (as in we don't need to add interface=wifi, etc, only deviceside=false) as the MDS code in the API will automatically connect to a wifi connection if possible or otherwise a wap connection to transfer the data through the MDS, right?"

 

The slight inaccuracy in this statement is your use of the term WAP.  Replace that with wireless (or cellular) and the statement is accurate. 

 

"had agreements with carriers to use there towers to exchange information from a device to a BES"

 

With the slight change of there to their, this is as I understand it. 

 

"I thought the carrier would still count this data as used data."

 

The carriers count this as data when it goes through their gateway.  Data directed to the BlackBerry gateway doesn't, so is not counted. 

 

"does Blackberry have its own towers installed"

 

Not as far as I am aware.  It does however have a number of huge data centers which act as the gateways. 

New Developer
Posts: 31
Registered: ‎09-20-2013
My Device: Z10
My Carrier: NA

Re: Registering a client device in a java app with BES/MDS

Thanks for the great reply Peter!

 

I won't take it as godsend as I understand you don't work or have any relationship at Blackberry but what you explained seems to make perfect sense and adds on to what I thought before asking this question.

 

It was definitely interesting to understand how the Blackberry gateways work in this respect. I would have thought that maybe the blackberry data would have needed to pass through a carrier gateway first to count the data before being forwarded to a Blackberry network, but I guess not in many cases.

 

Thanks for pointing out my error in using "there" instead of "their", haha. How I didn't notice this earlier I don't know! Smiley Embarassed

 

Now I feel as though I have a good grasp on the whole Blackberry networking side of things. Thanks again for all that information, I really appreciate it.

Have a great day!  Smiley Wink

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Registering a client device in a java app with BES/MDS

No probs.

 

Be aware it all changes with BB10......