Skip to content
Snippets Groups Projects
Commit 76f255b3 authored by Massimiliano's avatar Massimiliano
Browse files

optimized statusService code

parent 358b7ae4
No related merge requests found
......@@ -96,21 +96,25 @@ public class StatusService extends Service {
String stateDate = date.put( "updated", updated );
String dateStored= checkDate.getString( "storeDate","" );
assert dateStored != null;
if (dateStored.equals( "" ))
{
checkDate.edit().putString( "storeDate", stateDate).apply();
//return null;
}
else if (!stateDate.equals( dateStored)&& !stateDate.equals( "" ))//dateStored
{
checkDate.edit().putString( "storeDate", stateDate).apply();
Log.e(TAG, "date: " + dateStored);
Log.e(TAG, "date2: " + stateDate);
sendNotification();//Call notification
return null;
else {
assert stateDate != null;
if (!stateDate.equals( dateStored )&& !stateDate.equals( "" ))//dateStored
{
checkDate.edit().putString( "storeDate", stateDate).apply();
Log.e(TAG, "date: " + dateStored);
Log.e(TAG, "date2: " + stateDate);
sendNotification();//Call notification
return null;
}
else
Log.e(TAG, "updated json(service)");
}
else
Log.e(TAG, "updated json(service)");
return null;
} catch (final JSONException e) {
......@@ -142,6 +146,7 @@ public class StatusService extends Service {
HashMap<String, String> date = new HashMap<>();
date.put("name", name);
date.put("message", message);
getDate.add(date);
Log.e(TAG, "message: " + name);
Intent goState = new Intent( StatusService.this, StateMessagesActivity.class);
......
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