Skip to Content

Native Android-MBO Non-DOE based approach through Relay Server

After burning my mid-night oil in investigating how to make my android app to talk through relay server, here are few things what I have noticed and would like to share my experience with the android SUP integration through relay server so that it can help you if you are facing few challenges.

If you have been using SUP for some time, then you must have been wondering what happened to the MBS and RBS option while generating the code in SUP 2.1.2 😕 , which was there in all earlier version,  With 2.1.2 there is now a more unified method however both RBS and MBS still exist as such. In android the application registers initially through MBS however the synchronising with the server is done through the RBS method (port 2480 normally). When generating the code however there is no option to select RBS or MBS. It will already be correctly configured to achieve this. Beyond the initial register with the server though, Android should only be using RBS to talk with the application.

When you first connect and register with the server it will need to connect through port 5001 and then synchronize data through port 2480 or 2481 for secure by default (unless changed). You will as a result need both an RBS and an MBS farm for the relay server however with iOS applications (if those are connecting through the relay server) will already use an MBS farm to connect.

As to why it uses both. By nature RBS tends to favor applications which can be used both online and offline. MBS requires more connectivity but sends smaller packages to the device however RBS sends fewer packages to the device but these are larger. Registration to begin with is just a series of messages to verify the device however the main application is designed to also be run-able in “offline mode” using an offline login method which is typical of RBS.

iPhone has the APNS which makes that MBS only really. Blackberry has been RBS since very early versions so changing that would cause people to have to rework any blackberry programs in later versions however the intention is to move the MBS and RBS methods closer together which is why in the SCC for 2.1.2 it states unified and why if you try to generate code in the 2.1.2 Mobile SDK, there is no option to select a communication type. The idea is to bring everything closer together and  the MBS method is the best way to register originally with the server.

So typically, what exactly you have to do is, at first ensure that your able to synchronize by directly connected through SUP alone. How do you do that ? Let’s go through the following steps

1)      1 ) Before registering the application set the connection properties:


2)      2) Then go for the registration :


3)      3)  If your application has been successfully registered, then let’s set the property for Synchronization :


4)      4) And then you can set the personalization parameters, and then you are good to go with the subscription and synchronization

Now once you are done with all the steps mentioned above and if you are able to synchronize then let’s try achieve it through relay server, If at all if you are using Sybase Hosted Relay Server, you need to create 2 farms, one for MBS and another one for RBS, then configure Outbound   enabler in SCC for both the Farms and ensure that status shows as running, let us assume that you have named your Farm-ID for MBS & RBS as developmentMBS and developmentRBS.

In the above mentioned steps, now your HOST will be your Relay Server, PORT & PORT_SYNC will be 80 and the FarmId in step no.1 has to developmentMBS, and then what I did was I have edited the  under the initialize method, and that is tricky,


This blog post was written when keeping SUP 2.1.2 in mind,

you are yet confused 😕 ? post a question at SAP for Mobile.

I hope this post will be helpful to you, and that was my first blog in SCN, looking forward to see your encouragement. 😎

Thanks you all

Srinivas Divakarla

