You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
asynconDeviceReady(): Promise<void>{constURL=`https://webhook.site/88ffb4bc-a20f-49a5-b5a0-8b984848daec`;constonEvent=async(taskId: string): Promise<void>=>{console.log('[BackgroundFetch] event received: ',taskId);try{// Perform the background network check (you might want to handle the result)awaitthis.networkInfoService.checkLocationStatus(URL,objData);BackgroundFetch.finish(taskId);}catch(error){console.error(`[BackgroundFetch] Error during background task: ${error}`);BackgroundFetch.finish(taskId);}};// Timeout callback is executed when the task has exceeded the allowed running timeconstonTimeout=async(taskId: string): Promise<void>=>{console.log('[BackgroundFetch] TIMEOUT: ',taskId);// Ensure the task is marked as finishedBackgroundFetch.finish(taskId);};// Configure the BackgroundFetch plugintry{conststatus=awaitBackgroundFetch.configure({minimumFetchInterval: 15,// Minimum interval in minutesstartOnBoot: true,// Start background fetch tasks when device bootsstopOnTerminate: false// Continue fetch tasks even when the app is terminated},onEvent,onTimeout);// Show the configuration status messagethis.apiService.ShowMessage(`[BackgroundFetch] configured successfully, status: ${status}`);}catch(error){// Handle errors during configurationthis.apiService.ShowMessage(`[BackgroundFetch] configuration failed: ${error}`);}}asynccheckLocationStatus(URL: string,objESSEmployee: ESSEmployee){this.platform.ready().then(()=>{if(this.platform.is('android')){cordova.plugins.LocationPermissionPlugin.checkStatus(async(result: any)=>{constEventName='Mob-Status';conststate=JSON.stringify(result);constjsonData={EmployeeId: objESSEmployee.EmployeeId,CloudAccountName: objESSEmployee.ApiAccountName,EventName: EventName,EventValue: state,UpdatedOn: newDate().toISOString()};try{constresponse=awaitfetch(URL,{method: 'POST',headers: {'Content-Type': 'application/json',},body: JSON.stringify(jsonData)});constdata=awaitresponse.json();console.log('Data posted successfully:',data);}catch(error){console.error('Error posting data:',error);}},async(error: any)=>{console.log(error);});}else{console.log('Not Supported','This feature is only available on Android devices.');}});}
-->
The text was updated successfully, but these errors were encountered:
Your Environment
cordova -v
): 12.0.0cordova platform ls
):Expected Behavior
Background Fetch not post data on my server
Context
Posting data to my server
-->
The text was updated successfully, but these errors were encountered: