Syncing forever

Discussions regarding developing applications using Servoy Mobile (new in Servoy 7)

Syncing forever

Postby irene.meyer1422261887 » Mon Mar 07, 2016 5:52 pm

Hi,

I'm building my first mobile app. I followed faithfully the servoy mobile sample.

When I try to login via Firefox he syncs forever and doesn't move to the first form. Chrome and Safari don't even show the login form, they go directly to the first form without any data.

When I debug the service solution I don't get any errors and the variables seem ok.

Can someone point me in the right direction please?

Cheers
Irene
User avatar
irene.meyer1422261887
 
Posts: 34
Joined: Mon Jan 26, 2015 10:44 am

Re: Syncing forever

Postby paronne » Mon Mar 07, 2016 6:17 pm

Hi,

as i understand the service solution is actually being called since you are able to debug it.
You can check the server http log to seee if all request were successful or if you had any failure.
Also have you checked if you get any error in browser console ? You can do so by inspecting the browser. From the browser inspector you should be able also to see the http request executed between client and server and see if any of those was not successful. If you are not familiar with the browser inspector for Firefox you can try with the inspector of Chrome, i think is more intuitive to use compare to Mozilla.

Paolo
paronne
 
Posts: 85
Joined: Fri Nov 02, 2012 3:21 pm

Re: Syncing forever

Postby irene.meyer1422261887 » Mon Mar 07, 2016 7:50 pm

Hi Paolo,

Thanks for the quick reply.

I checked the logs.
I found an error in the console of Chrome but I doubt that that is a big issue:
GET http://www.servoy.com/img/servoymobile.gif net::ERR_INCOMPLETE_CHUNKED_ENCODING

Chrome and doesn't even launch the login form it goes directly to an empty page and the debugger in the service solution doesn't start.

Firefox does start the login form and the service solution can be debugged. The console shows an error:

(-:-) 2016-03-07 18:07:55,152 [FATAL] Uncaught Exception:
com.google.gwt.core.client.JavaScriptException: (TypeError)
__gwt$exception: <skipped>: src_0 is undefined
at Unknown.isJavaObject(Unknown Source)
at Unknown.toString__devirtual$(Unknown Source)
at Unknown.$getRowDataPkAndKey(Unknown Source)
at Unknown.$storeRowData_0(Unknown Source)
at Unknown.$storeRowData(Unknown Source)
at Unknown.onResponseReceived_1(Unknown Source)
at Unknown.$fireOnResponseReceived(Unknown Source)
at Unknown.onReadyStateChange(Unknown Source)
at Unknown.$setOnReadyStateChange/this$static.onreadystatechange<(Unknown Source)
at Unknown.apply_0(Unknown Source)
at Unknown.entry0(Unknown Source)
at Unknown.entry_0/<(Unknown Source)
at Unknown.anonymous(Unknown Source)


I turned on the tracing in the server administration but there is no issue.

I tried withe the sample mobile solution ant it works well, so it has to be me but I have no idea where to look.

I turned off "must authenticate" and Firefox shows the data in the first form but chrome is blank.

Irene
User avatar
irene.meyer1422261887
 
Posts: 34
Joined: Mon Jan 26, 2015 10:44 am

Re: Syncing forever

Postby paronne » Mon Mar 07, 2016 8:06 pm

Hi Irene,

Chrome may not show the login form since it may think that you are already logged in (login is kept in Browser localstorage). You can run your mobile client in Incognito mode, is the best solution to avoid caching issues.
I can't be certain of the type of error but it may be that you are returning something wrong from the service solution.
You must include each foundset you need on your mobile client into the retval of the offilne_data ws_read. Related foundset are automatically traversed if the relation object is defined in the mobile shared solution.

Code: Select all
    //create return value
    var retval = plugins.mobileservice.createOfflineDataDescription('data_')
    var fs = databaseManager.getFoundset(yourDataSource)
    fs.loadAllRecords() // or search for record if you want to filter
    retval.addFoundset(fs)

    var fs2 = databaseManager.getFoundset("anotherdatasource")
    fs2.loadAllRecords() // or search for record if you want to filter
    retval.addFoundset(fs2)
    return retval


For each foundset added into the retval or each related foundset being traversed you need a data_tablename form which implement ws_read as below

Code: Select all
function ws_read(version, method) {
    var questionParams = arguments[arguments.length-1]
 
    if (method == 'list') {
        /** @type {String} */
        var ids = questionParams.ids[0]
        if (ids != null && ids != '') {
            var idsa = ids.split(',', -1)
            if (idsa.length > 0) {
                var json = plugins.mobileservice.getRowDescriptions(foundset.getDataSource(), idsa)
                return json
            }
        }
    }
 
    throw 404;
}


I suggest to start with a single foundset on the mobile side and start adding other foundset or related foundset incrementally
paronne
 
Posts: 85
Joined: Fri Nov 02, 2012 3:21 pm


Return to Servoy Mobile

Who is online

Users browsing this forum: No registered users and 2 guests