All Projects → EddyVerbruggen → nativescript-pushy

EddyVerbruggen / nativescript-pushy

Licence: Apache-2.0 license
Easy push notifications for your NativeScript app!

Programming Languages

typescript
32286 projects
shell
77523 projects
javascript
184084 projects - #8 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to nativescript-pushy

nativescript-printer
📠 Send an image or the screen contents to a physical printer
Stars: ✭ 33 (+73.68%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-app-icon-changer
Change the homescreen icon of your NativeScript iOS app at runtime!
Stars: ✭ 16 (-15.79%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-vue-multi-drawer
A NativeScript-Vue component for creating multiple side drawers (4 sides supported)
Stars: ✭ 45 (+136.84%)
Mutual labels:  nativescript, nativescript-plugin
ui
Add right-to-left support to the NativeScript framework
Stars: ✭ 22 (+15.79%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-store-update
No description or website provided.
Stars: ✭ 18 (-5.26%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-http
The best way to do HTTP requests in NativeScript, a drop-in replacement for the core HTTP with important improvements and additions like proper connection pooling, form data support and certificate pinning
Stars: ✭ 32 (+68.42%)
Mutual labels:  nativescript, nativescript-plugin
texttospeech
Text to Speech NativeScript plugin for Android & iOS 📢
Stars: ✭ 44 (+131.58%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-appversion
🔢 NativeScript plugin to retrieve your app's package ID and current version
Stars: ✭ 47 (+147.37%)
Mutual labels:  nativescript, nativescript-plugin
Push Plugin
Contains the source code for the Push Plugin.
Stars: ✭ 122 (+542.11%)
Mutual labels:  push-notifications, nativescript
Nativescript Vue
Native mobile applications using Vue and NativeScript.
Stars: ✭ 4,784 (+25078.95%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-fabric
Handling App URLs in nativescript apps
Stars: ✭ 29 (+52.63%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-image-filters
NativeScript plugin to apply filters to images
Stars: ✭ 30 (+57.89%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-app-shortcuts
👇 Home Icon Actions for your NativeScript app, now also for Android!
Stars: ✭ 45 (+136.84%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-performance-monitor
⚡ Proof your app maintains 60-ish FPS by collecting data or showing it on screen with this NativeScript plugin!
Stars: ✭ 21 (+10.53%)
Mutual labels:  nativescript, nativescript-plugin
insomnia
😪 NativeScript plugin to keep the device awake (not dim the screen, lock, etc)
Stars: ✭ 40 (+110.53%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-menu
A plugin that adds a pop-up menu to NativeScript
Stars: ✭ 17 (-10.53%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-star-printer
🌟 Print directly to Star Micronics printers from your NativeScript app! http://www.starmicronics.com/
Stars: ✭ 28 (+47.37%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-drawingpad
📝 NativeScript plugin to provide a way to capture any drawing (signatures are a common use case) from the device
Stars: ✭ 89 (+368.42%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-homekit
🏡 HomeKit plugin for your fancy NativeScript app
Stars: ✭ 23 (+21.05%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-ng-shadow
Angular directive to apply shadows to native elements according to the elevation level guidelines of material design specification
Stars: ✭ 54 (+184.21%)
Mutual labels:  nativescript, nativescript-plugin

NativeScript Pushy

Build Status NPM version Downloads Twitter Follow

Hop on over to Pushy.me to get started!

Installation

tns plugin add nativescript-pushy

For {N} 5 and below please use

tns plugin add [email protected]

Demo app

Check the source in the demo folder, or run it on your own device:

git clone https://github.com/EddyVerbruggen/nativescript-pushy
cd nativescript-pushy/src
npm i
npm run demo.ios # or demo.android

Setup (iOS only)

Create a file called either app.entitlements or <YourAppName>.entitlements (where YourAppName is identical to the folder name of platforms/ios/YourAppName). Here's an example.

Now reference that file from build.xcconfig as shown here.

API

getDevicePushToken

import { getDevicePushToken } from "nativescript-pushy";

getDevicePushToken()
    .then(token => console.log(`getDevicePushToken success, token: ${token}`))
    .catch(err => console.log(`getDevicePushToken error: ${err}`));

setNotificationHandler

Since plugin version 1.1.0 the entire payload of the notification is copied to the object this handler receives, but note that it all gets copied into a data object. So if you send for instance {"foo": "bar"}, you can find the value "bar" at notification.data.foo.

import { setNotificationHandler } from "nativescript-pushy";

setNotificationHandler(notification => {
  console.log(`Notification received: ${JSON.stringify(notification)}`);
});

One of the properties of the returned notification object is foreground, which indicates whether or not the notification was received while the app was in either the foreground or background.

Another useful property may be appLaunchedByNotification, which indicates whether or not the app was launched by tapping the notification (as opposed to the app's icon). When this property is true you may want to fi. navigate to a different route in your app.

Please note..

⚠️ Do not test on a the iOS simulator as it can't receive push notifications.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].