Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebBroadcastService.java

Issue 2719493003: Add PhysicalWebBroadcastService (Closed)
Patch Set: Always Stopping Self Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..4ee60c5cd559c3743725cc9d0d552c49ad36b5c9
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebBroadcastService.java
@@ -0,0 +1,38 @@
+// 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;
+ }
+ stopSelf();
cco3 2017/03/02 23:52:15 Add a TODO
+ return START_STICKY;
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698