Closed Caperious closed 3 months ago
It's likely due to the Capacitor WebView shutting down.
Try setting useLegacyBridge
in your capacitor.config.ts
:
const config: CapacitorConfig = {
.
.
.
android: {
useLegacyBridge: true
}
};
That did the trick. Thanks for the quick response.
Hi @christocracy ,
I actually have a similar issue on the Ios as well. There the code starts executing (i can see the console logs), but when i get to the fetching from storage, the code stops executing. If i let it "hang", timeout is executed. If i bring the app to the foreground in the meantime, the code executes as it should.
Is there a similar trick for Ios as the one above, or do i have a problem with @ionic/storage?
Post your code.
I have figured it out. The problem was @ionic/storage. I used @capacitor/preferences instead to retreive required information from storage. Thank you for your inquiry though.
Your Environment
npx cap doctor
)Latest Dependencies:
@capacitor/cli: 6.0.0 @capacitor/core: 6.0.0 @capacitor/android: 6.0.0 @capacitor/ios: 6.0.0
Installed Dependencies:
@capacitor/cli: 6.0.0 @capacitor/core: 6.0.0 @capacitor/android: 6.0.0 @capacitor/ios: 6.0.0
BackgroundFetch.configure
: { minimumFetchInterval: 15, requiredNetworkType: BackgroundFetch.NETWORK_TYPE_ANY, },Expected Behavior
App should run javascript function in the background or when frozen.
Actual Behavior
The app receives the event, but if the app is in the background, the javascript is not executed. When i bring the app to foreground again, the function executes immediately
Steps to Reproduce
The code that im trying to execute. Its based of the example provided.
Context
Im trying to fetch data from the api, and sync the data into the calendar.
Debug logs