user2265231
user2265231

Reputation: 79

Can't run IBM worklight app in real device android

I build a worklight application. create android app and test this application with local machine , its working fine with emulator.but when i try to test this application with android tablet it through error "The Application failed connecting to the service".

I try to find application-descriptor.xml and fix localhost to 192.168.1.1:8080 my ip local machine,but it not working.In my tablet I can't to go to 192.168.1.1:8080/console/index.html

Can anybody help me regarding this issue. how can i fix this one in my worklight android application and run it on my android tablet

Upvotes: 2

Views: 2364

Answers (5)

Pedro Castillo
Pedro Castillo

Reputation: 71

  1. Check ip in local machine ipconfig ( field Adaptador de Ethernet )
  2. Set this IP in field host name configuration server.

  3. Rebuild

  4. The other test is to check the direction in other machine, in the same network.

Upvotes: 1

JFJF
JFJF

Reputation: 35

I would suggest the following debugging steps:

a) Go to your device browser and browse to http: //xx.xx.xx.xx:8080/console

-> If this doesn't work, you have an obvious ip address issue. Then you have to figure out why, maybe you have a Symantec thingy that blocks any incoming traffic to your desktop - which they do. You should do an explicit allow.

b) If a) works, then you need to check in your code to make sure your app does try to connect to the server at startup. Or else the app will only try to connect when it calls adapter.

Now, go to your code. open the initOptions.js file. I typically, would set connectOnStartup to true, but also enable the onConnectionFailure so that it runs offline when there is no connection.

var wlInitOptions = {

// # Should application automatically attempt to connect to Worklight Server on application start up
// # The default value is true, we are overriding it to false here.
connectOnStartup : true,

// # The callback function to invoke in case application fails to connect to Worklight Server
onConnectionFailure: function (){wlCommonInit();},

// # Worklight server connection timeout
timeout: 2000,

};

3) Make sure you have the right URL in the application-descriptor.xml

<worklightServerRootURL>http://xx.xx.xx.xx:8080 </worklightServerRootURL>

If you are using the consumer edition (the real purchased WL), your URL would be. <worklightServerRootURL>http://xx.xx.xx.xx:9080/worklight </worklightServerRootURL>

(Note no space in between those URL - it's just this website putting a space there when there is a line break)

Redeploy your code to the WL server and create a new APK file. Update your device with the new APK file.

4) Do a test with the console again, you should see the console. Click on the Preview app link, it should work.

5) Now that you have updated your code on the server and the APK file. Open it up again on the device.

Do you still see the error message?

If things still not work.

6) Go to the app setting, since you have enable offline mode, it would allow you to access the App settings (it's the 4th button in Android) Go to Worklight Settings. Select Server Address -> Add the worklight URL to the Server URL. When you go back to the app, this will automatically reload the content from your WL server.

Upvotes: 0

red23jordan
red23jordan

Reputation: 2891

How about adding "192.168.181.1:8080" in application-descriptor.xml?

Upvotes: 0

Idan Adar
Idan Adar

Reputation: 44526

In a command window, run ipconfig and copy the IPv4 address. This is the IP address you need to place as the value for worklightServerRootURL in the file application-descriptor.xml.

The IP address you are usingnow does not look to me like the correct (public) IP address that you need to use. Try my above suggestion.

Upvotes: 0

user2265425
user2265425

Reputation: 21

Some things to check:
- Are your tablet and your worklight development machine on the same wireless network? (they need to be!)
- Does your computer have a firewall on it which may need configuring to let the traffic through. As a test you could briefly disable the firewall and see if you then have access (subject to disclaimer of the risk involved in disabling the firewall). A test without disabling the firewall would be to try accessing 192.168.1.1:8080 from another desktop/laptop machine on that same subnet.

Upvotes: 2

Related Questions