Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

NativeScript and the Backend Services JavaScript SDK

In NativeScript apps, you can use the Backend Services JavaScript SDK to connect to the Telerik Platform backend services.

In this article:

Integrating in a NativeScript Core Application

When building your app with NativeScript Core which only uses JavaScript, you can choose to integrate the SDK either by installing an npm package or downloading a ZIP file.

  1. Source the Backend Services JavaScript SDK as explained in Getting Started with the JavaScript SDK.
  2. Require the Backend Services JavaScript SDK.

    // If installed as an npm package
    var Everlive = require('everlive-sdk');
    
    // If downloaded in the project's app folder
    var Everlive = require('./everlive/min/everlive.all.min');
    
  3. Initialize the Backend Services JavaScript SDK to start using it.

    var el = new Everlive({
        appId: 'your-app-id',
        scheme: 'https'
    });
    

Integrating in a NativeScript and Angular Application

In NativeScript applications based on Angular which use TypeScript, the following code imports and initializes the Backend Services JavaScript SDK. It exports a class called BackendService, an instance of which you can use to access the SDK features. Optionally, you can create a member called query() for easier access to the SDK Query class.

import { Injectable } from '@angular/core';
import Everlive from 'everlive-sdk';

@Injectable()
export class BackendService {
    private _everlive: Everlive;

    constructor() {
        const options = {
            appId: 'your-app-id',
            scheme: 'https'
        }

        this._everlive = new Everlive(options);
    }

    get instance() {
        return this._everlive;
    }

    // Optional
    get query() {
        return new Everlive.Query();
    }
}

Also take into account the information in Using TypeScript Definitions. Not referencing the definitions properly may lead to a compile error.

Specifics

Using the Backend Services JavaScript SDK in a NativeScript app has the following limitations:

  • File upload—supported only in base64 format. For more details see the following documentation article: Upload Files in base64 Format.
  • Kendo UI—the Kendo UI section is irrelevant to NativeScript applications.
  • You need the Push Plugin for NativeScript to enable push notifications.

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.