Commit 82606aca authored by Rubén Norte's avatar Rubén Norte
Browse files

Sets default notification sound, vibration and lights and removes useless method.

parent 3a400752
Loading
Loading
Loading
Loading
+2 −16
Changes for src/android/com/plugin/gcm/GCMIntentService.java: 2 added lines, 16 removed lines.
Original line number Diff line number Diff line
@@ -9,13 +9,11 @@ import org.json.JSONObject;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
@@ -93,6 +91,7 @@ public class GCMIntentService extends GCMBaseIntentService {
		
		NotificationCompat.Builder mBuilder =
			new NotificationCompat.Builder(context)
				.setDefaults(Notification.DEFAULT_ALL)
				.setSmallIcon(context.getApplicationInfo().icon)
				.setWhen(System.currentTimeMillis())
				.setContentTitle(appName)
@@ -112,19 +111,6 @@ public class GCMIntentService extends GCMBaseIntentService {
		}
		
		mNotificationManager.notify((String) appName, NOTIFICATION_ID, mBuilder.build());
		tryPlayRingtone();
	}

	private void tryPlayRingtone() 
	{
		try {
			Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
			Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
			r.play();
		} 
		catch (Exception e) {
			Log.e(TAG, "failed to play notification ringtone");
		}
	}
	
	public static void cancelNotification(Context context)