I tried the demo in typescript which ran perfectly.
then I tried to run the plugin in javascript. But the page I put the code freezes every time. Everyting else runs smooth. I scheduled recursive notification. I get the permission alert in IOS and also get the recursive notification every moment.
What I have done?
tns plugin add nativescript-local-notifications
then on my start-page.js
var LocalNotifications=require ("nativescript-local-notifications");
LocalNotifications.schedule([{
id: 1, // generated id if not set
title: 'The title',
body: 'Recurs every minute until cancelled',
ticker: 'The ticker',
//color: new Color("red"),
badge: 1,
groupedMessages:["The first", "Second", "Keep going", "one more..", "OK Stop"], //android only
groupSummary:"Summary of the grouped messages above", //android only
ongoing: true, // makes the notification ongoing (Android only)
icon: 'res://heart',
image: "https://cdn-images-1.medium.com/max/1200/1*c3cQvYJrVezv_Az0CoDcbA.jpeg",
thumbnail: true,
interval: 'minute',
channel: 'My Channel', // default: 'Channel'
sound: "customsound-ios.wav", // falls back to the default sound on Android
at: new Date(new Date().getTime() + (10 * 1000)) // 10 seconds from now
}]).then(
function(scheduledIds) {
console.log("Notification id(s) scheduled: " + JSON.stringify(scheduledIds));
},
function(error) {
console.log("scheduling error: " + error);
}
)
function onLoaded () {
LocalNotifications.schedule ();
}
So when start-page loads I want to schedule the notification. But when I use
var LocalNotifications=require ("nativescript-local-notifications");
app crashes and on console I receive that error
JavaScript error:
file:///node_modules/tns-core-modules/ui/builder/builder.js:179:0: JS ERROR Error: Building UI from XML. @app-root.xml:1:1
>undefined is not a function (near '...LocalNotifications.schedule...')
when I use
import { LocalNotifications } from "nativescript-local-notifications";
app run and starts to receive notification as scheduled but my start page freezes. It scrolls up and down but none the tap functions operates. I put the code in different pages to confirm that only the page with the code freezes.
Actually I don't know what happens. Something about typescript-javascript issue? No idea?
As new in coding. I must be something simple that I miss.
I tried the demo in typescript which ran perfectly. then I tried to run the plugin in javascript. But the page I put the code freezes every time. Everyting else runs smooth. I scheduled recursive notification. I get the permission alert in IOS and also get the recursive notification every moment.
What I have done? tns plugin add nativescript-local-notifications
then on my start-page.js
So when start-page loads I want to schedule the notification. But when I use
app crashes and on console I receive that error
when I use
app run and starts to receive notification as scheduled but my start page freezes. It scrolls up and down but none the tap functions operates. I put the code in different pages to confirm that only the page with the code freezes.
Actually I don't know what happens. Something about typescript-javascript issue? No idea? As new in coding. I must be something simple that I miss.
thx in advance