cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
348
Views
0
Helpful
2
Replies

Unable to connect to CMX Simulation Server

wesleylemke
Level 1
Level 1

I am trying to get "Hello World" working with the Simulation server using the Android SDK.   I do have the NodeJS server up and running and I can hit the /demo/start url from both a desktop and mobile device.  However, when I try to register the Android client, I receive this error:

 

Failed CMX Registration:Registration to CMX server has failed.

 

Is there anyway to turn on more debugging information with the client to get a more specific error?

 

Here is the code that I have in my app:

 

// In onCreateView of fragment
...
    CMXClient.getInstance().initialize(getActivity());
    CMXClient.getInstance().setConfiguration(getConfiguration());

    registerButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            CMXClient.getInstance().registerClient(new CMXClientRegisteringResponseHandler() {
                @Override
                public void onSuccess() {
                    Log.e(FRAGMENT_TAG, "Successful CMX Registration.");
                    super.onSuccess();
                }

                @Override
                public void onFailure(Throwable throwable) {
                    Log.e(FRAGMENT_TAG, "Failed CMX Registration:" + throwable.getLocalizedMessage());
                    super.onFailure(throwable);
                }
            });
        }
    });

...

public CMXClient.Configuration getConfiguration() {
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getActivity());
    String baseUrl = settings.getString("prefBaseUrl", getResources().getString(R.string.default_settings_base_url));
    String port = settings.getString("prefPort", getResources().getString(R.string.default_settings_port));
    String senderId = settings.getString("prefSenderId", getResources().getString(R.string.default_settings_senderid));
    try {
        CMXClient.Configuration config = new CMXClient.Configuration();
        config.setServerAddress(baseUrl);
        config.setServerPort(port);
        config.setSenderId(senderId);
        return config;
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    return null;
}
//in strings.xml
<string name="default_settings_base_url">http://<My simulation server ip>/</string>
<string name="default_settings_port">8082</string>
<string name="default_settings_senderid"><my google sender id></string>

 

Is there anything wrong in my configuration or code?

 

2 Replies 2

wesleylemke
Level 1
Level 1

A couple of other notes:

 

  • I get a similar error when using the cmx-sample-core app:  "Faied (sic) To Load Venue:  org.apache.http.client.HttpResponseException: Not Found"  (this is using the sandbox IP address from here:  https://developer.cisco.com/site/cmx-mobility-services/learn/tutorials/android-mobile-app/#step-2-launch-android-emulator-and-core-sample
  • When I try my app or the cmx-sample-core app on a device running Lollipop, I get the app crashing when initializing CMXClient:      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cisco.cmx.sample.core/com.cisco.cmx.sample.core.MainActivity}: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application

saifeddinehakim
Level 1
Level 1

I get a similar error when running the sample android app of cisco provided here

01-01 00:34:49.010: E/AndroidRuntime(1769): FATAL EXCEPTION: main
01-01 00:34:49.010: E/AndroidRuntime(1769): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cisco.cmx.sample.core/com.cisco.cmx.sample.core.MainActivity}: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
01-01 00:34:49.010: E/AndroidRuntime(1769): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
Review Cisco Networking for a $25 gift card