on 04-08-2013 11:04 AM
Hi All,
I'm using SUP version 2.1.3 and is trying to make use of PhoneGap functionality with a hybrid application. As I read through some information, version 1.4 of PhoneGap is already linked with this version of SUP and is ready for use. But when I'm trying to make some call to the geolocation api's or network for example, I'm not able to make calls to the relevant JS functions defined within the custom.js.
I would need your input in order to make it work. Awaiting your responses.
Thanks in advance.
Cheers,
Gourav
I believe you should be able to add the following code
alert(navigator.network.connection.type);
to a method such as customAfterShowScreen() ...
You need to be careful that you only call the phonegap methods after the phonegap library has fully loaded. See
http://docs.phonegap.com/en/1.4.0/phonegap_events_events.md.html
The following sample may also be of use.
PhoneGap and Hybrid Web Container Customization Sample for 2.1 ESD #3 https://cw.sdn.sap.com/cw/docs/DOC-149428
As well, the following sample shows an alternative way to get the device's location. See the section titled Getting the Device Location
Expense Tracking Sample https://cw.sdn.sap.com/cw/docs/DOC-148193
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniel,
Thanks for your response.
Yes I'm aware that we would need to call up the functions when phone gap is fully loaded and is using the onDeviceReady event.
I've also gone through the above links already and have placed a similar alert as above but initially it was not responding with anything but now it is giving a message saying Cannot read property "Connection" of undefined. Looks like it is not able to recognize the navigator.network object.
Further suggestions please.
Cheers,
Gourav
What mobile device or simulator are you using? What is the version of the Hybrid Web Container on that device or simulator?
In SUP 2.1.3, phonegap support was added for Android and iOS only. BlackBerry and Windows Mobile in SUP 2.2.
The 2.2 Hybrid Web Container is not compatible with the phonegap files generated from a 2.1.3 Eclipse tooling.
See
Hi Daniel,
I'm using an Android simulator platform 4.2.2 with API level 17. And I've tried it on both the workflow & hybrid web container clients version 2.1.0 & 2.1.3 respectively. It doesn't seems to work in either.
Infact while testing in HWC client 2.1.3, I also get a message saying connection to the server was unsuccessful where as the same runs fine in 2.1.0 without this error but it is not able to make any call to the phonegap apis. Please find the screen shot below:
Cheers,
Gourav
What version of the Mobile Workflow (Eclipse) tooling are you using?
The phonegap functionality was introduced in SUP 2.1.3, so you would need to generate your mobile workflow using the SUP 2.1.3 mobile workflow tooling and run it in a workflow container (also know as the Hybrid Web Container) that is version 2.1.3.
Hi Daniel,
I'm using Sybase Unwired Workspace version 2.1.3 as the IDE in order to generate the workflows if that is what you mean.
Any idea on the above error for the connection as that is what I'm getting for the 2.1.3 HWC client and I see it is not just occurring in any phonegap application but also any other hybrid app. I can think of it being related to the slow network @ my end or any other reason do you think?
Cheers,
Gourav
I don't recall seeing that particular error before. I would start though by going to the settings screen of the workflow container and choose restart, and then choose show log. If there are messages there showing a failure to connect, I would open up the device browser and enter http://ipNumberofSUPServer:5001.
I believe you should get a white screen if it succeeds.
If that fails, try restarting the simulator.
If that works, but the log still shows a problem connecting, try deleting the application connection in SCC and recreating it, also on the device go Android Settings > Applications > Mobile Workflow > Clear Data and then refill in its settings making sure to use the ip address for the server name.
Let me know if that helps.
Dan
What happens if you create a new workflow app that simply contains one screen? Is this problem a general problem or specific to one app?
Another thing to try would be to check the Android log. Perhaps a more useful message can be found there.
adb logcat
or
adb logcat > c:\out.txt
I suppose you could also try using an older Android version such as 2.2 (note Android simulator 2.3.3 does not work with the mobile workflow container). Obviously 4.2.2 had not been created and tested with SUP 2.1.3 since it was recently released.
Hi Daniel,
Currently I'm trying with very simple apps containing just 1 or 2 screens but the problem was with all apps. As per the link you gave above, I've downgraded to OS version 3.2 api level 13 with HWC container client after which I do not see that connection error any more. My Other apps are running fine now. But still the phonegap call is not working and is now giving the below error:
Please suggest.
Cheers,
Gourav
Here is the code I tried it with. I used an Android 4.0.3 simulator and a 2.1.3 Hybrid Web Container. Mine said it was version 2.1.3.6319. What is the build number of your Hybrid Web Container?
function customAfterWorkflowLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
try {
alert("PhoneGap 1.4.0 " + navigator.network.connection.type);
}
catch (e) {
alert(e.message);
}
}
Hi Daniel,
One more thing I would need to know. I was also testing the phonegap 1.4 (integrated with SUP 2.1.3) in an android 2.2 device with both workflow.apk & hybridwebcontainer.apk clients but it does not seems to work. Is it the android version which is the limitation or an issue with the .apk client? Which container would support phonegap 1.4?
Thanks in advance.
Regards,
Gourav
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.