I have a Foreground Service that take User Position. And I need to send that position to my Server to update user position.
If I put the App in background (open another app, lock screen…) I take his position for all the time I need, but after 5 minutes that the app is in background the HTTPS request to my server stay in pending.
- Put App in Background
- Take Position with a ForegroundService (@capacitor-community/background-geolocation) (work fine for all of the time)
- Send position to my HTTPS API (work fine for 5 minute and after the request stay in pending status)
(I try to disabled Battery Saver, I try to disabled sleep mode).
capacitor → 2
angular → 11
ionic → 5
Service in AndroidManifest.xml
<service android:name="com.equimaps.capacitor_background_geolocation.BackgroundGeolocationService" android:enabled="true" android:exported="true" android:foregroundServiceType="location|dataSync" android:directBootAware="true" />