Commit 5c903678 by Sebastián Katzer

Fix `sound:null` on Android

parent 87f29b67
...@@ -27,9 +27,11 @@ Through the [Command-line Interface](http://cordova.apache.org/docs/en/3.0.0/gui ...@@ -27,9 +27,11 @@ Through the [Command-line Interface](http://cordova.apache.org/docs/en/3.0.0/gui
```bash ```bash
# from master: # from master:
cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git
cordova build
# stable version: # stable version:
cordova plugin add de.appplant.cordova.plugin.local-notification cordova plugin add de.appplant.cordova.plugin.local-notification
cordova build
``` ```
## Removing the Plugin from your project ## Removing the Plugin from your project
...@@ -55,6 +57,7 @@ More informations can be found [here](https://build.phonegap.com/plugins/413). ...@@ -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). - [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. - [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. - [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) #### Version 0.7.2 (09.02.2014)
- [enhancement:] Avoid blocking the main thread (on Android) **(dpogue)**. - [enhancement:] Avoid blocking the main thread (on Android) **(dpogue)**.
......
...@@ -147,7 +147,7 @@ public class Options { ...@@ -147,7 +147,7 @@ public class Options {
} }
} }
return RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); return null;
} }
/** /**
......
...@@ -117,17 +117,21 @@ public class Receiver extends BroadcastReceiver { ...@@ -117,17 +117,21 @@ public class Receiver extends BroadcastReceiver {
*/ */
private Builder buildNotification () { private Builder buildNotification () {
Bitmap icon = BitmapFactory.decodeResource(context.getResources(), options.getIcon()); Bitmap icon = BitmapFactory.decodeResource(context.getResources(), options.getIcon());
Uri sound = options.getSound();
Builder notification = new Notification.Builder(context) Builder notification = new Notification.Builder(context)
.setContentTitle(options.getTitle()) .setContentTitle(options.getTitle())
.setContentText(options.getMessage()) .setContentText(options.getMessage())
.setNumber(options.getBadge()) .setNumber(options.getBadge())
.setTicker(options.getMessage()) .setTicker(options.getMessage())
.setSmallIcon(options.getSmallIcon()) .setSmallIcon(options.getSmallIcon())
.setLargeIcon(icon) .setLargeIcon(icon)
.setSound(options.getSound()) .setAutoCancel(options.getAutoCancel())
.setAutoCancel(options.getAutoCancel()) .setOngoing(options.getOngoing());
.setOngoing(options.getOngoing());
if (sound != null) {
notification.setSound(sound);
}
setClickEvent(notification); setClickEvent(notification);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment