Cordova-plugin-local-notifications: App crash when notification is launched

Created on 30 Sep 2019  路  8Comments  路  Source: katzer/cordova-plugin-local-notifications

install the plugin and try to launch a notification with a button, but the application closes, I have installed the geolocation-background plugin , it will be a problem of compatibility of plugins?

apparently it is an ionic update error, create a blank project and install and configure the plugin and re-crashe the app.

Your Environment

  • Plugin version: 0.9.0-beta.2
  • Platform: android
  • OS version:
  • Device manufacturer / model: Samsung galaxy j7 prime
  • Cordova version (cordova -v): 9.0.0 ([email protected])
  • Cordova platform version (cordova platform ls): android 8.0.0
  • Plugin config: default
  • Ionic Version (if using Ionic): 5.2.7

Expected Behavior

App send notification when button is activated

Actual Behavior

when button is activated app is closed(crashed).

Steps to Reproduce

-in appmodule.ts
import { LocalNotifications } from '@ionic-native/local-notifications/ngx';
...
providers: [
BackgroundGeolocation,
LocalNotifications
...
]

-in home.ts
import { LocalNotifications } from '@ionic-native/local-notifications/ngx';
...
constructor(private backgroundGeolocation: BackgroundGeolocation, public plt: Platform, private localNotifications: LocalNotifications)
...
notificationTest(){
this.localNotifications.schedule({
id: 1,
text: 'Notificacion',
data: { secret: 'secret' }
});
}

Most helpful comment

it worked with this

      cordova.plugins.notification.local.schedule({
        text: 'Delayed ILocalNotification',
        led: 'FF0000',
        smallIcon: 'res://mipmap-ldpi/ic_launcher.png'
      })

All 8 comments

me too, someone can help ?

it worked with this

      cordova.plugins.notification.local.schedule({
        text: 'Delayed ILocalNotification',
        led: 'FF0000',
        smallIcon: 'res://mipmap-ldpi/ic_launcher.png'
      })

What is the android version of the device you tested on?

What is the android version of the device you tested on?

7 > 9.0

What is the android version of the device you tested on?

7 > 9.0

There is a known issue with the cordova local notifications package that causes the app to crash if you don't implicitly stipulate smallIcon

config.xml

<config-file target="AndroidManifest.xml" parent="/manifest">
            <uses-permission android:name="android.permission.WAKE_LOCK"/>
</config-file>

it worked with this

      cordova.plugins.notification.local.schedule({
        text: 'Delayed ILocalNotification',
        led: 'FF0000',
        smallIcon: 'res://mipmap-ldpi/ic_launcher.png'
      })

Thank you. You save my life

Thanks to this thread, it helps after so many month of experiencing the same issue

Was this page helpful?
0 / 5 - 0 ratings