Closed jakubvimn closed 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.
That's true. But what about the services available from API 1?
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.