I'm wondering what the this
keyword refers to in the below code (the code block is to request permission to access user location).
class RequiresLocation : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_requires_location)
turnOnLocationButton.setOnClickListener {
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED){
...
}
}
}
}
I checked the Android docs for checkSelfPermission()
and it has this:
int checkSelfPermission (Context context,
String permission)
What does the context here specifically refer to? Is it the application as a whole not the activity?