Cordova-plugin-local-notifications: Badge JavaScript Error

Created on 15 Nov 2017  路  3Comments  路  Source: katzer/cordova-plugin-local-notifications

  • Plugin version: 0.9.0-beta.1
  • Platform: Android
  • OS version: 5.0.1
  • Device manufacturer / model: Samsung GT-I9500
  • Cordova version (cordova -v): 7.1.0
  • Cordova platform version (cordova platform ls): android 6.3.0 - ios 4.5.3
  • Plugin config
function nextweek(){
     var today = new Date();
     var nextweek = new Date(today.getFullYear(), today.getMonth(), today.getDate()+7);
     return nextweek;
}

var SonrakiHafta = nextweek();

cordova.plugins.notification.local.schedule({
            id: 1,
            title: "Irregular Verbs",
            text: "Learn with images now!",
            sound: "file://sound/notify.mp3",
            color: 'FF0000',
            at: SonrakiHafta,
            every: 'week'
});

Expected Behavior

Local notification should be sent when the set time is reached.

Actual Behavior

I get the error below:

TypeError: Object.assign is not a function at Object.exports.mergeConfig (/android_asset/www/plugins/cordova-plugin-badge/www/badge.js:158:19) at Object.<anonymous> (/android_asset/www/plugins/cordova-plugin-badge/www/badge.js:215:14) at None (/android_asset/www/plugins/cordova-plugin-badge/www/badge.js:174:20) at Object.cordova.callbackFromNative (/android_asset/www/cordova.js:294:58)

Steps to Reproduce

  1. Set a near time.
  2. And wait.

Most helpful comment

@faytekin That tickets belongs to my cordova-plugin-badge. However this plugin also uses Object.assign function.


Your Android version is not supported. Sorry but 0.9-beta requires at least Android 6 as target and Android 8 SDK for compilation.

All 3 comments

@faytekin That tickets belongs to my cordova-plugin-badge. However this plugin also uses Object.assign function.


Your Android version is not supported. Sorry but 0.9-beta requires at least Android 6 as target and Android 8 SDK for compilation.

Hi,

may I ask for a slightly more elaborated answer? Does the 0.9.0-beta.1 plugin not work on Android 6 or lower? Do you have an idea, how to make notifications work on older and newer Android versions? That would be really helpful! I'm trying to port my native app to cordova, but if I won't be able to get notifications to work, it will be a waste of time.

I get a similar error (see below) on:

Plugin version: 0.9.0-beta.1; Platform: Android; OS version: 6.0.1
Device manufacturer / model: Xiaomi Mi-4c; Cordova version (-v): 8.0.0
build.gradle shows: defaultCompileSdkVersion=26; cordova defaultTargetSdkVersion=26

Error in Success callbackId: Badge568134687 : TypeError: Object.assign is not a function
plugins/cordova-plugin-badge/www/badge.js:158 Uncaught (in promise) TypeError: Object.assign is not a function
at Object.exports.mergeConfig (file:///android_asset/www/plugins/cordova-plugin-badge/www/badge.js:158:19)
at Object. (file:///android_asset/www/plugins/cordova-plugin-badge/www/badge.js:215:14)
at file:///android_asset/www/plugins/cordova-plugin-badge/www/badge.js:174:20
at Object.cordova.callbackFromNative (file:///android_asset/www/cordova.js:291:58)
at processMessage (file:///android_asset/www/cordova.js:1114:17)
at processMessages (file:///android_asset/www/cordova.js:1137:9)

and

Uncaught TypeError: Array.from is not a functionexports.toArray @ local-notification-util.js:370fn @ local-notification-core.js:65(anonymous function) @ local-notification-util.js:321cordova.callbackFromNative @ cordova.js:291(anonymous function) @ VM51:1

I've added a polyfill for Object.assign

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bhumin3i picture bhumin3i  路  5Comments

daniele-sartiano picture daniele-sartiano  路  4Comments

luca-itro picture luca-itro  路  5Comments

AbayIbrayev picture AbayIbrayev  路  4Comments

tverilytt picture tverilytt  路  4Comments