This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NotificationService extends Service { | |
private static final int ID_SERVICE = 101; | |
@Nullable @Override public IBinder onBind(Intent intent) { | |
return null; | |
} | |
@Override public void onCreate() { | |
super.onCreate(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UploadWorker extends Worker { | |
public UploadWorker( | |
@NonNull Context context, | |
@NonNull WorkerParameters params) { | |
super(context, params); | |
} | |
@Override | |
public Result doWork() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!mWifiScanning && timeNow > mWifiLastTime + WIFI_SLEEP_TIMEOUT) | |
{ | |
if (mWifiBroadcastReceiver != null && !mWifiRegistered) | |
{ | |
mContext.registerReceiver(mWifiBroadcastReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); | |
mWifiRegistered = true; | |
} | |
if (mWifiManager.startScan()) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void provideBluetoothMeasurement(String name, | |
String address, | |
int rssi, | |
byte[] scanRecord); | |
public void provideWifiMeasurement(List<android.net.wifi.ScanResult> scanResults); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mWifiBroadcastReceiver = new BroadcastReceiver() | |
{ | |
@Override public void onReceive(Context c, Intent intent) | |
{ | |
try | |
{ | |
// Your code here | |
} | |
catch (Throwable e) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mRttBroadcastReceiver = new BroadcastReceiver() { | |
@Override public void onReceive(Context context, Intent intent) | |
{ | |
try | |
{ | |
for (ScanResult scanResult: mWifiManager.getScanResults()) | |
{ | |
if (scanResult.is80211mcResponder()) | |
{ | |
RangingRequest.Builder rB = new RangingRequest.Builder(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ForegroundService extends Service { | |
@Override | |
public int onStartCommand(Intent intent, int flags, int startId) { | |
String input = intent.getStringExtra("inputExtra"); | |
createNotificationChannel(); | |
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, YourActivity.class), 0); | |
Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID) |