|
|
@@ -28,8 +28,7 @@ import org.json.JSONException;
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
-import android.app.Notification;
|
|
|
-import android.support.v4.app.*;
|
|
|
+import android.support.v4.app.NotificationCompat;
|
|
|
import android.support.v4.app.NotificationCompat.*;
|
|
|
import android.app.NotificationManager;
|
|
|
import android.app.PendingIntent;
|
|
|
@@ -118,29 +117,29 @@ public class Receiver extends BroadcastReceiver {
|
|
|
* Creates the notification.
|
|
|
*/
|
|
|
@SuppressLint("NewApi")
|
|
|
- private Builder buildNotification () {
|
|
|
+ private Builder buildNotification () {
|
|
|
Bitmap icon = BitmapFactory.decodeResource(context.getResources(), options.getIcon());
|
|
|
Uri sound = options.getSound();
|
|
|
|
|
|
Builder notification = new NotificationCompat.Builder(context)
|
|
|
- .setContentTitle(options.getTitle())
|
|
|
- .setContentText(options.getMessage())
|
|
|
- .setNumber(options.getBadge())
|
|
|
- .setTicker(options.getMessage())
|
|
|
- .setSmallIcon(options.getSmallIcon())
|
|
|
- .setLargeIcon(icon)
|
|
|
- .setAutoCancel(options.getAutoCancel())
|
|
|
- .setOngoing(options.getOngoing());
|
|
|
-
|
|
|
+ .setContentTitle(options.getTitle())
|
|
|
+ .setContentText(options.getMessage())
|
|
|
+ .setNumber(options.getBadge())
|
|
|
+ .setTicker(options.getMessage())
|
|
|
+ .setSmallIcon(options.getSmallIcon())
|
|
|
+ .setLargeIcon(icon)
|
|
|
+ .setAutoCancel(options.getAutoCancel())
|
|
|
+ .setOngoing(options.getOngoing());
|
|
|
+
|
|
|
if (sound != null) {
|
|
|
- notification.setSound(sound);
|
|
|
+ notification.setSound(sound);
|
|
|
}
|
|
|
|
|
|
if (Build.VERSION.SDK_INT > 16) {
|
|
|
- notification.setStyle(new NotificationCompat.BigTextStyle()
|
|
|
- .bigText(options.getMessage()));
|
|
|
+ notification.setStyle(new NotificationCompat.BigTextStyle()
|
|
|
+ .bigText(options.getMessage()));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
setClickEvent(notification);
|
|
|
|
|
|
return notification;
|