Skip to content

Instantly share code, notes, and snippets.

@reinskywalker
Created September 8, 2021 10:04
Show Gist options
  • Save reinskywalker/ff4b7f2d6a5e51167a552ed3ee71fc1f to your computer and use it in GitHub Desktop.
Save reinskywalker/ff4b7f2d6a5e51167a552ed3ee71fc1f to your computer and use it in GitHub Desktop.
class CaptureActivity : AppCompatActivity(), LocationListener {
override fun onProviderDisabled(provider: String) {
AlertDialog.Builder(this).apply {
setTitle("GPS Signal Not Found")
setMessage("Pastikan fitur GPS pada perangkat anda aktif ketika menggunakan aplikasi ini")
setCancelable(true)
setPositiveButton("Back") { dialogInterface: DialogInterface, _: Int ->
dialogInterface.dismiss()
finish()
}
}.show()
Toast.makeText(this, "GPS Signal Lost", Toast.LENGTH_SHORT).show()
}
override fun onProviderEnabled(provider: String) {
Toast.makeText(this, "GPS Signal Is Online", Toast.LENGTH_SHORT).show()
}
override fun onStatusChanged(provider: String?, status: Int, extras: Bundle?) {
Timber.d("status = $status")
}
override fun onLocationChanged(location: Location) {
observerLocation(location)
}
private val fakeGpsDialog by lazy {
AlertDialog.Builder(this).apply {
setTitle(R.string.fake_gps_)
setMessage(R.string.fake_gps_)
setCancelable(false)
setPositiveButton("Kembali") { dialogInterface: DialogInterface, _: Int ->
dialogInterface.dismiss()
finish()
}
}.create()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment