Location

In order to handle user location in app, app.location event will be used. It can have some entry argument for manipulating the location easily.

app.location.onChanged()

  • Type: Function

    app.location.onChanged = function (longitude, latitude, altitude, accuracy) {};

  • Detail

    The app.location.onChanged is for handle user location when it changed. It has four entry arguments for manipulating location.

    Parameters Type Description
    longitude Number This is the measurement east or west of the prime meridian of user device.
    latitude Number This is the measurement of distance north or south of the Equator of user.
    altitude Number This is the distance above sea level of user.
    accuracy Number This is the degree to which information on a map matches real-world values of user.

    This entry values comes from user device and in this event can be handle, if it was neede.

  • Example
    Saving user location on location change configuration inside the app.js:
    // on location changed event
    app.location.onChanged = function (longitude, latitude, altitude, accuracy) {
        var geolocation = {
            lng: longitude,
            lat: latitude,
            updatedAt: app.now()
        };
        ref.child('geolocations').push(geolocation, function (error) {
            if (error)
                console.error('push geolocations was failed', error);
        });
    };