diff --git a/extras/pandroid_event_viewer/AndroidManifest.xml b/extras/pandroid_event_viewer/AndroidManifest.xml
index 5484c4c7c4..701aa8eb2a 100644
--- a/extras/pandroid_event_viewer/AndroidManifest.xml
+++ b/extras/pandroid_event_viewer/AndroidManifest.xml
@@ -79,16 +79,14 @@
android:label="@string/pandroid_event_viewer_str"
android:theme="@android:style/Theme.Dialog" >
-
-
-
-
-
-
+
+
+
+
+
+
+
-
\ No newline at end of file
diff --git a/extras/pandroid_event_viewer/ChangeLog b/extras/pandroid_event_viewer/ChangeLog
index 7825dcaaa5..e4dbbb2114 100644
--- a/extras/pandroid_event_viewer/ChangeLog
+++ b/extras/pandroid_event_viewer/ChangeLog
@@ -1,3 +1,12 @@
+2012-07-05 Santiago Munín
+ * src/pandroid_event_viewer/pandorafms/OnBootLoader.java: New BroadcastReceiver which starts the search new events service after the phone boot.
+ * src/pandroid_event_viewer/pandorafms/Core.java: Little changes.
+ * src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java: On process_notification it doesn't retrieve count_events anymore.
+ * src/pandroid_event_viewer/pandorafms/PandroidEventviewerService.java: Now the launched notification has the correct number of new events.
+ * res/values/strings.xml: Added new entries.
+ * res/values-en/*: Deleted, unnecessary files.
+ * AndroidManifest.xml: Added the new BroadcastReceiver
+
2012-07-03 Santiago Munín
* src/pandroid_event_viewer/pandorafms/IncidentListItem.java: Deleted, not necessary class.
* src/pandroid_event_viewer/pandorafms/IncidentList.java: Deleted, not necessary class.
diff --git a/extras/pandroid_event_viewer/res/values-en/arrays.xml b/extras/pandroid_event_viewer/res/values-en/arrays.xml
deleted file mode 100644
index 22f3e5fd4c..0000000000
--- a/extras/pandroid_event_viewer/res/values-en/arrays.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
-
-
- - All
- - Maintenance
- - Informational
- - Normal
- - Warning
- - Critical
-
-
-
-
- - 30 seconds
- - 1 minute
- - 5 minutes
- - 10 minutes
- - 15 minutes
- - 30 minutes
- - 45 minutes
- - 1 hour
- - 1 hour and 30 minutes
- - 2 hours
- - 3 hours
- - 4 hours
- - 6 hours
- - 8 hours
- - 10 hours
- - 12 hours
- - 24 hours
- - 36 hours
- - 48 hours
-
-
-
-
-
-
-
- - Only new
- - Only validated
- - Only in process
- - Only not validated
-
-
-
-
- - 30 minutes
- - 1 hour
- - 2 hours
- - 3 hours
- - 4 hours
- - 5 hours
- - 8 hours
- - 10 hours
- - 12 hours
- - 1 day
- - 2 days
- - 3 days
- - 4 days
- - 5 days
- - 1 week
- - 2 weeks
- - 1 month
-
-
\ No newline at end of file
diff --git a/extras/pandroid_event_viewer/res/values-en/strings.xml b/extras/pandroid_event_viewer/res/values-en/strings.xml
deleted file mode 100644
index d75d68a894..0000000000
--- a/extras/pandroid_event_viewer/res/values-en/strings.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-
-
-
- Filter
- Event list
-
- main text (value english)
- list (value english)
-
- System
-
- - Empty -
- All
-
- Tags
- Comments
- Group
- Agent name
- Type
- Severity
- Date
- Number Events
- Reset
- Search
- Loading
- Options
- URL
- User
- Password
- Update
- Options
- Refresh
- About
- Load more events
- Empty list events
- Refresh time watcher
- Filter by default
-
- Update configuration successful.
- Update configuration is failed.
- Please set the preferences as the API URL, user and password for your Pandora FMS.
- Pandroid Event Viewer is connecting with PandoraFMS public demo, please change the preferences for your Pandora FMS.
- Update filter sucessful.
- Update filter is failed.
- Validate Event
-
- There are %s events and all in Maintenance state.
- There are %s events and some are in Informational state.
- There are %s events and some are in Normal state.
- There are %s events and some are in Warning state.
- There are %s events and some are in Critical state.
-
- Loading the %s events and all in Maintenance state.
- Loading the %s events and some are in Informational state.
- Loading the %s events and some are in Normal state.
- Loading the %s events and some are in Warning state.
- Loading the %s events and some are in Critical state.
-
- The event validation is successful.
- The event validation is failed.
-
- Status
- Event search
- Oldest event
-
- Licensed under GPLv2
- Developer: Miguel de Dios
-
- Alert recovered
- Alert manually validated
- Going from critical to warning
- Going to critical status
- Going to normal status
- Going to warning
- Alert fired
- Recon server detected a new host
- New agent created
- Unknown type:
- Unknown event
-
- Event validated
- Realtime event viewer for Pandora FMS.
-
diff --git a/extras/pandroid_event_viewer/res/values/strings.xml b/extras/pandroid_event_viewer/res/values/strings.xml
index 675be96970..48bc2ed8e0 100644
--- a/extras/pandroid_event_viewer/res/values/strings.xml
+++ b/extras/pandroid_event_viewer/res/values/strings.xml
@@ -62,11 +62,11 @@
There are %s events and some are in Normal state.
There are %s events and some are in Warning state.
There are %s events and some are in Critical state.
- Loading the %s events and all in Maintenance state.
- Loading the %s events and some are in Informational state.
- Loading the %s events and some are in Normal state.
- Loading the %s events and some are in Warning state.
- Loading the %s events and some are in Critical state.
+ Loading events (all in Maintenance state).
+ Loading events (some are in Informational state).
+ Loading events (some are in Normal state).
+ Loading events (some are in Warning state).
+ Loading events (some are in Critical state).
The event validation is successful.
The event validation is failed.
Status
diff --git a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Core.java b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Core.java
index cd0067d3f8..64f43a7c1a 100644
--- a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Core.java
+++ b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Core.java
@@ -74,6 +74,7 @@ import android.widget.Toast;
*/
public class Core {
private static String TAG = "Core";
+ private static int CONNECTION_TIMEOUT = 10000;
private static Map imgCache = new HashMap();
// Don't use this variable, just call getSocketFactory
private static SSLSocketFactory sslSocketFactory;
@@ -330,6 +331,7 @@ public class Core {
parameters.add(new BasicNameValuePair("apipass", apiPassword));
}
parameters.addAll(additionalParameters);
+ Log.i(TAG, "sent: "+url);
if (url.toLowerCase().contains("https")) {
// Secure connection
return Core.httpsGet(url, parameters);
@@ -347,6 +349,7 @@ public class Core {
entityResponse = response.getEntity();
return_api = Core
.convertStreamToString(entityResponse.getContent());
+ Log.i(TAG, "received: "+ return_api);
return return_api;
}
}
@@ -384,6 +387,7 @@ public class Core {
HttpURLConnection conn = (HttpURLConnection) myFileUrl
.openConnection();
conn.setDoInput(true);
+ conn.setConnectTimeout(CONNECTION_TIMEOUT);
conn.connect();
InputStream is = conn.getInputStream();
Bitmap img = BitmapFactory.decodeStream(is);
@@ -450,6 +454,7 @@ public class Core {
HttpsURLConnection con;
try {
con = (HttpsURLConnection) url.openConnection();
+ con.setConnectTimeout(CONNECTION_TIMEOUT);
con.connect();
con.disconnect();
return true;
@@ -472,6 +477,7 @@ public class Core {
return true;
}
});
+ con.setConnectTimeout(CONNECTION_TIMEOUT);
con.setSSLSocketFactory(getSocketFactory());
con.setDoOutput(true);
con.getInputStream();
@@ -506,6 +512,7 @@ public class Core {
});
con.setSSLSocketFactory(getSocketFactory());
con.setDoOutput(true);
+ con.setConnectTimeout(CONNECTION_TIMEOUT);
String postData = "";
boolean first = true;
for (NameValuePair nameValuePair : parameters) {
diff --git a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/OnBootLoader.java b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/OnBootLoader.java
new file mode 100644
index 0000000000..98a599425f
--- /dev/null
+++ b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/OnBootLoader.java
@@ -0,0 +1,23 @@
+package pandroid_event_viewer.pandorafms;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+/**
+ * This receiver will start the service on phone boot.
+ *
+ * @author Santiago Munín González
+ *
+ */
+public class OnBootLoader extends BroadcastReceiver {
+ private static String TAG = "OnBootLoader";
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.i(TAG, "onReceive: starting service");
+ Core.setFetchFrequency(context);
+ }
+
+}
diff --git a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Options.java b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Options.java
index f614bcb0f0..9ed6d9c2a1 100644
--- a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Options.java
+++ b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Options.java
@@ -32,6 +32,7 @@ import android.media.RingtoneManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
+import android.os.Handler;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
@@ -53,8 +54,10 @@ import android.widget.Toast;
public class Options extends Activity {
private static String TAG = "Options";
private static int RINGTONE_PICK_CODE = 999;
+ private static long DIALOG_TIME = 10000;
private TextView connectionStatus;
private ProgressDialog retrievingCertificate;
+ private CheckCertificateAsyncTask asyncTask;
private Context context;
private PandroidEventviewerActivity object;
@@ -166,8 +169,9 @@ public class Options extends Activity {
try {
retrievingCertificate = ProgressDialog.show(this, "",
"Loading...", true);
- new CheckCertificateAsyncTask()
- .execute(new URL[] { new URL(url) });
+ asyncTask = new CheckCertificateAsyncTask();
+ asyncTask.execute(new URL[] { new URL(url) });
+ removeDialog(DIALOG_TIME, retrievingCertificate);
} catch (MalformedURLException e) {
Toast.makeText(getApplicationContext(), R.string.url_not_valid,
Toast.LENGTH_SHORT).show();
@@ -348,7 +352,7 @@ public class Options extends Activity {
@Override
protected void onPostExecute(Boolean result) {
- retrievingCertificate.dismiss();
+ retrievingCertificate.cancel();
if (!online) {
writeChanges();
} else {
@@ -383,4 +387,23 @@ public class Options extends Activity {
}
}
}
+
+ /**
+ * Removes a dialog after a timeout.
+ *
+ * @param time
+ * @param dialog
+ */
+ public void removeDialog(long time, final ProgressDialog dialog) {
+ Handler handler = new Handler();
+ handler.postDelayed(new Runnable() {
+ public void run() {
+ dialog.dismiss();
+ if (asyncTask.cancel(false)) {
+ Toast.makeText(getApplicationContext(),
+ "Connection timeout", Toast.LENGTH_SHORT).show();
+ }
+ }
+ }, time);
+ }
}
diff --git a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java
index 79190fa2c3..a74ea585c5 100644
--- a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java
+++ b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java
@@ -20,6 +20,7 @@ package pandroid_event_viewer.pandorafms;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -196,66 +197,69 @@ public class PandroidEventviewerActivity extends TabActivity implements
* @param intent
*/
private void process_notification(Intent intent) {
- long count_events = intent.getLongExtra("count_events", 0);
int more_criticity = intent.getIntExtra("more_criticity", -1);
CharSequence text;
- if (count_events > 0) {
- // From the notificy
- switch (more_criticity) {
- case 0:
- text = getString(R.string.loading_events_criticity_0_str)
- .replace("%s", new Long(count_events).toString());
- break;
- case 1:
- text = getString(R.string.loading_events_criticity_1_str)
- .replace("%s", new Long(count_events).toString());
- break;
- case 2:
- text = getString(R.string.loading_events_criticity_2_str)
- .replace("%s", new Long(count_events).toString());
- break;
- case 3:
- text = getString(R.string.loading_events_criticity_3_str)
- .replace("%s", new Long(count_events).toString());
- break;
- case 4:
- text = getString(R.string.loading_events_criticity_4_str)
- .replace("%s", new Long(count_events).toString());
- break;
- default:
- text = getString(R.string.loading_events_criticity_2_str)
- .replace("%s", new Long(count_events).toString());
- break;
- }
+ // From the notification
+ switch (more_criticity) {
+ case 0:
+ text = getString(R.string.loading_events_criticity_0_str);
+ break;
+ case 1:
+ text = getString(R.string.loading_events_criticity_1_str);
+ break;
+ case 2:
+ text = getString(R.string.loading_events_criticity_2_str);
+ break;
+ case 3:
+ text = getString(R.string.loading_events_criticity_3_str);
+ break;
+ case 4:
+ text = getString(R.string.loading_events_criticity_4_str);
+ break;
+ default:
+ text = getString(R.string.loading_events_criticity_2_str);
+ break;
+ }
- Toast toast = Toast.makeText(getApplicationContext(), text,
- Toast.LENGTH_SHORT);
- toast.show();
+ Toast toast = Toast.makeText(getApplicationContext(), text,
+ Toast.LENGTH_SHORT);
+ toast.show();
- // Set the same parameters to extract the events of the
- // notification.
- SharedPreferences preferences = getSharedPreferences(
- getString(R.string.const_string_preferences),
- Activity.MODE_PRIVATE);
- long timestamp_notification = preferences.getLong(
- "previous_filterTimestamp", (new Date().getTime() / 1000));
- Log.i(TAG + " process_notification_timestamp", ""
- + timestamp_notification);
- this.timestamp = timestamp_notification;
- this.agentNameStr = preferences.getString("filterAgentName", "");
- this.id_group = preferences.getInt("filterIDGroup", 0);
- this.severity = preferences.getInt("filterSeverity", -1);
- this.status = preferences.getInt("filterStatus", 3);
- this.eventSearch = preferences.getString("filterEventSearch", "");
+ // Set the same parameters to extract the events of the
+ // notification.
+ SharedPreferences preferences = getSharedPreferences(
+ getString(R.string.const_string_preferences),
+ Activity.MODE_PRIVATE);
+ long timestamp_notification = preferences.getLong("filterTimestamp",
+ (new Date().getTime() / 1000));
+ Log.i(TAG + " process_notification_timestamp", ""
+ + timestamp_notification);
+ this.timestamp = timestamp_notification;
+ this.agentNameStr = preferences.getString("filterAgentName", "");
+ this.id_group = preferences.getInt("filterIDGroup", 0);
+ this.severity = preferences.getInt("filterSeverity", -1);
+ this.status = preferences.getInt("filterStatus", 3);
+ this.eventSearch = preferences.getString("filterEventSearch", "");
- this.getTabHost().setCurrentTab(1);
+ this.getTabHost().setCurrentTab(1);
- this.loadInProgress = true;
- this.getNewListEvents = true;
- this.eventList = new ArrayList();
- executeBackgroundGetEvents(true);
+ this.loadInProgress = true;
+ this.getNewListEvents = true;
+ this.eventList = new ArrayList();
+ executeBackgroundGetEvents(true);
+ Calendar c = Calendar.getInstance();
+ long now = (c.getTimeInMillis() / 1000);
+ SharedPreferences.Editor editorPreferences = preferences.edit();
+ // Save for the next execution
+ editorPreferences.putLong("filterTimestamp", now);
+ // Save the previous for the list.
+ editorPreferences.putLong("previous_filterTimestamp",
+ timestamp_notification);
+ if (editorPreferences.commit()) {
+ Log.i(TAG + " (filter options)",
+ "Configuration changes commited (timestamp)");
}
}
@@ -299,7 +303,7 @@ public class PandroidEventviewerActivity extends TabActivity implements
serializeParams2Api(true));
return_api = return_api.replace("\n", "");
try {
- this.count_events = new Long(return_api).longValue();
+ this.count_events = Long.valueOf(return_api);
} catch (NumberFormatException e) {
Log.e(TAG, e.getMessage());
return;
@@ -350,67 +354,67 @@ public class PandroidEventviewerActivity extends TabActivity implements
String[] items = lines[i].split(";");
EventListItem event = new EventListItem();
- try {
- if (items[0].length() == 0) {
- event.id_event = 0;
- } else {
- event.id_event = Integer.parseInt(items[0]);
- }
- if (items[1].length() == 0) {
- event.id_agent = 0;
- } else {
- event.id_agent = Integer.parseInt(items[1]);
- }
- event.id_user = items[2];
- if (items[3].length() == 0) {
- event.id_group = 0;
- } else {
- event.id_group = Integer.parseInt(items[3]);
- }
- if (items[4].length() == 0) {
- event.status = 0;
- } else {
- event.status = Integer.parseInt(items[4]);
- }
- event.timestamp = items[5];
- event.event = items[6];
- if (items[7].length() == 0) {
- event.utimestamp = 0;
- } else {
- event.utimestamp = Integer.parseInt(items[7]);
- }
- event.event_type = items[8];
- if (items[9].length() == 0) {
- event.id_agentmodule = 0;
- } else {
- event.id_agentmodule = Integer.parseInt(items[9]);
- }
- if (items[10].length() == 0) {
- event.id_alert_am = 0;
- } else {
- event.id_alert_am = Integer.parseInt(items[10]);
- }
- if (items[11].length() == 0) {
- event.criticity = 0;
- } else {
- event.criticity = Integer.parseInt(items[11]);
- }
- event.user_comment = items[12];
- event.tags = items[13];
- event.agent_name = items[14];
- event.group_name = items[15];
- event.group_icon = items[16];
- event.description_event = items[17];
- event.description_image = items[18];
- event.criticity_name = items[19];
- event.criticity_image = items[20];
-
- event.opened = false;
- } catch (NumberFormatException nfe) {
- event.event = getApplication().getString(
- R.string.unknown_event_str);
- launchProblemParsingNotification();
+ try {
+ if (items[0].length() == 0) {
+ event.id_event = 0;
+ } else {
+ event.id_event = Integer.parseInt(items[0]);
}
+ if (items[1].length() == 0) {
+ event.id_agent = 0;
+ } else {
+ event.id_agent = Integer.parseInt(items[1]);
+ }
+ event.id_user = items[2];
+ if (items[3].length() == 0) {
+ event.id_group = 0;
+ } else {
+ event.id_group = Integer.parseInt(items[3]);
+ }
+ if (items[4].length() == 0) {
+ event.status = 0;
+ } else {
+ event.status = Integer.parseInt(items[4]);
+ }
+ event.timestamp = items[5];
+ event.event = items[6];
+ if (items[7].length() == 0) {
+ event.utimestamp = 0;
+ } else {
+ event.utimestamp = Integer.parseInt(items[7]);
+ }
+ event.event_type = items[8];
+ if (items[9].length() == 0) {
+ event.id_agentmodule = 0;
+ } else {
+ event.id_agentmodule = Integer.parseInt(items[9]);
+ }
+ if (items[10].length() == 0) {
+ event.id_alert_am = 0;
+ } else {
+ event.id_alert_am = Integer.parseInt(items[10]);
+ }
+ if (items[11].length() == 0) {
+ event.criticity = 0;
+ } else {
+ event.criticity = Integer.parseInt(items[11]);
+ }
+ event.user_comment = items[12];
+ event.tags = items[13];
+ event.agent_name = items[14];
+ event.group_name = items[15];
+ event.group_icon = items[16];
+ event.description_event = items[17];
+ event.description_image = items[18];
+ event.criticity_name = items[19];
+ event.criticity_image = items[20];
+
+ event.opened = false;
+ } catch (NumberFormatException nfe) {
+ event.event = getApplication().getString(
+ R.string.unknown_event_str);
+ launchProblemParsingNotification();
+ }
this.eventList.add(event);
}
}
diff --git a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/PandroidEventviewerService.java b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/PandroidEventviewerService.java
index b13bb0d0c4..891ff896c8 100644
--- a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/PandroidEventviewerService.java
+++ b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/PandroidEventviewerService.java
@@ -32,6 +32,7 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.IBinder;
@@ -109,13 +110,13 @@ public class PandroidEventviewerService extends IntentService {
Log.i(TAG + " checkNewEvents", return_api);
return_api = return_api.replace("\n", "");
try {
- this.count_events = new Long(return_api).longValue();
+ this.count_events = Long.valueOf(return_api);
} catch (NumberFormatException e) {
Log.e(TAG, e.getMessage());
return;
}
- // Check the event more critical
+ // Check the more critical level
if (this.count_events != 0) {
Log.i(TAG, "There are new events");
parameters = new ArrayList();
@@ -128,8 +129,22 @@ public class PandroidEventviewerService extends IntentService {
serializeParams2Api(context, false, true, true)));
return_api = Core.httpGet(getApplicationContext(), parameters);
return_api = return_api.replace("\n", "");
- this.more_criticity = Integer.valueOf(return_api).intValue();
- notificationEvent(context);
+ try {
+ this.more_criticity = Integer.valueOf(return_api)
+ .intValue();
+ } catch (NumberFormatException e) {
+ Log.e(TAG, e.getMessage());
+ return;
+ }
+ long lastCountEvents = preferences.getLong("last_count_events", 0);
+ // Does not repeat the same notification
+ if (lastCountEvents != count_events) {
+ notificationEvent(context);
+ Editor editor = preferences.edit();
+ editor.putLong("last_count_events", count_events);
+ editor.commit();
+ }
+
} else {
this.more_criticity = -1;
@@ -173,21 +188,6 @@ public class PandroidEventviewerService extends IntentService {
Calendar c = Calendar.getInstance();
long now = (c.getTimeInMillis() / 1000);
long filterTimestamp = preferences.getLong("filterTimestamp", now);
- if (updateTime) {
- SharedPreferences.Editor editorPreferences = preferences.edit();
- // Save for the next execution
- editorPreferences.putLong("filterTimestamp", now);
- // Save the previous for the list.
- editorPreferences.putLong("previous_filterTimestamp",
- filterTimestamp);
- if (editorPreferences.commit()) {
- Log.i(TAG + " (filter options)",
- "Configuration changes commited (timestamp)");
- } else {
- Log.e(TAG + " (filter options)",
- "Configuration changes not commited");
- }
- }
String totalStr = (total) ? "total" : "-1";
if (more_criticity) {
totalStr = "more_criticity";
@@ -231,37 +231,37 @@ public class PandroidEventviewerService extends IntentService {
icon = R.drawable.criticity_0;
tickerText = context.getString(
R.string.notification_criticity_0_str).replace("%s",
- new Long(this.count_events).toString());
+ Long.valueOf(this.count_events).toString());
break;
case 1:
icon = R.drawable.criticity_1;
tickerText = context.getString(
R.string.notification_criticity_1_str).replace("%s",
- new Long(this.count_events).toString());
+ Long.valueOf(this.count_events).toString());
break;
case 2:
icon = R.drawable.criticity_2;
tickerText = context.getString(
R.string.notification_criticity_2_str).replace("%s",
- new Long(this.count_events).toString());
+ Long.valueOf(this.count_events).toString());
break;
case 3:
icon = R.drawable.criticity_3;
tickerText = context.getString(
R.string.notification_criticity_3_str).replace("%s",
- new Long(this.count_events).toString());
+ Long.valueOf(this.count_events).toString());
break;
case 4:
icon = R.drawable.criticity_4;
tickerText = context.getString(
R.string.notification_criticity_4_str).replace("%s",
- new Long(this.count_events).toString());
+ Long.valueOf(this.count_events).toString());
break;
default:
icon = R.drawable.criticity_default;
tickerText = context.getString(
R.string.notification_criticity_2_str).replace("%s",
- new Long(this.count_events).toString());
+ Long.valueOf(this.count_events).toString());
break;
}
@@ -275,7 +275,6 @@ public class PandroidEventviewerService extends IntentService {
if (preferences.getBoolean("vibration", true)) {
Log.d(TAG, "Vibration");
notification.defaults |= Notification.DEFAULT_VIBRATE;
-
} else {
Log.d(TAG, "No vibration");
notification.vibrate = new long[] { 0, 0, 0, 0 };
@@ -300,7 +299,6 @@ public class PandroidEventviewerService extends IntentService {
PandroidEventviewerActivity.class);
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
- notificationIntent.putExtra("count_events", this.count_events);
notificationIntent.putExtra("more_criticity", this.more_criticity);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
@@ -311,7 +309,7 @@ public class PandroidEventviewerService extends IntentService {
notification.setLatestEventInfo(context, title, tickerText,
contentIntent);
- Log.i(TAG, "Launching notification");
+ Log.i(TAG, "Launching notification, number of events: " + count_events);
mNotificationManager.notify(NOTIFICATION_PANDROID_EVENT_VIEWER,
notification);
}