Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.util.Log;

import org.deviceconnect.android.deviceplugin.linking.lib.BuildConfig;
Expand Down Expand Up @@ -315,7 +316,11 @@ private void startBeaconScanInternal(final LinkingBeaconUtil.ScanMode scanMode)
if (scanMode != null) {
intent.putExtra(mContext.getPackageName() + LinkingBeaconUtil.EXTRA_SCAN_MODE, scanMode.getValue());
}
mContext.startService(intent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mContext.startForegroundService(intent);
} else {
mContext.startService(intent);
}
}

private void stopBeaconScanInternal() {
Expand All @@ -326,7 +331,11 @@ private void stopBeaconScanInternal() {
Intent intent = new Intent();
intent.setClassName(LinkingBeaconUtil.LINKING_PACKAGE_NAME, LinkingBeaconUtil.BEACON_SERVICE_NAME);
intent.setAction(mContext.getPackageName() + LinkingBeaconUtil.ACTION_STOP_BEACON_SCAN);
mContext.startService(intent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mContext.startForegroundService(intent);
} else {
mContext.startService(intent);
}
}

private void parseBeaconScanState(final Intent intent) {
Expand Down