how do I get any data from phonegap to profoundui ?
I know how to get phonegap to interface with the device, but how do I get the information back to profoundui.
phonegap and profoundui
-
- Profound User
- Posts: 88
- Joined: Tue Jun 01, 2010 11:31 am
- First Name: christopher
- Last Name: williams
- Company Name: banks dih limited
- Phone: 592-226-9584
- Address 1: thirst park
- Address 2: ruimveldt
- City: gerogetown
- State / Province: Outside Canada/USA
- Zip / Postal Code: 0000
- Country: Guyana
- Contact:
- Alex
- Profound Logic Staff Member
- Posts: 233
- Joined: Fri Jan 04, 2008 12:10 pm
- First Name: Alex
- Last Name: Roytman
- Company Name: Profound Logic Software
- Contact:
Re: phonegap and profoundui
You should be able to use any Profound UI JavaScript API, like pui.click() or changeElementValue(), from PhoneGap.
So, for example, let’s say that you have detected the Native Android Back Button in PhoneGap and would like to send a corresponding message to the RPG code. You can use the following code in PhoneGap:
Then, on any screen where you want to handle the back button, add a hidden link or button with the id of "BackButton" and bind the respond to RPG variable "BackButton".
In your RPG code, simply test for it as follows:
So, for example, let’s say that you have detected the Native Android Back Button in PhoneGap and would like to send a corresponding message to the RPG code. You can use the following code in PhoneGap:
Code: Select all
if (getObj("BackButton") != null) pui.click("BackButton");
Then, on any screen where you want to handle the back button, add a hidden link or button with the id of "BackButton" and bind the respond to RPG variable "BackButton".
In your RPG code, simply test for it as follows:
RPG CODE
Other device information can be sent in a similar manner as well.-
- Profound User
- Posts: 88
- Joined: Tue Jun 01, 2010 11:31 am
- First Name: christopher
- Last Name: williams
- Company Name: banks dih limited
- Phone: 592-226-9584
- Address 1: thirst park
- Address 2: ruimveldt
- City: gerogetown
- State / Province: Outside Canada/USA
- Zip / Postal Code: 0000
- Country: Guyana
- Contact:
Re: phonegap and profoundui
Thanks for that reply. however, my main task is to get any data(for example geolocation coordinates) from phonegap into perhaps a set of variables in Profoundui. That example could help us to plot a position on google maps. or say we want to read a barcode using the device camera(like what LANSA's LongRange can do), how can we get that data sent back to profoundui?
- David
- Profound Logic Staff Member
- Posts: 690
- Joined: Fri Jan 04, 2008 12:11 pm
- First Name: David
- Last Name: Russo
- Company Name: Profound Logic Software
- Contact:
Re: phonegap and profoundui
As Alex mentioned, any of PUI's JS APIs should be usable from PhoneGap. So, you should be able to use "changeElementValue()" to put information into the screen.
See here:
http://www.profoundlogic.com/docs/displ ... +value+%29
To use this, you just pass the "id" property of the widget you want to change (exactly, including case), and then the value you want to put into it.
The widget could be a hidden field.
After changing a field on the screen with this, you can then use "pui.click()" to return control to the server:
http://www.profoundlogic.com/docs/displ ... %28+id+%29
You can pass a button widget's "id" property to a simulate click on that button (i.e. to set on a response indicator in RPG), or without parameter to simulate enter key press.
The RPG application then receives the data in the field bound to the widget you have changed through scripting, just like it receives any other bound field data.
Does this explain it?
See here:
http://www.profoundlogic.com/docs/displ ... +value+%29
To use this, you just pass the "id" property of the widget you want to change (exactly, including case), and then the value you want to put into it.
The widget could be a hidden field.
After changing a field on the screen with this, you can then use "pui.click()" to return control to the server:
http://www.profoundlogic.com/docs/displ ... %28+id+%29
You can pass a button widget's "id" property to a simulate click on that button (i.e. to set on a response indicator in RPG), or without parameter to simulate enter key press.
The RPG application then receives the data in the field bound to the widget you have changed through scripting, just like it receives any other bound field data.
Does this explain it?
-
- Profound User
- Posts: 88
- Joined: Tue Jun 01, 2010 11:31 am
- First Name: christopher
- Last Name: williams
- Company Name: banks dih limited
- Phone: 592-226-9584
- Address 1: thirst park
- Address 2: ruimveldt
- City: gerogetown
- State / Province: Outside Canada/USA
- Zip / Postal Code: 0000
- Country: Guyana
- Contact:
Re: phonegap and profoundui
ok here's our scenario:
We have a phonegap application loading a external profoundui page into an android webview. we are trying to communicate between the profoundui app and the android/phonegap application. we acheived communication by adding a javascript interface to the android webview which loads our own java class as javascript available to our profound page. this works when getting info from the device to profoundui and vice versa. e.g with geolocation coordinates.
However this approach is too OS specific. We need to be able to access phonegap functions directly from our profoundui external page without the use of the android functions to grab information like location coordinates. We need to use phonegap functions and maintain OS portability.
Thanks for the reply. Hope my explanation was clear enough.
We have a phonegap application loading a external profoundui page into an android webview. we are trying to communicate between the profoundui app and the android/phonegap application. we acheived communication by adding a javascript interface to the android webview which loads our own java class as javascript available to our profound page. this works when getting info from the device to profoundui and vice versa. e.g with geolocation coordinates.
However this approach is too OS specific. We need to be able to access phonegap functions directly from our profoundui external page without the use of the android functions to grab information like location coordinates. We need to use phonegap functions and maintain OS portability.
Thanks for the reply. Hope my explanation was clear enough.
-
- Profound User
- Posts: 82
- Joined: Fri Jun 29, 2012 2:33 pm
- First Name: Antonio
- Last Name: Ruballos
- Company Name: Profound Logic
- Contact:
Re: phonegap and profoundui
Hello Chris,
I think the following link will help you with what you're looking to do.
http://www.profoundlogic.com/docs/displ ... pplication
It seems you are trying to use a webview inside an android application created with phonegap to access your external profound UI application. However, you can create a native android application with profound ui through phonegap, as the example shows.
However, for the geolocation issue, you could alternatively look into HTML5's geolocation API to solve your problem.
http://dev.w3.org/geo/api/spec-source.html
Let me know if this helps.
I think the following link will help you with what you're looking to do.
http://www.profoundlogic.com/docs/displ ... pplication
It seems you are trying to use a webview inside an android application created with phonegap to access your external profound UI application. However, you can create a native android application with profound ui through phonegap, as the example shows.
However, for the geolocation issue, you could alternatively look into HTML5's geolocation API to solve your problem.
http://dev.w3.org/geo/api/spec-source.html
Let me know if this helps.
Who is online
Users browsing this forum: Bing [Bot] and 7 guests