pawegio / KAndroid

Kotlin library for Android
Apache License 2.0
896 stars 81 forks source link

Change request: using non null types for system services #29

Closed jakubvimn closed 7 years ago

jakubvimn commented 7 years ago

From the getSystemService method documentation: "@return The service or null if the name does not exist"

So, if a name constant is used (and not a random string), the API guarantees to return a non-null object. So I think that the returned objects should have non-null types.

pawegio commented 7 years ago

It can return null if service is not available on the device from incompatible hardware or API level reasons, e.g. JOB_SCHEDULER_SERVICE is accessible since API level 21.

jakubvimn commented 7 years ago

That's true. But what about the services available from API 1?

pawegio commented 7 years ago

See https://github.com/pawegio/KAndroid/issues/3