Skip to content

Commit

Permalink
add a comment to clarify the reason of using CompletableFuture
Browse files Browse the repository at this point in the history
  • Loading branch information
jinliu9508 committed Aug 1, 2024
1 parent 18dd0d5 commit 02e30e1
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public void onCreate() {

OneSignal.initWithContext(this, appId);

// ensure calling requestPermission in a thread right after initWithContext does not crash
// Ensure calling requestPermission in a thread right after initWithContext does not crash
// This will reproduce result similar to Kotlin CouroutineScope.launch{}, which may potentially crash the app
ExecutorService executor = Executors.newSingleThreadExecutor();
@SuppressLint({"NewApi", "LocalSuppress"}) CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
OneSignal.getNotifications().requestPermission(true, Continue.none());
Expand Down

0 comments on commit 02e30e1

Please sign in to comment.