Enable or Disable LiveSync Programmatically

For hybrid mobile apps, developed with Apache Cordova, AppBuilder exposes a LiveSync JavaScript API which lets you work with the LiveSync three-finger refresh gesture from your code.

With the window.livesync object and its methods, you can control LiveSync programmatically for the developer app and for application packages built with the Debug build configuration. This way, you can implement and test different functionality for the three-finger tap and hold gesture in your apps.

The LiveSync JavaScript API provides the following methods for configuring LiveSync programmatically.

  • enable() - Enables LiveSync with the three-finger refresh gesture.
  • disable() - Disables LiveSync with the three-finger refresh gesture.

Limitations

  • The LiveSync JavaScript API controls only LiveSync with the three-finger refresh gesture.
  • You can use the LiveSync JavaScript API to control LiveSync with the three-finger refresh gesture in the following cases.
    • When you build for the developer app.
    • When you build with the Debug build configuration.
  • The LiveSync JavaScript API works only for hybrid mobile apps developed with Apache Cordova.

Enable LiveSync

By default, in the developer app and in application packages built with the Debug build configuration, LiveSync with the three-finger refresh gesture is always enabled. If you have disabled it programmatically, you can enable it using window.livesync.enable().

Disable LiveSync

If you want to disable LiveSync with the three-finger refresh gesture in the developer app or for your application package built with the Debug build configuration, use window.livesync.disable().

If you want to disable it for the entire application, execute this method in your onDeviceReady.

onDeviceReady: function() {
        app.receivedEvent('deviceready');
        navigator.splashscreen.hide();
        livesync.disable();
    },

When the LiveSync three-finger refresh gesture is disabled programmatically, you can still force LiveSync to get your latest changes from the cloud. See LiveSync your changes programmatically for more information.

LiveSync JavaScript API Sample

For a complete sample that shows how to use the LiveSync JavaScript API, visit sample-livesync.

Next Steps

LiveSync your changes programmatically or using the three-finger refresh gesture.

See Also

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.