Git Product home page Git Product logo

sample-push-plugin's Introduction

Telerik Push Notifications Plugin for NativeScript Sample App

Overview

You need to enable the Telerik Push Plugin for NativeScript when building NativeScript apps in Telerik Platform if you want them to support push notifications.

This sample app shows how to build an app using the plugin.

Requirements

  • An active Telerik Platform account Ensure that you can log in to a Telerik Platform account. This can be a free trial account. To send a notification to a subset of users you will need a subscription plan that supports "Push to Segment".
  • A new or existing Telerik Platform app in your account.

Configuration

You need to perform several settings before you can run the app. The configurations steps depend on the platform on which you will be running it.

Android

Take these steps to run the app on Android:

  1. Ensure that you have configured your app for push notifications as described in Enabling Push Notifications.

  2. Go to the sample app's app folder.

  3. Install dependencies using this command:

    tns install
    
  4. Open main-view-model.js and set your account settings:

    • Set your Telerik Platform App ID to the apiKey key:

       self.everlive = new Everlive('<ENTER_YOUR_API_KEY_HERE>');
      
    • Set your Google project number:

       projectNumber: '<ENTER_YOUR_PROJECT_NUMBER>'
      
    • (Optional) If your Telerik Platform subscription does not support calls over HTTPS, set the scheme of the Everlive constructor to http.

iOS

Take these steps to run the app on iOS:

  1. Ensure that you have configured your app for push notifications as described in Enabling Push Notifications.

  2. Go to the sample app's app folder.

  3. Install dependencies using this command:

    tns install
    
  4. Open main-view-model.js and set your Telerik Platform App ID to the apiKey key:

     ```
     self.everlive = new Everlive('<ENTER_YOUR_API_KEY_HERE>');
     ```
    
  5. Set the correct bundle ID in package.json at the root level of the NativeScript project. The ID must match the the value Apple App ID value.

    	"nativescript": {
    		"id": "com.telerik.PushNotificationApp",
    		...
    	}

iOS App Transport Security

With the launch of iOS 9, the default setting for all iOS apps is to mandate a secure HTTP connection for outgoing requests. This sample app is configured to use SSL encryption when communicating with the Telerik Platform API to manage the device registration.

If your Telerik Platform subscription does not allow for encrypted connections or for testing purposes, you may need to register an exception for the Telerik Platform notifications API URL (api.everlive.com).

To do this:

  1. Open main-view-model.js and set the scheme of the Everlive constructor to http.
  2. Add the following keys and values to the <myapp>-info.plist file containing the information property list of the generated Xcode project:
<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>api.everlive.com</key>
    <dict>
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
  </dict>
  </dict>
</dict>

Running the Sample

Take these steps to run the sample app:

  1. Execute the following NativeScript CLI command:

    • On an iOS device:

       tns run ios
      
    • On an Android device:

       tns run android
      
  2. On the device, click Register to register the device with Telerik Platform.

  3. Start sending push notifications from your Telerik Platform account.

sample-push-plugin's People

Contributors

antondobrev avatar gprodanov avatar alexanderfilipov avatar yyosifov avatar atanasovg avatar r0bot avatar dtopuzov avatar

Watchers

James Cloos avatar Dauzy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.