runnable.run();
} catch (final Exception ex){
ex.printStackTrace();
+ break;
}
Log.d("LongPollRunnable", "Long polling stopped");
}
* Broadcast action: remove an ongoing event
*/
public static final String ACTION_DELETE_ONGOING="ro.ieval.fonbot.FonBotMainService.ACTION_DELETE_ONGOING";
- /** Broadcast action: trigger a server poll */
- public static final String ACTION_TRIGGER_POLL="ro.ieval.fonbot.FonBotMainService.ACTION_TRIGGER_POLL";
+
/**
* Extra: ongoing event id
*
@Override
public int onStartCommand(final @Nullable Intent intent, final int flags, final int startId) {
+ final boolean showOngoing=PreferenceManager.getDefaultSharedPreferences(this).getBoolean("ongoing", false);
boolean updateNotification = false;
- if(intent!=null && intent.getAction()==ACTION_PUT_ONGOING && intent.hasExtra(EXTRA_ONGOING_ID)){
+ if(intent!=null && intent.getAction()==ACTION_PUT_ONGOING && intent.hasExtra(EXTRA_ONGOING_ID) && showOngoing){
ongoing.add(OngoingEvent.values()[intent.getIntExtra(EXTRA_ONGOING_ID, 0)]);
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(ACTION_ONGOING_UPDATE));
updateNotification=true;
}
- if(intent!=null && intent.getAction()==ACTION_DELETE_ONGOING && intent.hasExtra(EXTRA_ONGOING_ID)){
+ if(intent!=null && intent.getAction()==ACTION_DELETE_ONGOING && intent.hasExtra(EXTRA_ONGOING_ID) && showOngoing){
ongoing.remove(OngoingEvent.values()[intent.getIntExtra(EXTRA_ONGOING_ID, 0)]);
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(ACTION_ONGOING_UPDATE));
updateNotification=true;
setContentIntent(PendingIntent.getActivity(this, 0, mainIntent, 0)).
setOngoing(true);
- if(!ongoing.isEmpty()) {
+ if(showOngoing && !ongoing.isEmpty()) {
final NotificationCompat.InboxStyle inboxBuilder=new NotificationCompat.InboxStyle(builder);
for(final OngoingEvent event : ongoing)