setLiveDataSource static method
Sets the PositionService to use the device's live GPS data source.
Call this after the app has the required location permission. Setting the live data source instructs the SDK to use the device GPS as the primary provider for position updates and listener callbacks. Calling this method more than once can return GemError.exist.
Returns
- GemError.success when the live source was selected successfully.
- GemError.invalidInput when the live data source could not be created (for example missing permissions or no available provider).
- GemError.exist if a data source is already active.
Also see:
- removeDataSource - To remove the active data source.
- setExternalDataSource - To set a custom external data source.`
Implementation
static GemError setLiveDataSource() {
final String resultString = GemKitPlatform.instance
.callObjectMethod(<String, Object>{
'id': 0,
'class': 'PositionService',
'method': 'selectPositionDataSource',
'senseDataSourceType': 'live',
});
final dynamic result = jsonDecode(resultString);
final int errCode = result['gemApiError'];
return GemErrorExtension.fromCode(errCode);
}