I have an application in which I am getting current location at the first page. In India Application is working fine and getting current location. When we run the application in US, application is getting crashed at the first page itself and throwing IllegalArgumentException.

I have an application in which I am getting current location at the first
Share
The phone doesn’t have any provider enabled to detect the location, i.e it is neither connected to
GPSnorWI-FI, in which case the provider is being passed as null. This is assuming that you are providingproviderargument torequestLocationUpdates()function by, finding the best provider, which will return null, if it can’t find any.I would first check if any provider is enabled, before proceeding any further in to this matter. To avoid passing null as a provider, check if the provider is null before calling for location update.
This is how you do it.
HTH.