| Index: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebBroadcastService.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebBroadcastService.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebBroadcastService.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..99912da34405b63043826370aac6a3cc2016f549
|
| --- /dev/null
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebBroadcastService.java
|
| @@ -0,0 +1,42 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +package org.chromium.chrome.browser.physicalweb;
|
| +
|
| +import android.annotation.TargetApi;
|
| +import android.app.Service;
|
| +import android.content.Intent;
|
| +import android.os.Build;
|
| +import android.os.IBinder;
|
| +
|
| +/**
|
| + * Broadcasts Physical Web URLs via BLE.
|
| + **/
|
| +// bluetooth.le.AdvertiseCallback and bluetooth.BluetoothAdapter require API level 21.
|
| +// This will only be run on M and above.
|
| +@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
| +public class PhysicalWebBroadcastService extends Service {
|
| + public static final String DISPLAY_URL_KEY = "display_url";
|
| +
|
| + @Override
|
| + public int onStartCommand(Intent intent, int flags, int startId) {
|
| + String displayUrl = intent.getStringExtra(DISPLAY_URL_KEY);
|
| + // This should never happen.
|
| + if (displayUrl == null) {
|
| + stopSelf();
|
| + return START_STICKY;
|
| + }
|
| + return START_STICKY;
|
| + }
|
| +
|
| + @Override
|
| + public void onDestroy() {
|
| + super.onDestroy();
|
| + }
|
| +
|
| + @Override
|
| + public IBinder onBind(Intent intent) {
|
| + return null;
|
| + }
|
| +}
|
|
|