【发布时间】:2021-01-20 15:02:25
【问题描述】:
我正在尝试获取实际位置。我阅读并尝试了几十个例子。但一切都以错误告终。
示例:
val locationManager = context.getSystemService(LOCATION_SERVICE) as LocationManager
以这个错误结束:
Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Context?
或者我试过this。但是ActivityCompat和content在Android studio中是红色的。
我尝试了xx版本,但总是出现一些错误。
我正在创建 GPS 跟踪器。我从简单的位置检测开始。
你知道一些 Android studio 4.1.2 的例子吗?
【问题讨论】: