Location and Keep-Alive

定位和保活

If location reports stop, update too slowly, or the app seems to be killed in the background, walk through this checklist in order. Most problems come from system restrictions rather than SmartHouse itself.

如果定位不上报、更新过慢,或者应用在后台经常被杀,请按顺序检查下面这些项目。大多数问题都来自系统限制,而不是 SmartHouse 本身。

1. Required system permissions and switches

1. 必要的系统权限和开关

  1. Confirm location permission is set to Allow all the time.
  2. 确认定位权限设置为 始终允许
  3. Make sure the phone-level GPS or location service is actually enabled.
  4. 确认手机系统层面的 GPS 或定位服务已经开启。
  5. Check whether the foreground service is still alive. The easiest sign is whether there is still a persistent running-service notification.
  6. 检查前台服务是否还活着。最直接的判断方式是是否还能看到持续存在的服务通知。

2. Android keep-alive settings

2. Android 保活设置

  1. Manually enable auto-start for SmartHouse. On many Android vendors this is not enabled by default.
  2. 手动为 SmartHouse 打开自启动。很多 Android 厂商默认不会启用它。
  3. Enabling the notification-based foreground service generally improves keep-alive reliability. If you do not want to see that notification, many systems allow hiding it later from app notification settings.
  4. 开启基于通知的前台服务通常有助于提升保活稳定性。如果你不想常驻看到通知,很多系统允许之后在应用通知设置里把这类通知隐藏掉。
  5. Disable battery optimization for SmartHouse. This is one of the most common causes of delayed or missing updates.
  6. 为 SmartHouse 关闭电池优化。这是定位延迟或不上报最常见的原因之一。
Different manufacturers place these switches in different menus. Search system settings for terms like auto-start, battery optimization, background activity, startup manager, or protected apps.
不同厂商会把这些开关放在不同菜单里。可以在系统设置里搜索“自启动”“电池优化”“后台活动”“启动管理”“受保护应用”等关键字。

3. Accuracy and movement scenarios

3. 精度与移动场景

If updates are too sparse or geofences do not trigger reliably, raise the minimum location accuracy threshold. High-speed travel, indoor movement, or weak GPS hardware can reduce effective precision.

如果更新太稀疏,或者区域触发不稳定,可以把最低定位精度要求调高一些。高速移动、室内环境或 GPS 硬件较弱时,定位精度本身就会下降。

4. Wi-Fi related background rules

4. Wi-Fi 相关后台规则

If you still need background location after connecting to Wi-Fi, turn off the option equivalent to disable background location when connected to Wi-Fi.

如果连接 Wi-Fi 后你仍然希望继续后台定位,请关闭类似 Wi-Fi 连接时关闭后台定位 的选项。

5. Practical checklist

5. 实用排查顺序