This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun drawLocationAccuracyCircle(location: Location) { | |
if (location.accuracy < 0) { | |
return | |
} | |
val latLng = LatLng(location.latitude, location.longitude) | |
locationAccuracyCircle?.let{ | |
it.center = latLng | |
} ?: run{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onLocationChanged(newLocation: Location?) { | |
newLocation?.let{ | |
Log.d(LOG_TAG, "(" + it.latitude + "," + it.longitude + ")") | |
gpsCount++ | |
if (isLogging) { | |
locationList.add(newLocation); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@NeedsPermission(Manifest.permission.ACCESS_FINE_LOCATION) | |
fun setupGoogleMap(googleMap: GoogleMap) { | |
map = googleMap | |
map.uiSettings.isZoomControlsEnabled = false | |
map.isMyLocationEnabled = false //TODO: RuntimePermissionを後で入れる | |
map.uiSettings.isCompassEnabled = true | |
map.uiSettings.isMyLocationButtonEnabled = true | |
map.setOnCameraMoveStartedListener { reason -> | |
if (reason == GoogleMap.OnCameraMoveStartedListener.REASON_GESTURE) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
xmlns:map="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<fragment | |
android:layout_width="match_parent" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val gpsFreqInMillis = 5000 | |
val gpsFreqInDistance = 5 // in meters | |
locationManager.addGpsStatusListener(this) | |
locationManager.requestLocationUpdates( | |
gpsFreqInMillis.toLong(), | |
gpsFreqInDistance.toFloat(), | |
criteria, | |
this, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val criteria = Criteria() | |
criteria.accuracy = | |
Criteria.ACCURACY_FINE //setAccuracyは内部では、https://stackoverflow.com/a/17874592/1709287の用にHorizontalAccuracyの設定に変換されている。 | |
criteria.powerRequirement = Criteria.POWER_HIGH | |
criteria.isAltitudeRequired = false | |
criteria.isSpeedRequired = true | |
criteria.isCostAllowed = true | |
criteria.isBearingRequired = false | |
//API level 9 and up |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity() { | |
var locationService: LocationService? = null | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
val locationService = Intent(this.application, LocationService::class.java) | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def process_event(event): | |
if event.type == EventType.ON_CONVERSATION_TURN_STARTED: | |
print() | |
print(event) | |
if (event.type == EventType.ON_CONVERSATION_TURN_FINISHED and | |
event.args and not event.args['with_follow_on_turn']): | |
print() | |
if event.type == EventType.ON_DEVICE_ACTION: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"fulfillment": { | |
"staticFulfillment": { | |
"templatedResponse": { | |
"items": [ | |
{ | |
"simpleResponse": { | |
"textToSpeech": "Move for $number seconds" | |
} | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"types": [ | |
{ | |
"name": "$Speed", | |
"entities": [ | |
{ | |
"key": "SLOWLY", | |
"synonyms": [ | |
"slowly", | |
"slow" | |
] |