Created
September 8, 2021 10:04
-
-
Save reinskywalker/ff4b7f2d6a5e51167a552ed3ee71fc1f to your computer and use it in GitHub Desktop.
This file contains 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 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