Commit 5c903678 authored by Sebastián Katzer's avatar Sebastián Katzer
Browse files

Fix `sound:null` on Android

parent 87f29b67
Loading
Loading
Loading
Loading
+3 −0
Changes for README.md: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -27,9 +27,11 @@ Through the [Command-line Interface](http://cordova.apache.org/docs/en/3.0.0/gui
```bash
# from master:
cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git
cordova build

# stable version:
cordova plugin add de.appplant.cordova.plugin.local-notification
cordova build
```

## Removing the Plugin from your project
@@ -55,6 +57,7 @@ More informations can be found [here](https://build.phonegap.com/plugins/413).
- [change:] The `oncancel` callback will be called at last if `autoCancel` is set to true (iOS).
- [bugfix:] Callbacks for non-repeating notifications were not called if they were not created in the current app instance on iOS.
- [enhancement:] Added 'secondly' and 'minutely' as new repeat time aliases.
- [bugfix:] `sound:null` didnt work for Android. The default sound was played.

#### Version 0.7.2 (09.02.2014)
- [enhancement:] Avoid blocking the main thread (on Android) **(dpogue)**.
+1 −1
Changes for src/android/Options.java: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ public class Options {
            }
        }

        return RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        return null;
    }

    /**
+5 −1
Changes for src/android/Receiver.java: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ public class Receiver extends BroadcastReceiver {
     */
    private Builder buildNotification () {
        Bitmap icon = BitmapFactory.decodeResource(context.getResources(), options.getIcon());
        Uri sound   = options.getSound();

        Builder notification = new Notification.Builder(context)
            .setContentTitle(options.getTitle())
@@ -125,10 +126,13 @@ public class Receiver extends BroadcastReceiver {
            .setTicker(options.getMessage())
            .setSmallIcon(options.getSmallIcon())
            .setLargeIcon(icon)
        .setSound(options.getSound())
            .setAutoCancel(options.getAutoCancel())
            .setOngoing(options.getOngoing());

        if (sound != null) {
            notification.setSound(sound);
        }

        setClickEvent(notification);

        return notification;