Skip to content

Instantly share code, notes, and snippets.

<template>
<div class="home"></div>
</template>
<script>
// @ is an alias to /src
import "leaflet/dist/leaflet.css";
import L from "leaflet";
// Leafletアイコン表示用
<ion-header>
<ion-toolbar>
<ion-title>
GPS
</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-card class="welcome-card">
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
Assets/AssetStoreTools*
# Visual Studio cache directory
.vs/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class UpdateGPSText : MonoBehaviour
{
public Text coordinates;
private void Update()
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GPS : MonoBehaviour
{
public static GPS Instance { set; get; }
public float latitude;
public float longitude;
using UnityEngine;
using UnityEngine.UI;
public class LonLatToUI : MonoBehaviour
{
// テキストテンプレート
private const string LonLatInfoTemplate = "緯度: {0}\n経度: {1}\n住所: {2}";
// 表示用テキストUIオブジェクト
private Text lonLatInfo;
using System.Collections;
using System.Collections.Generic;
using MiniJSON;
// https://gist.github.com/darktable/1411710 から
// MiniJSON.csをダウンロードしてProjectタブ > Plugins フォルダに入れる必要あり
using UnityEngine;
public class LonLatToAddr : MonoBehaviour
{
// APIのパラメータテンプレートつきURL
using System.Collections;
using UnityEngine;
// 緯度経度取得クラス
public class LonLatGetter : MonoBehaviour
{
// 緯度経度取得間隔(秒)
private const float IntervalSeconds = 1.0f;
// ロケーションサービスのステータス
<!-- index.htmlのhead タグで囲まれた部分に以下を追加します -->
<!-- manifest.jsonを呼び出しています -->
<link rel="manifest" href="./manifest.json">
<script>
// service workerが有効なら、service-worker.js を登録します
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./service-worker.js').then(function() { console.log('Service Worker Registered'); });
}
</script>
// service-worker.js
// original code from https://qiita.com/umamichi/items/0e2b4b1c578e7335ba20
self.addEventListener('install', function(e) {
console.log('[ServiceWorker] Install');
});
self.addEventListener('activate', function(e) {
console.log('[ServiceWorker] Activate');
});