Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
initPushNotification() {
if (!this.platform.is('cordova')) {
console.warn("Push notifications not initialized. Cordova is not available - Run in physical device");
return;
}
Backendless.setupDevice({
uuid: Device.uuid,
platform: Device.platform,
version: Device.version
});
let push = Push.init({
android: {
senderID: "YOUR_SENDER_ID"
},
ios: {
alert: "true",
badge: false,
sound: "true"
},
windows: {}
});
push.on('registration', (data) => {
ready() {
console.log('Device from app: ', Device);
this.version = Device.version;
this.deviceModel = Device.model;
this.dplatform = Device.platform;
AppVersion.getVersionNumber().then((value) => {
this.appVersion = value;
console.log(value);
}, (error) => {
console.error(error);
})
AppVersion.getPackageName().then((value) => {
this.appPackageName = value;
console.log(value);
}, (error) => {
console.error(error);
})
AppVersion.getAppName().then((value) => {
previewAlert(url) {
if( Device.platform != 'iOS' && Device.platform != 'Android' && url.indexOf('http://') >= 0 ) {
alert('Cannot display http pages in browser preview. Please build app for device or use https.');
}
}
getDeviceInfo() {
this.deviceInfo = {
uuid: Device.uuid,
cordova: Device.cordova,
model: Device.model,
platform: Device.platform,
version: Device.version,
manufacturer: Device.manufacturer,
isVirtual: Device.isVirtual,
serial: Device.serial
};
return this.deviceInfo;
}