Query the GNSS sub-system’s state
Only available on imps with cellular modems
Table — see below
Call this method to determine whether the GNSS sub-system is enabled. The returned table contains the key state — its value will be one of the following integers:
|1||the GNSS sub-system is on (as returned by the modem)|
|0||the GNSS sub-system is off|
GNSS session operations are highly asynchronous and, once triggered, modem operations proceed independently of impOS’ Squirrel virtual machine state. This is most noticeable if your application restarts, either intentionally by pushing updated code, or because it was restarted by impOS after it raised an exception. In such cases, when the device is not power-cycled, the state of the modem and the application’s assumptions about modem state may become misaligned. Your code should therefore always check GNSS API responses — returns from the calls, and status values passed to callbacks — to determine modem state before proceeding, and use gnss-session.getstate().