Benachrichtigung

Visueller, akustischer und taktiler Gerätebenachrichtigungen.

Methoden

  • [Notification.Alert](notification.alert.html)
  • [Notification.Confirm](notification.confirm.html)
  • [Notification.prompt](notification.prompt.html)
  • [Notification.Beep](notification.beep.html)
  • [Notification.Vibrate](notification.vibrate.html)

Zugriff auf die Funktion

Ab Version 3.0 implementiert Cordova Geräteebene APIs als Plugins. Verwenden Sie der CLI plugin Befehl, beschrieben in der Command-Line Interface, hinzufügen oder Entfernen dieses Feature für ein Projekt:

    $ cordova plugin add org.apache.cordova.dialogs
    $ cordova plugin add org.apache.cordova.vibration
    $ cordova plugin ls
    [ 'org.apache.cordova.dialogs',
      'org.apache.cordova.vibration' ]
    $ cordova plugin rm org.apache.cordova.dialogs
    $ cordova plugin rm org.apache.cordova.vibration

Diese Befehle gelten für alle Zielplattformen, aber die unten beschriebenen Plattform-spezifische Konfigurationseinstellungen ändern:

  • Android

    (in app/res/xml/config.xml)
    <feature name="Notification">
        <param name="android-package" value="org.apache.cordova.Notification" />
    </feature>
    
    (in app/AndroidManifest.xml)
    <uses-permission android:name="android.permission.VIBRATE" />
    
  • BlackBerry WebWorks

    (in www/plugins.xml)
    <feature name="Notification">
        <param name="blackberry-package" value="org.apache.cordova.notification.Notification" />
    </feature>
    
    (in www/config.xml)
    <feature id="blackberry.ui.dialog" />
    
  • iOS (inconfig.xml)

    <feature name="Notification">
        <param name="ios-package" value="CDVNotification" />
    </feature>
    

Einige Plattformen können dieses Feature unterstützen, ohne dass eine besondere Konfiguration. Finden Sie unter Plattform-Unterstützung in der Übersicht.