cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Phone gap with SUP Hybrid application?

Former Member
0 Kudos

Hello,

I searched on net to use or call phone gap APIs from my HWC workflow application(no native please). Did not get any suitable tutorial.

I'm going through this:

http://scn.sap.com/community/mobile/blog/2013/06/03/building-phonegap-native-plugin-for-hwc-containe...

http://scn.sap.com/community/mobile/blog/2013/06/04/building-phonegap-native-plugin-for-hwc-container--anroid

But, it seems that, these are kind of Native(java and Objective-c)...

Actually, I want to call phone gap API/functionality from JS(that are available in generated workflow in sybase unwired workspace 2.1.3).

Could any one please guide me with a step by step approach?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

midhun_vp
Active Contributor
0 Kudos

This is what exactly you are looking for,

http://scn.sap.com/thread/3359393

In the example it uses PhoneGap APIs inside the custom.js

- Midhun VP

Former Member
0 Kudos

Thanks a lot Midhun.

I need information for initial project setup (how to add phone gap lib) in Syabse unwired platform.

I'm very new to these apps...

Also...

What should I select as type( in image)...and then how to proceed...?

midhun_vp
Active Contributor
0 Kudos

The PhoneGap library will be present in the project by default. No need to add it.

- Midhun VP

Former Member
0 Kudos

Ok.I'm doing to get Geo location..

The tutorial you refered for me...I didn't get how "hwc" object is declared.So I searched in net, how to load phone gap features...and found this:

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc01853.0220/doc/html/vhu13...

Still, i'm not sure how to use this.

Any idea?

midhun_vp
Active Contributor
0 Kudos

hwc.customBeforeNavigateForward = function(screenKey, destScreenKey){

}

Comes in sup 2.2, if you are working in sup 2.1.3 the same function will be function customBeforeNavigateForward(screenKey, destScreenKey) {}

So you need to write the code inside of these methods which are present in the custom.js file in the project.

- Midhun VP

Former Member
0 Kudos

Hi Midhun,

That means, the following two methods can also be called without HWC..right?

function run() {

   ....................

.............................

          hwc.showAlertDialog(coords.latitude + ":" + coords.longitude); //should it be without HWC

      };

      var fail = function(e) {

          hwc.showAlertDialog('Can\'t retrieve position.\nError: ' + e); //should it be without HWC

      };

      navigator.geolocation.getCurrentPosition(win, fail);

    }

I did this without HWC.The alert dialog pops up showing latitude and longitude but still not getting the map/location. What could be the problem?

m'I doing any thing wrong in this method call: navigator.geolocation.getCurrentPosition(win, fail); ??

Please help.

midhun_vp
Active Contributor
0 Kudos

Yes. You don't want to use HWC. Is google map enabled in you phone in which you are testing ? I am assuming that it is related to it.

midhun_vp
Active Contributor
0 Kudos

Yes. You don't want to use HWC. Is google map enabled in you phone in which you are testing ? I am assuming that it is related to it.

Former Member
0 Kudos

I'm testing this on iphone simulator.Could you please tell me how to enable this on simulator? Am I missing some google map SDK related things? Do I need to get new iOS key from Google? If my code is correct..what step I need to follow? Is this something, I need to pay Google for this testing and access there map?

Thanks.

Answers (0)