mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 05:39:53 +01:00
Some versions of Android require notifications to have content intents.
This commit is contained in:
@@ -34,7 +34,6 @@ public class BriarActivity extends RoboFragmentActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle state) {
|
public void onCreate(Bundle state) {
|
||||||
super.onCreate(state);
|
super.onCreate(state);
|
||||||
if(LOG.isLoggable(INFO)) LOG.info("Created");
|
|
||||||
if(System.currentTimeMillis() >= EXPIRY_DATE) {
|
if(System.currentTimeMillis() >= EXPIRY_DATE) {
|
||||||
if(LOG.isLoggable(INFO)) LOG.info("Expired");
|
if(LOG.isLoggable(INFO)) LOG.info("Expired");
|
||||||
Intent i = new Intent(this, ExpiredActivity.class);
|
Intent i = new Intent(this, ExpiredActivity.class);
|
||||||
@@ -66,13 +65,13 @@ public class BriarActivity extends RoboFragmentActivity {
|
|||||||
unbindService();
|
unbindService();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void startAndBindService() {
|
private void startAndBindService() {
|
||||||
startService(new Intent(BriarService.class.getName()));
|
startService(new Intent(BriarService.class.getName()));
|
||||||
bound = bindService(new Intent(BriarService.class.getName()),
|
bound = bindService(new Intent(BriarService.class.getName()),
|
||||||
serviceConnection, 0);
|
serviceConnection, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void unbindService() {
|
private void unbindService() {
|
||||||
if(bound) unbindService(serviceConnection);
|
if(bound) unbindService(serviceConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,11 +96,14 @@ public class BriarService extends RoboService {
|
|||||||
b.setSmallIcon(android.R.drawable.stat_notify_error);
|
b.setSmallIcon(android.R.drawable.stat_notify_error);
|
||||||
b.setContentTitle(getText(R.string.startup_failed_notification_title));
|
b.setContentTitle(getText(R.string.startup_failed_notification_title));
|
||||||
b.setContentText(getText(R.string.startup_failed_notification_text));
|
b.setContentText(getText(R.string.startup_failed_notification_text));
|
||||||
|
Intent i = new Intent(this, HomeScreenActivity.class);
|
||||||
|
i.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
b.setContentIntent(PendingIntent.getActivity(this, 0, i, 0));
|
||||||
Object o = getSystemService(Context.NOTIFICATION_SERVICE);
|
Object o = getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
NotificationManager nm = (NotificationManager) o;
|
NotificationManager nm = (NotificationManager) o;
|
||||||
nm.notify(FAILURE_NOTIFICATION_ID, b.build());
|
nm.notify(FAILURE_NOTIFICATION_ID, b.build());
|
||||||
// Bring HomeScreenActivity to the front to clear all other activities
|
// Bring HomeScreenActivity to the front to clear all other activities
|
||||||
Intent i = new Intent(this, HomeScreenActivity.class);
|
i = new Intent(this, HomeScreenActivity.class);
|
||||||
i.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TOP);
|
i.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
i.putExtra("briar.STARTUP_FAILED", true);
|
i.putExtra("briar.STARTUP_FAILED", true);
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
|
|||||||
Reference in New Issue
Block a user