Fused Location Provider in Android

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 09:19:41

Fused API provides 3 location providers.

  1. HIGH_ACCURACY
  2. BALANCED_POWER
  3. NO_POWER

The HIGH_ACCURACY mode use all location providers, However, it prioritize the location providers and include GPS along with location providers. The location accuracy is approximately within 10 meters of range.

The BALANCED_POWER mode exclude GPS for its list of location providers, and use the other providers based including cell towers, wifi etc. In this case, the location accuracy is approximately 40 meters.

The NO_POWER do not use any location provider, instead it is a passive mode of getting location from other apps. The accuracy could be a mile or more. It is solely based on the locations that are fetch by other applications recently.

If you use PRIORITY_HIGH_ACCURACY as in your example, it will use all available sources (wifi, cell, gps, and internal sensors). If you turn off wifi and are indoors, you probably can't get a gps lock (generally gps doesn't work indoors except in some areas when you're close to a window). If wifi, cell, and gps aren't available (either because they're turned off in settings or they're not available in your particular position), it won't return a location (internal sensors alone aren't enough to create a location from scratch).

If you are in-doors, GPS will probably not work. So it will fall back to wifi / triangulation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!