06-15-2015 09:02 AM - edited 07-05-2021 03:24 AM
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?
06-15-2015 12:43 PM
A couple of other notes:
01-30-2017 02:27 AM
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)
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide