diff options
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/connectbot/service/ConnectionNotifier.java | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/src/org/connectbot/service/ConnectionNotifier.java b/src/org/connectbot/service/ConnectionNotifier.java index ffe2230..d276761 100644 --- a/src/org/connectbot/service/ConnectionNotifier.java +++ b/src/org/connectbot/service/ConnectionNotifier.java @@ -147,26 +147,30 @@ public abstract class ConnectionNotifier { @Override public void showRunningNotification(Service context) { - Object[] setForegroundArgs = new Object[1]; - setForegroundArgs[0] = Boolean.TRUE; - try { - setForeground.invoke(context, setForegroundArgs); - } catch (InvocationTargetException e) { - } catch (IllegalAccessException e) { - } - getNotificationManager(context).notify(ONLINE_NOTIFICATION, newRunningNotification(context)); + if (setForeground != null) { + Object[] setForegroundArgs = new Object[1]; + setForegroundArgs[0] = Boolean.TRUE; + try { + setForeground.invoke(context, setForegroundArgs); + } catch (InvocationTargetException e) { + } catch (IllegalAccessException e) { + } + getNotificationManager(context).notify(ONLINE_NOTIFICATION, newRunningNotification(context)); + } } @Override public void hideRunningNotification(Service context) { - Object[] setForegroundArgs = new Object[1]; - setForegroundArgs[0] = Boolean.FALSE; - try { - setForeground.invoke(context, setForegroundArgs); - } catch (InvocationTargetException e) { - } catch (IllegalAccessException e) { - } - getNotificationManager(context).cancel(ONLINE_NOTIFICATION); + if (setForeground != null) { + Object[] setForegroundArgs = new Object[1]; + setForegroundArgs[0] = Boolean.FALSE; + try { + setForeground.invoke(context, setForegroundArgs); + } catch (InvocationTargetException e) { + } catch (IllegalAccessException e) { + } + getNotificationManager(context).cancel(ONLINE_NOTIFICATION); + } } } |