How to restart fused location

Hello,

I have an android service running a FusedLocationProviderClient, but sometimes i need to stop and after some time restart the tracking, but when the tracker is stopped i can not start again, the code dont throwed any error, but the location didnt start.

        Task.Factory.StartNew( async() => {

            MainActivity.Log( "SERVICE", "RestartLocationUpdate" );
            await fusedLocationProviderClient.RemoveLocationUpdatesAsync( locationCallback );
            MainActivity.Log( "SERVICE", "StopLocationUpdate - ok" );
            await Task.Delay( 8000 );
            await fusedLocationProviderClient.RequestLocationUpdatesAsync( CreateLocationRequest(), locationCallback );
            MainActivity.Log( "SERVICE", "StartLocationUpdate - ok" );

        } );

Answers

Sign In or Register to comment.