cancel
Showing results for 
Search instead for 
Did you mean: 

Registering Android emulator to SCC without relayserver?

Former Member
0 Kudos

Hi

I am trying to register Android Simulator to Sybase control center in manual mode using below code ,but I could not register devices , it keeps checking for relay server URL and throws an error  unable to find good Relay server URL.

Is it mandatory to have relayserver setup to register even emulator to SCC, then how to bypass the error and register the device.

   try {

               /* STEP1:Initialize the App */

               LiteUserManager.initInstance(getApplicationContext(), "FirstAPP");

               /* STEP2:Provide SUP connection Settings and Register the User */

               LiteUserManager usrMngr = LiteUserManager.getInstance();

               // usrMngr.setConnectionProfile(Server_Host, Port, FormID/companyID);

               if (!usrMngr.isRegistered()) {

               usrMngr.setConnectionProfile(server, 80, "Company1");

                    // usrMngr.registerUser(userName, actCode);

                    usrMngr.registerUser("APPUSER", "123");

               }

          } catch (MessagingClientExceptione) {

               e.printStackTrace();

          }

Thanks

Santosh

Accepted Solutions (0)

Answers (2)

Answers (2)

rohith_deraje
Advisor
Advisor
0 Kudos

Hi Santhosh,

You can directly register the android app on simulator with SCC by passing SUPserverIP, Port and company ID as 0. modified code snipet is as below.

   try {

               /* STEP1:Initialize the App */

               LiteUserManager.initInstance(getApplicationContext(), "FirstAPP");

               /* STEP2:Provide SUP connection Settings and Register the User */

               LiteUserManager usrMngr = LiteUserManager.getInstance();

               // usrMngr.setConnectionProfile(SUPServer_Host, Port, FormID/companyID);

               if (!usrMngr.isRegistered()) {

               usrMngr.setConnectionProfile(SUPserverIP, 5001, "0");

                    // usrMngr.registerUser(userName, actCode);

                    usrMngr.registerUser("APPUSER", "123");

               }

          } catch (MessagingClientExceptione) {

               e.printStackTrace();

          }

In case of error please check for the following.

1. AndroidManifest.xml file of your project should have the below permissions.

   

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

2. Check if the messaging port of your SUP is other than 5001. You can find it at SCC>>Localhost@localhost>>Server>>ServerConfiguration>>Messaging.

If you are still getting any error, please revert back with error details.

Regards

Rohith

Former Member
0 Kudos

Hi,

Follow ths steps:

Application app = Application.getInstance();

                              if(!"SUPProject".equals(app.getApplicationIdentifier())){

                                        app.setApplicationIdentifier("SUPProject");

                                        app.setApplicationContext(Activity.this);

                              }

Application app = Application.getInstance();

ConnectionProperties connProps = app.getConnectionProperties();

LoginCredentials loginCredentials = new LoginCredentials(USERNAME, PASSWORD);

                    connProps.setLoginCredentials(loginCredentials);

                    connProps.setServerName(HOST);

                    connProps.setPortNumber(PORT);

                    SUPProjectDB.setApplication(app);

                    SUPProjectDB.getSynchronizationProfile().setServerName(HOST); // Convenience only

                    if (app.getRegistrationStatus() != RegistrationStatus.REGISTERED)

                    {

                              app.registerApplication(TIMEOUT);

                    }

                    else

                    {

                              app.startConnection(TIMEOUT);

                    }

ths will work.

bye