0
votes

I am new to MobileFirst Hybrid development and I have started a prototype project which involves creating adatpers deploying and testing. I was able to create a javascript adatper (http adatper), which calls web api, I was able to deploy the adapter in MobileFirstDevelopment Server, in my case it is my local machine.

The project runs successfully in mobile preview mode and also in android emulator, but when I test it in real android device, the adapter functionality does not work. I have installed the android usb drivers and can lauch the application and also call cordova plugins thru device, its just adapter functionality that doesn't work.

The "LogCat" shows the error as [/app/services/ProjectName/android/query] failed, state:500 response undefined.

1
I am confuse. you are trying to call an API from an HTTP adapter in your code? is the API hosted in your machine? - ScarletMerlin
@ScarletMerlin, in MFP the client sends a request to a server which then invokes the adapter request to the backend. - Idan Adar
@bobby, provide your implementation related to the adapter call - both client code and adapter code. - Idan Adar
Hello Idan,The issue is my droid device and MFP server on my local machine are not the same network. It started working after they are on the same wifi network. Again, it did not work initially even both are on the same network, I had to use computername instead of id address in the MobileFirstDevelopment server HostName propery. Any idea why would this be an issue using IP address? Thanks in advance for your help. - Bobby

1 Answers

1
votes

Your app is built with the URL of the server, when deployed to the device it must be possible to "see" the server as specified by that URL. Often the device will be in a subtly different network environment from that in the emulator.

You will find the values used in your app in

/android/native/assets/wlclient.properties

wlServerProtocol = http
wlServerHost = 192.168.0.19
wlServerPort = 10080

Don't edit them directly, rather use

-rightClick-> Run As -> Build Settings and Deploy Target

to specify the URL and then rebuild the project.

Longer term I recommend using build scripts to create your deployable artefacts and the server URL can specified in those scripts.