private void addNotification()
{
mShowNotification = true;
- startForeground(VPN_STATE_NOTIFICATION_ID, buildNotification());
+ startForeground(VPN_STATE_NOTIFICATION_ID, buildNotification(false));
}
/**
stopForeground(true);
}
-
/**
* Build a notification matching the current state
*/
- private Notification buildNotification()
+ private Notification buildNotification(boolean publicVersion)
{
VpnProfile profile = mService.getProfile();
State state = mService.getState();
name = profile.getName();
}
android.support.v4.app.NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
- .setContentText(name)
.setSmallIcon(R.drawable.ic_notification)
.setCategory(NotificationCompat.CATEGORY_SERVICE)
- .setVisibility(NotificationCompat.VISIBILITY_SECRET);
+ .setVisibility(publicVersion ? NotificationCompat.VISIBILITY_PUBLIC
+ : NotificationCompat.VISIBILITY_PRIVATE);
int s = R.string.state_disabled;
if (error != ErrorState.NO_ERROR)
{
}
}
builder.setContentTitle(getString(s));
+ if (!publicVersion)
+ {
+ builder.setContentText(name);
+ builder.setPublicVersion(buildNotification(true));
+ }
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
PendingIntent pending = PendingIntent.getActivity(getApplicationContext(), 0, intent,
if (mShowNotification)
{
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
- manager.notify(VPN_STATE_NOTIFICATION_ID, buildNotification());
+ manager.notify(VPN_STATE_NOTIFICATION_ID, buildNotification(false));
}
}