OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.physicalweb; |
| 6 |
| 7 import android.annotation.TargetApi; |
| 8 import android.app.Service; |
| 9 import android.content.Intent; |
| 10 import android.os.Build; |
| 11 import android.os.IBinder; |
| 12 |
| 13 /** |
| 14 * Broadcasts Physical Web URLs via BLE. |
| 15 **/ |
| 16 // bluetooth.le.AdvertiseCallback and bluetooth.BluetoothAdapter require API lev
el 21. |
| 17 // This will only be run on M and above. |
| 18 @TargetApi(Build.VERSION_CODES.LOLLIPOP) |
| 19 public class PhysicalWebBroadcastService extends Service { |
| 20 public static final String DISPLAY_URL_KEY = "display_url"; |
| 21 |
| 22 @Override |
| 23 public int onStartCommand(Intent intent, int flags, int startId) { |
| 24 String displayUrl = intent.getStringExtra(DISPLAY_URL_KEY); |
| 25 // This should never happen. |
| 26 if (displayUrl == null) { |
| 27 stopSelf(); |
| 28 return START_STICKY; |
| 29 } |
| 30 return START_STICKY; |
| 31 } |
| 32 |
| 33 @Override |
| 34 public void onDestroy() { |
| 35 super.onDestroy(); |
| 36 } |
| 37 |
| 38 @Override |
| 39 public IBinder onBind(Intent intent) { |
| 40 return null; |
| 41 } |
| 42 } |
OLD | NEW |