Closed mohan2002 closed 1 month ago
Only Android consumes keys. The Setup Instructions linked in the readme tell you everything you need to do.
App getting crashed when I ran the debug version of implementation on iOS
if you have a crash, show the stacktrace from XCode
I'm getting
Sending providerchange with no listeners registered. From the debugger
Here is my code
BackgroundGeolocation.ready({
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
distanceFilter: 10,
stopTimeout: 1000,
debug: false,
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
stopOnTerminate: false,
startOnBoot: true,
params: {
auth_token: 'maybe_your_server_authenticates_via_token_YES?',
},
}).then((state) => {
console.log('- BackgroundGeolocation is configured and ready: ', state.enabled)
})
BackgroundGeolocation.start()
await BackgroundGeolocation.getCurrentPosition({
persist: true,
samples: 2,
timeout: 1000,
maximumAge: 10000,
extras: {
getCurrentPosition: true,
},
})
.then((location: Location) => {
console.log('π ~ .then ~ location:', location)
const { longitude, latitude, altitude, accuracy } = location.coords
const locationDetails = {
longitude,
latitude,
altitude,
accuracy,
timestamp: new Date(),
}
if (setFieldValue && fieldName) {
setFieldValue(fieldName, JSON.stringify(locationDetails))
setUserLoading(false)
}
})
.catch((error: LocationError) => {
console.warn('[getCurrentPosition] error: ', error)
})
BackgroundGeolocation.stop()
Sending providerchange with no listeners registered.
You don't need to worry about this, it's harmess. It's expected when you haven't registered a listener for that event.
You can optionally listen to that event if you wish:
BackgroundGeolcoation.onProviderChange((event) => {
console.log('[onProviderChange]', event);
});
Also, you must await BackgroundGeolocation.ready(config)
BEFORE calling .start()
or .getCurrentPosition
.
// NO!!
BackgroundGeolocation.ready(config)
BackgroundGeolocation.start();
// YES
await BackgroundGeolocation.ready(config) // <-- MUST await .ready(config)
BackgroundGeolocation.start();
Thanks @christocracy. Let me check the above.
If the react native version is greater than 0.60
The whole process of auto linking above is not needed right?
You MUST Follow the Auto-Linking Instructions.
Oh thanks @christocracy
This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSMotionUsageDescription key with a string value explaining to the user how the app uses this data.
I'm getting this,
But I've added the privacy in the info list
Anything on this @christocracy
Show me a screenshot of your entire Info.plist
@christocracy
Getting error,
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β -[TSHttpService finish:error:] Success: 1 ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSMotionUsageDescription key with a string value explaining to the user how the app uses this data. βΉοΈ+[LocationAuthorization run:onCancel:] status: 0 βΉοΈ-[TSConfig persist] π΅+[LocationAuthorization run:onCancel:] Request: requestAlwaysAuthorization
Anything on this @christocracy
Post your raw Info.plist
file contents.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.transistorsoft.fetch</string>
<string>com.transistorsoft.customtask</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>PRODUCTNAME AI</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.22</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>None</string>
<key>CFBundleURLName</key>
<string>auth0</string>
<key>CFBundleURLSchemes</key>
<array>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>PRODUCTNAME</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>ai.PRODUCTNAME</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>https://apim-u4xiw5amstzbe.azure-api.net</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSAppleMusicUsageDescription</key>
<string>To upload work order related artefacts from your gallery, PRODUCTNAME AI requires access to your files, photos and videos.</string>
<key>NSCameraUsageDescription</key>
<string>To take a picture or video related to the work order to upload onto PRODUCTNAME AI, please authorize PRODUCTNAME AI to access your camera.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Location access is required for validating your day's work and submissions as requested by your organization.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Location access is required for validating your day's work and submissions as requested by your organization.</string>
<key>NSLocationTemporaryUsageDescriptionDictionary</key>
<dict>
<key>forms</key>
<string>Location access is required for validating your day's work and submissions as requested by your organization.</string>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location access is required for validating your day's work and submissions as requested by your organization.</string>
<key>NSMicrophoneUsageDescription</key>
<string>To upload work order related artefacts from your gallery, PRODUCTNAME AI requires access to your microphone </string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>To upload work order related artefacts from your gallery, PRODUCTNAME AI requires access to your files, photos and videos.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>To upload work order related artefacts from your gallery, PRODUCTNAME AI requires access to your files, photos and videos.</string>
<key>UIAppFonts</key>
<array>
<string>Lato-Bold.ttf</string>
<string>Lato-Light.ttf</string>
<string>Lato-Medium.ttf</string>
<string>Lato-Regular.ttf</string>
<string>timer.ttf</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>fetch</string>
<string>location</string>
<string>processing</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDarkContent</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<key>NSMotionUsageDescription</key>
<string>[CHANGEME] Motion Usage Description</string>
</dict>
</plist>
Everything looks perfect:
<key>NSMotionUsageDescription</key>
<string>[CHANGEME] Motion Usage Description</string>
I have no idea what youβre doing wrong. Are you sure this Info.plist comes from the App youβre actually running?
Yes. So the key and value are correct right?
Yes. Like I said: βEverything looks perfectβ
I suggest you terminate / restart XCode. Run your app directly from XCode.
Thanks @christocracy. I resolved the issue. Working fine.
I wasn't able to find a place where to add LICENSE KEY on iOS. Planning to buy the Licensed version
Can I know the exact places to be added for LICENSE KEY to be added for iOS and Android.
Quick question:
[Context: React Native]
App getting crashed when I ran the debug version of implementation on iOS - debug mode - App ran from Xcode.
Is this expected ? Will this be resolved when the License key is added. It is working fine on the iOS simulator, Android simulator even app ran on Android real device by connecting to same wifi.
@christocracy Would be happier to get a solution for above issue and from then this issue can be closed.