Search code examples
androidibm-mobilefirstworklight-adapters

Unable to connect to backend through worklight http adapter in android device


i created HTTP adapter for connecting to yahoo weather service and deployed it on worklight server. it works well in worklight simulator and in android emulator but when using it on real android device i am getting following error:

{"invocationContext":null,"errorCode":REQUEST_TIMEOUT","errorMsg":"Request timed out for "http://'192.168.242.1':9080/krishak/apps/services/api/ok/android/query".Make sure the host address is available to the application(especially relevant for Android and iPhone apps)."}


Solution

  • You have to make sure your device can communicate with the Worklight Server where you have deployed your application and adapter. An easy way to test this is to go into the phones mobile browser and attempt to connect to the Worklight console at a location in the form of the following:

    http://"server address":"port"/"context root"/console

    in your case it looks to be located at:

    http://192.168.242.1:9080/krishak/console

    If your application cannot connect to the console successfully it is likely your device is not on the correct wifi network in order to establish communication. Please attempt this conenction and provide an update so we can provide further investigation.