D DickD Active Member Licensed User Mar 2, 2018 #1 ******* UPDATE: After rebooting the phone this error has gone away????? I am using FusedLocationProvider. It works just fine on a Samsung S6 phone with Android 7.0. However on a Moto Droid phone with Android 6.0.1 I get the error shown in the topic. The code is shown below. I have tried it with and without an .initialize statement in various locations without success. On the Samsung there is no .init statement and it works well. Code: Copy Sub FLP_ConnectionSuccess() Log("FLP_ConnectionSuccess") LastLocation.Initialize ' (this doesn't seem to help) LastLocation = FLP.GetLastKnownLocation GetAddress(LastLocation.Latitude,LastLocation.longitude) End Sub Last edited: Mar 3, 2018
******* UPDATE: After rebooting the phone this error has gone away????? I am using FusedLocationProvider. It works just fine on a Samsung S6 phone with Android 7.0. However on a Moto Droid phone with Android 6.0.1 I get the error shown in the topic. The code is shown below. I have tried it with and without an .initialize statement in various locations without success. On the Samsung there is no .init statement and it works well. Code: Copy Sub FLP_ConnectionSuccess() Log("FLP_ConnectionSuccess") LastLocation.Initialize ' (this doesn't seem to help) LastLocation = FLP.GetLastKnownLocation GetAddress(LastLocation.Latitude,LastLocation.longitude) End Sub
Erel B4X founder Staff member Licensed User Longtime User Mar 4, 2018 #2 DickD said: LastLocation.Initialize ' (this doesn't seem to help) LastLocation = FLP.GetLastKnownLocation Click to expand... This is a common mistake. There is no reason to initialize the variable if you are assigning a new one in the next line. If I remember correctly it is covered in this video tutorial: Your code should be: Code: Copy LastLocation = FLP.GetLastKnownLocation If LastLocation.IsInitialized Then ... End If Upvote 0
DickD said: LastLocation.Initialize ' (this doesn't seem to help) LastLocation = FLP.GetLastKnownLocation Click to expand... This is a common mistake. There is no reason to initialize the variable if you are assigning a new one in the next line. If I remember correctly it is covered in this video tutorial: Your code should be: Code: Copy LastLocation = FLP.GetLastKnownLocation If LastLocation.IsInitialized Then ... End If