|
14 | 14 |
|
15 | 15 | package com.google.firebase.messaging.cpp;
|
16 | 16 |
|
17 |
| -import android.app.IntentService; |
18 | 17 | import android.content.Context;
|
19 | 18 | import android.content.Intent;
|
| 19 | +import androidx.core.app.JobIntentService; |
20 | 20 | import com.google.firebase.iid.FirebaseInstanceId;
|
21 | 21 | import com.google.flatbuffers.FlatBufferBuilder;
|
22 | 22 | import java.io.FileOutputStream;
|
|
28 | 28 | * A class that manages Registration Token generation and passes the generated tokens to the native
|
29 | 29 | * OnTokenReceived function.
|
30 | 30 | */
|
31 |
| -public class RegistrationIntentService extends IntentService { |
| 31 | +public class RegistrationIntentService extends JobIntentService { |
32 | 32 | private static final String TAG = "FirebaseRegService";
|
33 | 33 |
|
34 |
| - public RegistrationIntentService() { |
35 |
| - // The tag here is used only to name the worker thread; it's important only for debugging. |
36 |
| - // http://developer.android.com/reference/android/app/IntentService.html#IntentService(java.lang.String) |
37 |
| - super(TAG); |
38 |
| - } |
39 |
| - |
40 | 34 | // Fetch the latest registration token and notify the C++ layer.
|
41 | 35 | @Override
|
42 |
| - protected void onHandleIntent(Intent intent) { |
| 36 | + protected void onHandleWork(Intent intent) { |
43 | 37 | String token = FirebaseInstanceId.getInstance().getToken();
|
44 |
| - DebugLogging.log(TAG, String.format("onHandleIntent token=%s", token)); |
| 38 | + DebugLogging.log(TAG, String.format("onHandleWork token=%s", token)); |
45 | 39 | if (token != null) {
|
46 | 40 | writeTokenToInternalStorage(this, token);
|
47 | 41 | }
|
|
0 commit comments