1.

Can you please explain in detail what difference between Async Task and Intent Service. Also explain the situation where we have to use Async Task and where have to use Intent Service.

Answer»

When we will try to display our CURRENT location in google map android is giving us one api to use the name as google map api. 

For displaying the last location we need to override one method name as getLastLocation(). The getLastLocation() method returns a task that we can use to GET a Location object with the latitude and longitude coordinates of a geographic location. Sometimes it happens when the location object may be null. There are below situations when we will get null from getLastLocation() method:

  • In device-level maybe Location is turned off in the SETTINGS. The result could be null even if the last location was previously retrieved because the disabling location also clears the cache.
  • Sometimes the device is not recording its location, which could be the case of a new device or a device that has been restored to factory settings.
  • By some reason, Google Play services on the device have restarted, and there is no active Fused Location PROVIDER CLIENT that has requested location after the services restarted.  


Discussion

No Comment Found

Related InterviewSolutions