1package com.navigine.examples
3import com.navigine.idl.java.*
6 * LocationManager usage example for Kotlin
7 * Demonstrates working with locations, sublocations, categories, and other location-related classes
9class LocationManagerExample {
10 private var sdk: NavigineSdk? = null
11 private var locationManager: LocationManager? = null
12 private var currentLocation: Location? = null
13 private var locationListener: LocationListener? = null
17 setupLocationListener()
21 * Initialize SDK and get LocationManager
23 private fun initializeSdk() {
25 // [kotlin_NavigineSdk_getInstance]
27 sdk = NavigineSdk.getInstance()
28 // [kotlin_NavigineSdk_getInstance]
30 // [kotlin_NavigineSdk_setUserHash]
32 sdk?.setUserHash("USER-HASH-HERE")
33 // [kotlin_NavigineSdk_setUserHash]
35 // [kotlin_NavigineSdk_setServer]
36 // Set server URL (optional)
37 sdk?.setServer("https://custom.navigine.com")
38 // [kotlin_NavigineSdk_setServer]
40 // [kotlin_NavigineSdk_getLocationManager]
41 // Get LocationManager for working with locations
42 locationManager = sdk?.getLocationManager()
43 // [kotlin_NavigineSdk_getLocationManager]
45 if (locationManager != null) {
46 println("LocationManager successfully initialized")
48 } catch (e: Exception) {
49 System.err.println("Error initializing SDK: ${e.message}")
54 * Setup location listener
56 private fun setupLocationListener() {
57 locationListener = object : LocationListener() {
59 // [kotlin_LocationListener_onLocationLoaded]
60 fun onLocationLoaded(location: Location?) {
61 println("Location loaded successfully")
62 currentLocation = location
63 location?.let { demonstrateLocationUsage(it) }
65 // [kotlin_LocationListener_onLocationLoaded]
68 // [kotlin_LocationListener_onLocationUploaded]
69 fun onLocationUploaded(locationId: Int) {
70 println("Location uploaded: $locationId")
72 // [kotlin_LocationListener_onLocationUploaded]
75 // [kotlin_LocationListener_onLocationFailed]
76 fun onLocationFailed(locationId: Int, error: Error) {
77 System.err.println("Failed to load location $locationId: ${error.message}")
79 // [kotlin_LocationListener_onLocationFailed]
84 * Demonstrate LocationManager methods
86 fun demonstrateLocationManagerMethods() {
87 val manager = locationManager ?: run {
88 System.err.println("LocationManager not initialized")
92 val listener = locationListener ?: return
94 // [kotlin_LocationManager_addLocationListener]
95 // Add location listener
96 manager.addLocationListener(listener)
97 // [kotlin_LocationManager_addLocationListener]
99 // [kotlin_LocationManager_setLocationId]
100 // Set location ID to load
101 manager.setLocationId(12345)
102 // [kotlin_LocationManager_setLocationId]
104 // [kotlin_LocationManager_getLocationId]
105 // Get current location ID
106 val currentLocationId = manager.getLocationId()
107 println("Current location ID: $currentLocationId")
108 // [kotlin_LocationManager_getLocationId]
110 // [kotlin_LocationManager_setLocationUpdateInterval]
111 // Set location update interval (in seconds)
112 manager.setLocationUpdateInterval(600) // 10 minutes
113 // [kotlin_LocationManager_setLocationUpdateInterval]
115 // [kotlin_LocationManager_commitChanges]
117 manager.commitChanges()
118 // [kotlin_LocationManager_commitChanges]
120 // [kotlin_LocationManager_revertChanges]
121 // Revert changes (if needed)
122 // manager.revertChanges()
123 // [kotlin_LocationManager_revertChanges]
127 * Demonstrate Location class methods
129 fun demonstrateLocationUsage(location: Location) {
130 // [kotlin_Location_getId]
132 val locationId = location.id
133 println("Location ID: $locationId")
134 // [kotlin_Location_getId]
136 // [kotlin_Location_getVersion]
137 // Get location version
138 val version = location.version
139 println("Location version: $version")
140 // [kotlin_Location_getVersion]
142 // [kotlin_Location_getName]
144 val name = location.name
145 println("Location name: $name")
146 // [kotlin_Location_getName]
148 // [kotlin_Location_getDescript]
149 // Get location description
150 val description = location.descript
151 println("Location description: $description")
152 // [kotlin_Location_getDescript]
154 // [kotlin_Location_getModified]
155 // Check if location is modified
156 val isModified = location.modified
157 println("Location modified: $isModified")
158 // [kotlin_Location_getModified]
160 // [kotlin_Location_getGraphTags]
161 // Get available graph tags
162 val graphTags = location.graphTags
163 println("Available graph tags: $graphTags")
164 // [kotlin_Location_getGraphTags]
166 // [kotlin_Location_getElevationGraph]
167 // Get elevation graph by tag
168 graphTags.firstOrNull()?.let { tag ->
169 val elevationGraph = location.getElevationGraph(tag)
170 elevationGraph?.let { demonstrateElevationGraphUsage(it) }
172 // [kotlin_Location_getElevationGraph]
174 // [kotlin_Location_getCategories]
175 // Get all categories
176 val categories = location.categories
177 println("Number of categories: ${categories.size}")
178 // [kotlin_Location_getCategories]
180 // [kotlin_Location_getCategoryById]
181 // Get category by ID
182 categories.firstOrNull()?.let { category ->
183 val foundCategory = location.getCategoryById(category.id)
184 foundCategory?.let { demonstrateCategoryUsage(it) }
186 // [kotlin_Location_getCategoryById]
188 // [kotlin_Location_getSublocations]
189 // Get all sublocations
190 val sublocations = location.sublocations
191 println("Number of sublocations: ${sublocations.size}")
192 // [kotlin_Location_getSublocations]
194 // [kotlin_Location_getSublocationById]
195 // Get sublocation by ID
196 sublocations.firstOrNull()?.let { sublocation ->
197 val foundSublocation = location.getSublocationById(sublocation.id)
198 foundSublocation?.let { demonstrateSublocationUsage(it) }
200 // [kotlin_Location_getSublocationById]
204 * Demonstrate Category class methods
206 fun demonstrateCategoryUsage(category: Category) {
207 // [kotlin_Category_getId]
209 val categoryId = category.id
210 println("Category ID: $categoryId")
211 // [kotlin_Category_getId]
213 // [kotlin_Category_getName]
215 val categoryName = category.name
216 println("Category name: $categoryName")
217 // [kotlin_Category_getName]
219 // [kotlin_Category_getImageUrl]
220 // Get category image URL
221 val imageUrl = category.imageUrl
222 imageUrl?.let { println("Category image URL: $it") }
223 // [kotlin_Category_getImageUrl]
227 * Demonstrate Sublocation class methods
229 fun demonstrateSublocationUsage(sublocation: Sublocation) {
230 // [kotlin_Sublocation_getId]
231 // Get sublocation ID
232 val sublocationId = sublocation.id
233 println("Sublocation ID: $sublocationId")
234 // [kotlin_Sublocation_getId]
236 // [kotlin_Sublocation_getName]
237 // Get sublocation name
238 val sublocationName = sublocation.name
239 println("Sublocation name: $sublocationName")
240 // [kotlin_Sublocation_getName]
242 // [kotlin_Sublocation_getDescript]
243 // Get sublocation description
244 val sublocationDescription = sublocation.descript
245 println("Sublocation description: $sublocationDescription")
246 // [kotlin_Sublocation_getDescript]
248 // [kotlin_Sublocation_getCategoryId]
250 val categoryId = sublocation.categoryId
251 println("Sublocation category ID: $categoryId")
252 // [kotlin_Sublocation_getCategoryId]
254 // [kotlin_Sublocation_getLocation]
256 val locationId = sublocation.location
257 println("Sublocation location ID: $locationId")
258 // [kotlin_Sublocation_getLocation]
260 // [kotlin_Sublocation_getWidth]
261 // Get sublocation width in meters
262 val width = sublocation.width
263 println("Sublocation width: $width meters")
264 // [kotlin_Sublocation_getWidth]
266 // [kotlin_Sublocation_getHeight]
267 // Get sublocation height in meters
268 val height = sublocation.height
269 println("Sublocation height: $height meters")
270 // [kotlin_Sublocation_getHeight]
272 // [kotlin_Sublocation_getAltitude]
273 // Get sublocation altitude in meters
274 val altitude = sublocation.altitude
275 altitude?.let { println("Sublocation altitude: $it meters") }
276 // [kotlin_Sublocation_getAltitude]
278 // [kotlin_Sublocation_getAzimuth]
279 // Get sublocation azimuth in degrees
280 val azimuth = sublocation.azimuth
281 println("Sublocation azimuth: $azimuth degrees")
282 // [kotlin_Sublocation_getAzimuth]
284 // [kotlin_Sublocation_getOriginPoint]
285 // Get sublocation origin point in WGS84 coordinates
286 val originPoint = sublocation.originPoint
287 println("Sublocation origin point: ${originPoint.lat}, ${originPoint.lon}")
288 // [kotlin_Sublocation_getOriginPoint]
290 // [kotlin_Sublocation_getLevelId]
291 // Get sublocation level ID
292 val levelId = sublocation.levelId
293 println("Sublocation level ID: $levelId")
294 // [kotlin_Sublocation_getLevelId]
296 // [kotlin_Sublocation_getExternalId]
297 // Get sublocation external ID
298 val externalId = sublocation.externalId
299 println("Sublocation external ID: $externalId")
300 // [kotlin_Sublocation_getExternalId]
302 // [kotlin_Sublocation_getBuildingName]
303 // Get sublocation building name
304 val buildingName = sublocation.buildingName
305 println("Sublocation building name: $buildingName")
306 // [kotlin_Sublocation_getBuildingName]
308 // [kotlin_Sublocation_getReferencePoints]
309 // Get reference points
310 val referencePoints = sublocation.referencePoints
311 println("Number of reference points: ${referencePoints.size}")
312 // [kotlin_Sublocation_getReferencePoints]
314 // [kotlin_Sublocation_getVenues]
316 val venues = sublocation.venues
317 println("Number of venues: ${venues.size}")
318 // [kotlin_Sublocation_getVenues]
320 // [kotlin_Sublocation_getZones]
322 val zones = sublocation.zones
323 println("Number of zones: ${zones.size}")
324 // [kotlin_Sublocation_getZones]
326 // [kotlin_Sublocation_getBeacons]
328 val beacons = sublocation.beacons
329 println("Number of beacons: ${beacons.size}")
330 // [kotlin_Sublocation_getBeacons]
332 // [kotlin_Sublocation_getWifis]
333 // Get WiFi access points
334 val wifis = sublocation.wifis
335 println("Number of WiFi access points: ${wifis.size}")
336 // [kotlin_Sublocation_getWifis]
338 // [kotlin_Sublocation_getEddystones]
339 // Get Eddystone beacons
340 val eddystones = sublocation.eddystones
341 println("Number of Eddystone beacons: ${eddystones.size}")
342 // [kotlin_Sublocation_getEddystones]
344 // [kotlin_Sublocation_getGraph]
346 val graph = sublocation.graph
347 graph?.let { demonstrateGraphUsage(it) }
348 // [kotlin_Sublocation_getGraph]
350 // [kotlin_Sublocation_getGraph_withTag]
352 val graphByTag = sublocation.getGraph("main")
354 println("Found graph with tag \"main\"")
355 demonstrateGraphUsage(it)
357 // [kotlin_Sublocation_getGraph_withTag]
359 // [kotlin_Sublocation_getVenueById]
361 if (venues.isNotEmpty()) {
362 val venueById = sublocation.getVenueById(venues.first().id)
364 println("Found venue by ID: ${it.id}")
365 demonstrateVenueUsage(it)
368 // [kotlin_Sublocation_getVenueById]
370 // [kotlin_Sublocation_getZoneById]
372 if (zones.isNotEmpty()) {
373 val zoneById = sublocation.getZoneById(zones.first().id)
375 println("Found zone by ID: ${it.id}")
376 demonstrateZoneUsage(it)
379 // [kotlin_Sublocation_getZoneById]
381 // [kotlin_Sublocation_globalToLocal]
382 // Convert global coordinates to local coordinates
383 val globalPoint = GlobalPoint(55.7558, 37.6176) // Moscow coordinates
384 val localPoint = sublocation.globalToLocal(globalPoint)
385 println("Global point ${globalPoint.lat}, ${globalPoint.lon} converted to local: ${localPoint.x}, ${localPoint.y}")
386 // [kotlin_Sublocation_globalToLocal]
388 // [kotlin_Sublocation_localToGlobal]
389 // Convert local coordinates to global coordinates
390 val localPoint2 = LocationPoint(100.0, 200.0)
391 val globalPoint2 = sublocation.localToGlobal(localPoint2)
392 println("Local point ${localPoint2.x}, ${localPoint2.y} converted to global: ${globalPoint2.lat}, ${globalPoint2.lon}")
393 // [kotlin_Sublocation_localToGlobal]
395 // [kotlin_Sublocation_getImage]
396 // Get sublocation image
397 val image = sublocation.getImage(1024) // max texture size 1024
398 image?.let { println("Sublocation image obtained with max texture size 1024") }
399 // [kotlin_Sublocation_getImage]
403 * Demonstrate Venue class methods
405 fun demonstrateVenueUsage(venue: Venue) {
406 // [kotlin_Venue_getId]
408 val venueId = venue.id
409 println("Venue ID: $venueId")
410 // [kotlin_Venue_getId]
412 // [kotlin_Venue_getLocationId]
413 // Get venue location ID
414 val locationId = venue.locationId
415 println("Venue location ID: $locationId")
416 // [kotlin_Venue_getLocationId]
418 // [kotlin_Venue_getSublocationId]
419 // Get venue sublocation ID
420 val sublocationId = venue.sublocationId
421 println("Venue sublocation ID: $sublocationId")
422 // [kotlin_Venue_getSublocationId]
424 // [kotlin_Venue_getName]
426 val venueName = venue.name
427 println("Venue name: $venueName")
428 // [kotlin_Venue_getName]
430 // [kotlin_Venue_getPhone]
432 val phone = venue.phone
433 println("Venue phone: $phone")
434 // [kotlin_Venue_getPhone]
436 // [kotlin_Venue_getDescript]
437 // Get venue description
438 val venueDescription = venue.descript
439 println("Venue description: $venueDescription")
440 // [kotlin_Venue_getDescript]
442 // [kotlin_Venue_getAlias]
444 val alias = venue.alias
445 println("Venue alias: $alias")
446 // [kotlin_Venue_getAlias]
448 // [kotlin_Venue_getCategoryId]
450 val categoryId = venue.categoryId
451 println("Venue category ID: $categoryId")
452 // [kotlin_Venue_getCategoryId]
454 // [kotlin_Venue_getImageUrl]
455 // Get venue image URL
456 val imageUrl = venue.imageUrl
457 imageUrl?.let { println("Venue image URL: $it") }
458 // [kotlin_Venue_getImageUrl]
460 // [kotlin_Venue_getPoint]
462 val point = venue.point
463 point?.let { demonstratePointUsage(it) }
464 // [kotlin_Venue_getPoint]
468 * Demonstrate Zone class methods
470 fun demonstrateZoneUsage(zone: Zone) {
471 // [kotlin_Zone_getGuid]
472 zone.guid?.let { guid ->
473 println("Zone GUID: $guid")
475 // [kotlin_Zone_getGuid]
477 // [kotlin_Zone_getId]
480 println("Zone ID: $zoneId")
481 // [kotlin_Zone_getId]
483 // [kotlin_Zone_getLocationId]
484 // Get zone location ID
485 val locationId = zone.locationId
486 println("Zone location ID: $locationId")
487 // [kotlin_Zone_getLocationId]
489 // [kotlin_Zone_getSublocationId]
490 // Get zone sublocation ID
491 val sublocationId = zone.sublocationId
492 println("Zone sublocation ID: $sublocationId")
493 // [kotlin_Zone_getSublocationId]
495 // [kotlin_Zone_getName]
497 val zoneName = zone.name
498 println("Zone name: $zoneName")
499 // [kotlin_Zone_getName]
501 // [kotlin_Zone_getDescript]
502 // Get zone description
503 val zoneDescription = zone.descript
504 println("Zone description: $zoneDescription")
505 // [kotlin_Zone_getDescript]
507 // [kotlin_Zone_getCategoryId]
509 val categoryId = zone.categoryId
510 println("Zone category ID: $categoryId")
511 // [kotlin_Zone_getCategoryId]
513 // [kotlin_Zone_getAlias]
515 val alias = zone.alias
516 println("Zone alias: $alias")
517 // [kotlin_Zone_getAlias]
519 // [kotlin_Zone_getColor]
521 val color = zone.color
522 println("Zone color: $color")
523 // [kotlin_Zone_getColor]
525 // [kotlin_Zone_getPolygon]
527 val polygon = zone.polygon
528 println("Zone polygon points: ${polygon.size}")
529 // [kotlin_Zone_getPolygon]
533 * Demonstrate Beacon class methods
535 fun demonstrateBeaconUsage(beacon: Beacon) {
536 // [kotlin_Beacon_getPoint]
538 val point = beacon.point
539 point?.let { demonstratePointUsage(it) }
540 // [kotlin_Beacon_getPoint]
542 // [kotlin_Beacon_getLocationId]
543 // Get beacon location ID
544 val locationId = beacon.locationId
545 println("Beacon location ID: $locationId")
546 // [kotlin_Beacon_getLocationId]
548 // [kotlin_Beacon_getSublocationId]
549 // Get beacon sublocation ID
550 val sublocationId = beacon.sublocationId
551 println("Beacon sublocation ID: $sublocationId")
552 // [kotlin_Beacon_getSublocationId]
554 // [kotlin_Beacon_getName]
556 val beaconName = beacon.name
557 println("Beacon name: $beaconName")
558 // [kotlin_Beacon_getName]
560 // [kotlin_Beacon_getMajor]
562 val major = beacon.major
563 println("Beacon major: $major")
564 // [kotlin_Beacon_getMajor]
566 // [kotlin_Beacon_getMinor]
568 val minor = beacon.minor
569 println("Beacon minor: $minor")
570 // [kotlin_Beacon_getMinor]
572 // [kotlin_Beacon_getUuid]
574 val uuid = beacon.uuid
575 println("Beacon UUID: $uuid")
576 // [kotlin_Beacon_getUuid]
578 // [kotlin_Beacon_getPower]
580 val power = beacon.power
581 power?.let { println("Beacon power: $it") }
582 // [kotlin_Beacon_getPower]
584 // [kotlin_Beacon_getStatus]
586 val status = beacon.status
587 println("Beacon status: $status")
588 // [kotlin_Beacon_getStatus]
592 * Demonstrate Wifi class methods
594 fun demonstrateWifiUsage(wifi: Wifi) {
595 // [kotlin_Wifi_getPoint]
597 val point = wifi.point
598 point?.let { demonstratePointUsage(it) }
599 // [kotlin_Wifi_getPoint]
601 // [kotlin_Wifi_getLocationId]
602 // Get WiFi location ID
603 val locationId = wifi.locationId
604 println("WiFi location ID: $locationId")
605 // [kotlin_Wifi_getLocationId]
607 // [kotlin_Wifi_getSublocationId]
608 // Get WiFi sublocation ID
609 val sublocationId = wifi.sublocationId
610 println("WiFi sublocation ID: $sublocationId")
611 // [kotlin_Wifi_getSublocationId]
613 // [kotlin_Wifi_getName]
615 val wifiName = wifi.name
616 println("WiFi name: $wifiName")
617 // [kotlin_Wifi_getName]
619 // [kotlin_Wifi_getMac]
620 // Get WiFi MAC address
622 println("WiFi MAC: $mac")
623 // [kotlin_Wifi_getMac]
625 // [kotlin_Wifi_getStatus]
627 val status = wifi.status
628 println("WiFi status: $status")
629 // [kotlin_Wifi_getStatus]
633 * Demonstrate Eddystone class methods
635 fun demonstrateEddystoneUsage(eddystone: Eddystone) {
636 // [kotlin_Eddystone_getPoint]
637 // Get Eddystone point
638 val point = eddystone.point
639 point?.let { demonstratePointUsage(it) }
640 // [kotlin_Eddystone_getPoint]
642 // [kotlin_Eddystone_getLocationId]
643 // Get Eddystone location ID
644 val locationId = eddystone.locationId
645 println("Eddystone location ID: $locationId")
646 // [kotlin_Eddystone_getLocationId]
648 // [kotlin_Eddystone_getSublocationId]
649 // Get Eddystone sublocation ID
650 val sublocationId = eddystone.sublocationId
651 println("Eddystone sublocation ID: $sublocationId")
652 // [kotlin_Eddystone_getSublocationId]
654 // [kotlin_Eddystone_getName]
655 // Get Eddystone name
656 val eddystoneName = eddystone.name
657 println("Eddystone name: $eddystoneName")
658 // [kotlin_Eddystone_getName]
660 // [kotlin_Eddystone_getNamespaceId]
661 // Get Eddystone namespace ID
662 val namespaceId = eddystone.namespaceId
663 println("Eddystone namespace ID: $namespaceId")
664 // [kotlin_Eddystone_getNamespaceId]
666 // [kotlin_Eddystone_getInstanceId]
667 // Get Eddystone instance ID
668 val instanceId = eddystone.instanceId
669 println("Eddystone instance ID: $instanceId")
670 // [kotlin_Eddystone_getInstanceId]
672 // [kotlin_Eddystone_getPower]
673 // Get Eddystone power
674 val power = eddystone.power
675 power?.let { println("Eddystone power: $it") }
676 // [kotlin_Eddystone_getPower]
678 // [kotlin_Eddystone_getStatus]
679 // Get Eddystone status
680 val status = eddystone.status
681 println("Eddystone status: $status")
682 // [kotlin_Eddystone_getStatus]
686 * Demonstrate Point class methods
688 fun demonstratePointUsage(point: Point) {
689 // [kotlin_Point_getX]
692 println("Point X: $x")
693 // [kotlin_Point_getX]
695 // [kotlin_Point_getY]
698 println("Point Y: $y")
699 // [kotlin_Point_getY]
703 * Demonstrate Graph class methods
705 fun demonstrateGraphUsage(graph: Graph) {
706 // [kotlin_Graph_getVertices]
707 // Get graph vertices
708 val vertices = graph.vertices
709 println("Number of graph vertices: ${vertices.size}")
710 // [kotlin_Graph_getVertices]
712 // [kotlin_Graph_getEdges]
714 val edges = graph.edges
715 println("Number of graph edges: ${edges.size}")
716 // [kotlin_Graph_getEdges]
720 * Demonstrate GraphVertex class methods
722 fun demonstrateGraphVertexUsage(vertex: GraphVertex) {
723 // [kotlin_GraphVertex_getId]
725 val vertexId = vertex.id
726 println("Vertex ID: $vertexId")
727 // [kotlin_GraphVertex_getId]
729 // [kotlin_GraphVertex_getPoint]
731 val point = vertex.point
732 point?.let { demonstratePointUsage(it) }
733 // [kotlin_GraphVertex_getPoint]
735 // [kotlin_GraphVertex_getName]
737 val name = vertex.name
738 println("Vertex name: $name")
739 // [kotlin_GraphVertex_getName]
741 // [kotlin_GraphVertex_getIsExternal]
742 // Get vertex external flag
743 val isExternal = vertex.isExternal
744 println("Vertex is external: $isExternal")
745 // [kotlin_GraphVertex_getIsExternal]
747 // [kotlin_GraphVertex_getIsElevation]
748 // Get vertex elevation flag
749 val isElevation = vertex.isElevation
750 println("Vertex is elevation: $isElevation")
751 // [kotlin_GraphVertex_getIsElevation]
755 * Demonstrate GraphEdge class methods
757 fun demonstrateGraphEdgeUsage(edge: GraphEdge) {
758 // [kotlin_GraphEdge_getWeight]
760 val weight = edge.weight
761 println("Edge weight: $weight")
762 // [kotlin_GraphEdge_getWeight]
764 // [kotlin_GraphEdge_getDst]
765 // Get destination vertex ID
767 println("Edge destination ID: $dst")
768 // [kotlin_GraphEdge_getDst]
770 // [kotlin_GraphEdge_getSrc]
771 // Get source vertex ID
773 println("Edge source ID: $src")
774 // [kotlin_GraphEdge_getSrc]
776 // [kotlin_GraphEdge_getWeightCoef]
777 // Get edge weight coefficient
778 val weightCoef = edge.weightCoef
779 println("Edge weight coefficient: $weightCoef")
780 // [kotlin_GraphEdge_getWeightCoef]
784 * Demonstrate ElevationGraph class methods
786 fun demonstrateElevationGraphUsage(elevationGraph: ElevationGraph) {
787 // [kotlin_ElevationGraph_getEdges]
788 // Get elevation graph edges
789 val edges = elevationGraph.edges
790 println("Number of elevation graph edges: ${edges.size}")
792 // Demonstrate each edge
793 edges.forEachIndexed { index, edge ->
794 println("Elevation graph edge ${index + 1}:")
795 demonstrateGraphEdgeUsage(edge)
797 // [kotlin_ElevationGraph_getEdges]
801 * Demonstrate TransmitterStatus enum
803 fun demonstrateTransmitterStatus() {
804 // [kotlin_TransmitterStatus_values]
805 // Get all transmitter status values
806 val statuses = TransmitterStatus.values()
807 println("Available transmitter statuses:")
808 statuses.forEach { status ->
809 println(" - $status")
811 // [kotlin_TransmitterStatus_values]
818 locationManager?.let { manager ->
819 locationListener?.let { listener ->
820 // [kotlin_LocationManager_removeLocationListener]
821 // Remove location listener
822 manager.removeLocationListener(listener)
823 // [kotlin_LocationManager_removeLocationListener]
829 * Main demonstration method
832 println("=== LocationManager Example ===")
834 demonstrateLocationManagerMethods()
835 demonstrateTransmitterStatus()
837 // Wait a bit for location to load
841 println("=== Example completed ===")
846 * Function to run the example
849 val example = LocationManagerExample()