You are using GPS_PROVIDER
for fetching the GPS data. GPS_PROVIDER
fetches details directly from the satellite so it takes time for the first time you load this. Moreover GPS_PROVIDER
takes more than 30 seconds if your are not below the open sky. GPS_PROVIDER
may return NULL when you are inside the office or in basement.
There is an alternative way for this is to use NETWORK_PROVIDER
. This provider will give you GPS details based on your current Network state. This will not be much accurate like GPS_PROVIDER
but it works faster.