Help with a program (to use the LocationSensor Provider option)


Hello everyone , i have a small problem my app wont run fine , i try to make a button that when you click on it , it returns the gps coordinates with every possible devices on the phone , i want to run the passive , wifi etc .. so that the app would return coordinates every times , i uploaded my blocks , please help !

Hello Deswattenne

That's not enough of a clue for us to help you. What I can suggest is that you try mini tests - a project for each feature of the App. It's easier to concentrate on one feature than to work with the whole.

You have some problems. If you do not set ProviderLocked to true, the LocationSensor will automatically change the provider if necessary to determine a location. If a gps receiver is not available, the app will use passive or network automatically. I think you are over engineering this and I suspect there is no need to code like this:


But if you insist on trying, the indicated changes might fix your issue. None of your = options will fire unless your coordinates are the default 0,0 . perhaps that is what you want to happen? If you want a different result; you might put the if statements in separate Button.click event handlers and do not set ProviderLocked to true. If ProviderLocked is set to true, it is impossible to select a different provider.

If you have not already read * Using the Location Sensor, read it now. It explains how Provider is used. If you read it already, consider re-reading.