Skip to content

Commit 0500e51

Browse files
committed
Added @workerthread and more specific throws
1 parent f24bad9 commit 0500e51

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

OneSignalSDK/onesignal/src/main/java/com/onesignal/PushRegistratorFCM.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,18 @@
3030
import android.util.Base64;
3131

3232
import androidx.annotation.NonNull;
33+
import androidx.annotation.WorkerThread;
3334

35+
import com.google.android.gms.tasks.Task;
36+
import com.google.android.gms.tasks.Tasks;
3437
import com.google.firebase.FirebaseApp;
3538
import com.google.firebase.FirebaseOptions;
3639
import com.google.firebase.iid.FirebaseInstanceId;
3740
import com.google.firebase.messaging.FirebaseMessaging;
3841

42+
import java.io.IOException;
43+
import java.util.concurrent.ExecutionException;
44+
3945
class PushRegistratorFCM extends PushRegistratorAbstractGoogle {
4046

4147
// project_info.project_id
@@ -54,8 +60,9 @@ String getProviderName() {
5460
return "FCM";
5561
}
5662

63+
@WorkerThread
5764
@Override
58-
String getToken(String senderId) throws Throwable {
65+
String getToken(String senderId) throws ExecutionException, InterruptedException, IOException {
5966
initFirebaseApp(senderId);
6067

6168
try {
@@ -72,6 +79,7 @@ String getToken(String senderId) throws Throwable {
7279
return getTokenWithClassFirebaseInstanceId(senderId);
7380
}
7481

82+
@WorkerThread
7583
private String getTokenWithClassFirebaseInstanceId(String senderId) throws IOException {
7684
FirebaseInstanceId instanceId = FirebaseInstanceId.getInstance(firebaseApp);
7785
return instanceId.getToken(senderId, FirebaseMessaging.INSTANCE_ID_SCOPE);

0 commit comments

Comments
 (0)