|
@@ -14,10 +14,10 @@ import java.util.Calendar;
|
|
|
import org.json.JSONException;
|
|
import org.json.JSONException;
|
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
-import android.R;
|
|
|
|
|
import android.annotation.TargetApi;
|
|
import android.annotation.TargetApi;
|
|
|
import android.app.Notification;
|
|
import android.app.Notification;
|
|
|
import android.app.Notification.Builder;
|
|
import android.app.Notification.Builder;
|
|
|
|
|
+import android.app.Activity;
|
|
|
import android.app.NotificationManager;
|
|
import android.app.NotificationManager;
|
|
|
import android.app.PendingIntent;
|
|
import android.app.PendingIntent;
|
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.BroadcastReceiver;
|
|
@@ -26,6 +26,10 @@ import android.content.Intent;
|
|
|
import android.os.Build;
|
|
import android.os.Build;
|
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
|
|
|
|
|
|
|
|
+class MyActivity extends Activity {
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* The alarm receiver is triggered when a scheduled alarm is fired. This class
|
|
* The alarm receiver is triggered when a scheduled alarm is fired. This class
|
|
|
* reads the information in the intent and displays this information in the
|
|
* reads the information in the intent and displays this information in the
|
|
@@ -69,17 +73,21 @@ public class LocalNotificationReceiver extends BroadcastReceiver {
|
|
|
int currentMin = now.get(Calendar.MINUTE);
|
|
int currentMin = now.get(Calendar.MINUTE);
|
|
|
|
|
|
|
|
if (currentHour != alarmHour && currentMin != alarmMin) {
|
|
if (currentHour != alarmHour && currentMin != alarmMin) {
|
|
|
-
|
|
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ String packageName = context.getPackageName();
|
|
|
|
|
+ Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(packageName);
|
|
|
|
|
+ PendingIntent contentIntent = PendingIntent.getActivity(context, 0, launchIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
+
|
|
|
Builder notification = new Notification.Builder(context)
|
|
Builder notification = new Notification.Builder(context)
|
|
|
.setContentTitle(options.getTitle())
|
|
.setContentTitle(options.getTitle())
|
|
|
.setContentText(options.getSubTitle())
|
|
.setContentText(options.getSubTitle())
|
|
|
//.setVibrate(new long[] { 0, 100, 200, 300 })
|
|
//.setVibrate(new long[] { 0, 100, 200, 300 })
|
|
|
.setDefaults(Notification.DEFAULT_SOUND)
|
|
.setDefaults(Notification.DEFAULT_SOUND)
|
|
|
- .setNumber(0)
|
|
|
|
|
|
|
+ .setNumber(options.getBadge())
|
|
|
|
|
+ .setContentIntent(contentIntent)
|
|
|
.setSmallIcon(options.getIcon());
|
|
.setSmallIcon(options.getIcon());
|
|
|
|
|
|
|
|
/*
|
|
/*
|