Skip to content

Commit 7234b5c

Browse files
committed
Fix crash.
1 parent 1f2de3a commit 7234b5c

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

Kill.apk

-35 Bytes
Binary file not shown.

sample/src/main/java/com/xdandroid/sample/misc/BootReceiver.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ public void onReceive(Context context, Intent intent) {
1313
context = context.getApplicationContext();
1414
Context c = context;
1515
new Thread(() -> {
16-
Intent revokeIntent = new Intent(c, RevokeActivity.class);
17-
revokeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
18-
c.startActivity(revokeIntent);
19-
try { Thread.sleep(5 * 1000); } catch (InterruptedException e) { e.printStackTrace(); }
20-
Intent serverIntent = new Intent();
21-
serverIntent.setComponent(new ComponentName("com.xdandroid.server", "com.xdandroid.server.TargetActivity"));
22-
serverIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
23-
c.startActivity(serverIntent);
16+
try {
17+
Intent revokeIntent = new Intent(c, RevokeActivity.class);
18+
revokeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
19+
c.startActivity(revokeIntent);
20+
Thread.sleep(5 * 1000);
21+
Intent serverIntent = new Intent();
22+
serverIntent.setComponent(new ComponentName("com.xdandroid.server", "com.xdandroid.server.TargetActivity"));
23+
serverIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
24+
c.startActivity(serverIntent);
25+
} catch (Exception e) { e.printStackTrace(); }
2426
}).start();
2527
}
2628
}

0 commit comments

Comments
 (0)