You must be Logged on to comment or reply to a post.
  • Awesome work man..

    But one query in this...

    In streamParams.setUrl_Suffix("/cli/iarelayserver/developmentRBS");

    This command is for windows based or linux..I think it is for linux

    For windows is it "/ias_relay_server/client/rs_client.dll/developmentRBS" ??

    Kindly confirm

  • Hi Srinivas,

    I followed all the steps as guided by you. I am using a sybase hosted relay server. So i set the properties as in the declaration

    then set up the Application properties

    Then as guided by u set the connection properties

    once doing this I set up the connection profile

    Then in the file made the changes


    Both my Farms are also running fine.

    But i am still facing the error

    "Could not connect to server..Verify Relay Server URL Template"

    Did i go wrong somewhere..Kindly Suggest

    • I don't see you are doing anythin wrong over here, where as I would suggest you to use device instead of an emmulator, and before doing that, probably you have un-install the application and you have delete & re-create the SUP user in SCC as well, I hope that will help you.

        • Hi Midhun,

          Typically the above code is only to provide the knowledge infact you can very much use a text field to read the same dynamically depending upon your usecase.

          If you more questions concerning android SUP development, I would request you, to post a new question, probably you could mention me in that so that I would try to help you out, at the same time it will be helpful for others to search the answer in SCN.


          Srinivas Divakarla

          • When am trying to connect register am getting the error Error: 558 Message: 'Could not connect to server. Verify Relay Server URL Template'

            can you tell me a solution please

          • Can you paste the whole code in a new thread and mark srinivas me and whomever you think in the post as this thing is getting messy over here.. we will surely help you out of it.

          • I meant not on the hard coding of the activation code. I am asking you whether we need to create the user before register(Is it possible to do with giving a activation code)

          • U have to create a user in the SCC and then give an activation code and supply the same username and activation code from the device and then it will get registered.

  • Great blog dude, thats some finding. It seems crazy to have to deal with both the ports. But am hearing its all RBS in a few months time; including iOS apps. Hope that brings one way of syncing. Fingers crossed.

  • After following all your code suggestion i am still not able to resolve it.

    Even i am facing with the same error..The device is going online but mobilink communcation error is coming when calling synchronize() first time.

    com.sybase.persistence.SynchronizeException: com.ianywhere.ultralitejni12.implementation.JniException: UltraLiteJ Error[-1305]: MobiLink communication error -- code: 57, parameter: HOST, system code: 0Details:

    StreamErrorCode = 57

    StreamErrorMessage = HOST

    I am stuck in this now. I have done all modifications you have suggested. Host i am providing the relay server URL and port number is 80.

    • Hi Senthil,

      I am still looking out for the solutions for the same problem but still not able to. As per the blog first if you try it on your local server using ports 5001 and 2480 it will work..Then in the same application change host to relay server and port to 80 it will work again but if you try a new application starting with host as relay server and port as 80 it doesnt...Are you also facing the same problem?

  • Hi Rakshit,

    Yes. My problem also the same. I have tried with local server using 5001 and 2480 , it works fine. If i try to connect through a relay server then i m getting this issue. It doesnt work at first time also... 😥 My code is attached on another thread. have a look.

    Please give some suggestion..



  • Hi Srinivas,

    I have to update the fields, i took the Flight Customer- BAPI_FLCUST_GETLIST and


    am attaching the code .

    public class DetailActivity extends Activity


        private int surrogateKey;


        public void onCreate(Bundle savedInstanceState) {




            Intent intent = this.getIntent();

            surrogateKey = Integer.valueOf(intent.getExtras().getString("sk"));

            GetList get = GetList.find(surrogateKey);




            final EditText city = (EditText)findViewById(;


            final EditText cname = (EditText)findViewById(;


            final EditText address = (EditText)findViewById(;


            final EditText xcity = (EditText)findViewById(;

            final EditText xname = (EditText)findViewById(;


            Button submit = (Button)findViewById(;

            submit.setOnClickListener(new OnClickListener(){


                public void onClick(View v)


                    GetList get = GetList.find(DetailActivity.this.surrogateKey);


                    Log.i("csutnooo", address.getText().toString());








                   Log.i("city", city.getText().toString());





                   Log.i("customer", cname.getText().toString());








                      Log.i("xcityyy", xcity.getText().toString());




                      Log.i("xxcustname", xname.getText().toString());







                 //   get.update();



                 //  FlightsDB.synchronize();



                    GenericList<SynchronizationGroup> syncGroups = new GenericList<SynchronizationGroup>();


                    FlightsDB.beginSynchronize(syncGroups, "");






  • Hi,

    Thanks a lot for your information bro. I have few questions.

    What is Sybase Hosted Relay Server? In my organisation we tested some ios apps

    for those we given the farm id as 0.

    So if I am going to develop android app do i want to consider the concept of 2 farms?

    • Sybase hosted relay server is nothing but a relay server without any setup in ur environment. It is hosted on the sybase site. So you dont have to build a relay server in your landscape but u can use it by creating two farms over there one for MBS and one for RBS.

      Only Android uses two farms MBS for registration and RBS for the sake of synchronizing of data.

      For ios u require only a MBS Farm.

      You can build your own relayserver on sybase. Just go to google and search for sybase hosted relay server. First link will take you over there

    • Hi Daniel,

      The same concept is applicable for SUP 2.1.3 with iOS a very small change, the only thing is that, you could yet use MBS for Synchronization, backward compatibility is taken care.


      Srinivas Divakarla

  • Hi Srinivas,

    Great post!! It worked great for SUP 2.1.3 but now that I'm trying to make it work for SUP 2.2 I'm having problems. Do you know if something changed or it should still work this way?

    Thanks in advance!


    Lucía Cianelli

    • Hello Lucia,

      Are facing any challenges with SUP 2.2? any specific errors? May be you can post it as a question.


      Srinivas Divakarla

      • Hello Srinivas,

        I managed to make it work before but now I'm having difficulties again. I'm getting an error every time it tries to synchronize. The application registers correctly but when it synchronizes I get the following exception:

        com.sybase.persistence.SynchronizeException: com.ianywhere.ultralitejni12.implementation.JniException: UltraLiteJ Error[-1305]: MobiLink communication error -- code: 63, parameter: , system code: 110Details:

        StreamErrorCode = 63

        StreamErrorMessage = null

        I read it may have something to do with a socket that cannot be opened but I don't know how to search for the communication error. Any ideas?

        Thanks in advance,

        Lucia Cianelli

        • Thank you Lucia, I am glad that my first ever blog post helped you upto some extent, over the time, the number experts has gone up, I would like you to post your problem as a separate question, for me it seems to be different,

          It's Just monday, would be happy to help you Lucia,


          Srinivas Divakarla

  • I found that with .net application, we dont need to an initialize profile in generate DB class like this post, just change the server name in this class in InternalSynchronize method 🙂

    • Thank you Quynh,

      By the way, if you are using .net desktop application you might not need relay server! and also there is another small change for C# you will not be having ultraliteJ instead you will be having ultralite for replication based synchronization.

  • Hi there Mr,

    This was a very Helpfull blog. I was able to connect to Unwired Server and understand the code here exposed. thanks for your work in favor of the community.