Skip to content

Instantly share code, notes, and snippets.

@ksasao
Last active June 22, 2020 13:18
Show Gist options
  • Select an option

  • Save ksasao/74aeb84ebff77ccfe7067b36578a8c7e to your computer and use it in GitHub Desktop.

Select an option

Save ksasao/74aeb84ebff77ccfe7067b36578a8c7e to your computer and use it in GitHub Desktop.
Search Contact Tracing Web Test
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Search Contact Tracing Web Test</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>
<h1>接触確認アプリをさがします</h1>
<div id="status">--</div><br>
<input type="button" value="確認する" onclick="searchContactTracing();"/>
<script>
var bluetoothDevice;
var SERVICE_UUID = '0000fd6f-0000-1000-8000-00805f9b34fb';
function searchContactTracing() {
let options = {filters: [{services: [SERVICE_UUID]}]};
navigator.bluetooth.requestDevice(options)
.then(device =>{
$("#status").text('見つかりました!');
})
.catch(error =>{
$("#status").text('エラー<br>'+error);
console.log(error);
});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment