bg.BackgroundGeolocation.ready(bg.Config(
debug: false,
distanceFilter: 20,
logLevel: bg.Config.LOG_LEVEL_VERBOSE,
stopTimeout: 1,
stopOnTerminate: false,
startOnBoot: true,
)).then((bg.State state) {
if (mounted) {
setState(() {
_enabled = state.enabled;
if (_enabled) {
_persistEnabled = true;
bg.BackgroundGeolocation.start();
_enablePersistMethod();
} else {
_persistEnabled = false;
bg.BackgroundGeolocation.stop();
_enablePersistMethod();
}
});
}
});
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
## Expected Behavior
The code should build on both android and IOS, the code will allow to update my cloud function with the user location while app is running the background or even if it's terminated
## Actual Behavior
The code is running normally on android, it works well in the background and triggers my cloud function, however when trying to build in xcode, building is failing with the following error
Error: The method 'shader' isn't defined for the class 'FragmentProgram' which is in ink_shader.dart. Removing the library form pubspec.yaml will lead to swift running and building normally.
## Steps to Reproduce
<!--- reproduce this issue; include code to reproduce, if relevant -->
1. Add background_geolocation_firebase: ^1.0.0 in your pubspec.yaml
2. Run pod install
3. Archive build
## Context
The app purpose is to locate the user and update the firebase collection. I'm already using the following library flutter_background_geolocation: ^4.8.0 to get the user's location while in background which is working fine with both IOS and Android, however background_geolocation_firebase: ^1.0.0 is needed to update the firestore with the latest location but it's not working on IOS.
## Debug logs
<!-- include iOS / Android logs
-->
<details>
<summary>Logs
[Archive Runner_2022-10-27T05-54-30.txt](https://github.com/transistorsoft/cordova-background-geolocation-firebase/files/9875496/Archive.Runner_2022-10-27T05-54-30.txt)
</summary>
```<!-- Syntax highlighting: DO NOT REMOVE -->
PhaseScriptExecution Run\ Script /Users/wsabg/Library/Developer/Xcode/DerivedData/Runner-cyxptiyweklwyefotusygvjzywqa/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-9740EEB61CF901F6004384FC.sh (in target 'Runner' from project 'Runner')
cd /Volumes/sub_1/Flutter-Projects/Royal\ Marble/royal_marble/ios
/bin/sh -c /Users/wsabg/Library/Developer/Xcode/DerivedData/Runner-cyxptiyweklwyefotusygvjzywqa/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-9740EEB61CF901F6004384FC.sh
../../../flutter-new-version/flutter/packages/flutter/lib/src/material/ink_sparkle.dart:576:21: Error: The method 'shader' isn't defined for the class 'FragmentProgram'.
- 'FragmentProgram' is from 'dart:ui'.
Try correcting the name to the name of an existing method, or defining a method named 'shader'.
return _program.shader(
^^^^^^
Failed to package /Volumes/sub_1/Flutter-Projects/Royal Marble/royal_marble.
Command PhaseScriptExecution failed with a nonzero exit code
Your Environment
#ready
:SharedPreferences _pref; UserData userProvider; bool _enabled; @override void initState() { super.initState(); Future.delayed(const Duration(seconds: 10), () => initPlatformState()); }
Future initPlatformState() async {
_pref = await SharedPreferences.getInstance();
String userId;
if (userProvider == null) {
userId = _pref.getString('userId');
} else {
userId = userProvider.uid;
}
bg.BackgroundGeolocation.onLocation((bg.Location location) {
print('the location: $location');
if (mounted) {
setState(() {
_locationJSON = encoder.convert(location.toMap());
});
}
});
//First confirgure background adapter
BackgroundGeolocationFirebase.configure(BackgroundGeolocationFirebaseConfig(
locationsCollection: 'users/$userId',
// geofencesCollection: 'geofence',
updateSingleDocument: true,
));
}
//index.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const functions = require("firebase-functions"); const admin = require("firebase-admin"); admin.initializeApp();
exports.updateLocation = functions.firestore .document('users/{usersId}') .onUpdate(async (change, context) => { const documentId = context.params.documentId; const newValue = change.after.data(); const previousValue = change.before.data(); const counter = 0;
});