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 stopSelf(); | |
cco3
2017/03/02 23:52:15
Add a TODO
| |
31 return START_STICKY; | |
32 } | |
33 | |
34 @Override | |
35 public IBinder onBind(Intent intent) { | |
36 return null; | |
37 } | |
38 } | |
OLD | NEW |