Works like a charm now.
Many thanks,
Pete
Hi David,
I am having trouble figuring out something that should be very simple I am sure. On starting the app and throughout the app I would like to redirect the user to one of two views depending on whether they are online or offline. On the initial landing view I have the following:
and have confirmed that this variable is getting set to 'true'
I also have the following in the online and offline tabs so that changes to online status are monitored:
This is all working well in order to change the colour of the 'online' icons conditionally but If I add the following code on a view show:
nothing happens. This seems pretty basic but I am stumped as to what I am doing wrong?
Cheers,
Pete
Yes, I do see online or offline but if I am on that view and turn internet connectivity off, it still says online until I somehow interact with the view or leave the view and come back to it.
Hi David,
On some views I need the online indicator icon to reflect the current state in live time so that if they go online or offline, the icon reflects that change while still in the same view. I haven't been able to find a way to get it to 'watch' for that change and change by itself. In the case of your example, the html area value only changes when you come into the view or interact with the view in some manner such as by clicking on another button that fires off any event. Am I missing something?
Thanks guys, looks like a timer is the way to go. Thanks for your help.
Pete
Hi,
Yes, I have that working now. The issue that I am having is for the view to detect in live time if the user goes online or offline while they are on a view. I have it working to set the icon colour when they land on a view but need a little help in 'watching' for an the offline/online event. Right now you need to interact with the view in order for it to change colour.
Pete
Hi, I would like to have an icon in the ios/android app that displays whether the user is currently online or offline and use that information to make certain functionality available, I am assuming that I could conditionally set the style of a font awesome icon to make it coloured or greyed out. Is the global App.Online variable the best thing to use for this in Cordova and would I need to use a watcher on that variable? I am having a hard time getting it to pick up any changes in the online/offline status. I also see the online/offline tabs in the script editor. Would that be a better approach?
Thanks,
Pete
Hi David,
A huge thank you for helping me to get up on my feet with AB. This is working perfectly now and I have the PouchDB/CouchDB stuff working with queries, offline first and live time remote syncing working. These were the two stumbling blocks for me and I think that I am now ready to rock and roll with the new app. I am excited about AB, it is a different paradigm than the development platform than I am used to but I am feeling more comfortable with it every day.
Cheers,
Pete
Hi again,
I see the help file stuff now about ObjectGetProp and working with objects so I think that I can deal with the first issue myself. I could use a hand though in figuring out a troubleshooting approach to figure out why the httpclient is not passing the parameters?
Here is the code for the send button:
Thanks! Pete
Fantastic, the first fix worked! For anybody else working with Tomcat, my working code in the Tomcat web.xml file is now:
The next issue though is that unlike your original example which is returning:
Status: 200
Status text: OK
Response: Array
(
[Name] => John
[LastName] => Doe
)
Array
(
)
My example is returning:
Status: 200
Status text:
Response: [object Object]
If I just enter https://mymarina.online/iPort/REST/dockit/VesselTokenRequest?VesselName=Horizon&VesselCode=1001 into the browser, I get the following return:
{
"VesselToken": "OxkLCA5fGnVBR0ZCAUpH",
"Result": "200 - OK"}
It is perceiving the return to be an object. In my back end, I have control over the named pairs and can return either json or xml. With it set to xml, I am getting the return:
Which raises a second issue, I am finding that the httpclient is not passing the parameters into the rest service. In my server log I can see the request but the two parameters are blank.
So my two questions now are How should I proceed with the format and parsing of the return and How do I resolve the problem with the parameters not being picked up?
?
Thanks for all your help,
Pete
Hi David,
I appreciate that this is beyond the scope of support but I just wondered if you have more experience with Cors than I do which wouldn't be hard because I don't have any.
I have updated the web.xml file to include the information that I gather needs to be added in order to resolve this issue:
I have found a cors test site at http://www.test-cors.org/#?client_method=GET&client_credentials=false&server_url=https%3A%2F%2Fmymarina.online%2FiPort%2FREST%2Fdockit%2FVesselTokenRequest&server_enable=false&server_status=200&server_credentials=false&server_tabs=remote
If you run this page, it seems to me that it is saying that the correct header is exposed and that it should be good to go however, I am still getting the same error in Firefox when I execute the httpclient. I was wondering if you had any ideas on this one?
Cheers,
Pete
Okay thanks. It is a Tomcat server and I see that they have instructions for that so I will give it a go.
Thanks,
Pete
Hi David,
On to next issue now. I am trying to get communications going between my web app and the ab app. I have created a simple test rest service in my web app that takes 'VesselName' and 'VesselCode' as inputs and responds with a json formatted response giving a VesselToken that I want to grab in the AB app.
For example, if I put:
into the browser, it responds with:
I have made some simple modifications to your HttpForm example and have replaced the httpclient url with:
I then modified the Send button code to push the two field values:
However, I get status=-1 and response=null back. Am I missing the boat here? It seems that it should have picked up the VesselToken that was responded?
Pete
Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.