Skip to content
This repository has been archived by the owner on Nov 16, 2020. It is now read-only.

Use context compat to explicitly start a foreground service #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<service
android:name="org.itoapp.strict.service.TracingService"
android:enabled="true"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false" />
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import androidx.core.content.ContextCompat;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.RemoteException;
Expand Down Expand Up @@ -60,7 +61,7 @@ public ItoBluetoothModule(ReactApplicationContext reactContext) {
Log.d(LOG_TAG, "Creating ItoBluetoothModule");
this.reactContext = reactContext;
Intent intent = new Intent(reactContext, TracingService.class);
reactContext.startService(intent);
ContextCompat.startForegroundService(reactContext, intent);
bindService();
}

Expand Down