Fixed startActivity out of an Activity

This commit is contained in:
PeratX 2017-04-19 21:33:40 +08:00
parent 5fca3e2dd6
commit 4d86ec91cf

View File

@ -54,7 +54,7 @@ public class DaedalusVpnService extends VpnService implements Runnable {
private static final int NOTIFICATION_ACTIVATED = 0; private static final int NOTIFICATION_ACTIVATED = 0;
private static final String TAG = "Daedalus"; private static final String TAG = "DaedalusVpnService";
public static String primaryServer; public static String primaryServer;
public static String secondaryServer; public static String secondaryServer;
@ -169,7 +169,7 @@ public class DaedalusVpnService extends VpnService implements Runnable {
stopSelf(); stopSelf();
if (shouldRefresh && MainActivity.getInstance() != null && MainActivity.getInstance().isAppOnForeground()) { if (shouldRefresh && MainActivity.getInstance() != null && MainActivity.getInstance().isAppOnForeground()) {
startActivity(new Intent(this, MainActivity.class).putExtra(MainActivity.LAUNCH_ACTION, MainActivity.LAUNCH_ACTION_NONE)); MainActivity.getInstance().startActivity(new Intent(this, MainActivity.class).putExtra(MainActivity.LAUNCH_ACTION, MainActivity.LAUNCH_ACTION_NONE));
} else if (shouldRefresh) { } else if (shouldRefresh) {
Daedalus.updateShortcut(this.getApplicationContext()); Daedalus.updateShortcut(this.getApplicationContext());
} }