Display prompt for enabling GPS#252
Display prompt for enabling GPS#252bernamaxim wants to merge 2 commits intotraccar:masterfrom bernamaxim:master
Conversation
| { | ||
| final AlertDialog.Builder builder = new AlertDialog.Builder(activity); | ||
| final String action = Settings.ACTION_LOCATION_SOURCE_SETTINGS; | ||
| final String message = "Enable location service to find current location. Click OK to go to."; |
There was a problem hiding this comment.
Please don't use hardcoded strings.
| findPreference(KEY_DEVICE).setSummary(sharedPreferences.getString(KEY_DEVICE, null)); | ||
| } | ||
|
|
||
| private void displayPromptForEnablingGPS( |
| final Activity activity) | ||
| { | ||
| final AlertDialog.Builder builder = new AlertDialog.Builder(activity); | ||
| final String action = Settings.ACTION_LOCATION_SOURCE_SETTINGS; |
There was a problem hiding this comment.
Why do we need a variable for this?
| alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, | ||
| 15000, 15000, alarmIntent); | ||
| String locationProviders = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); | ||
| if (locationProviders == null || locationProviders.equals("")) { |
There was a problem hiding this comment.
Use TextUtils.isEmpty(...) instead.
| 15000, 15000, alarmIntent); | ||
| String locationProviders = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); | ||
| if (locationProviders == null || locationProviders.equals("")) { | ||
| displayPromptForEnablingGPS(this); |
There was a problem hiding this comment.
Why is it called "GPS" when you check for all providers?
| @@ -255,6 +277,10 @@ private void startTrackingService(boolean checkPermission, boolean permission) { | |||
| startService(new Intent(this, TrackingService.class)); | |||
There was a problem hiding this comment.
Should we wait till user enables providers before starting the service?
There was a problem hiding this comment.
Sure, because if user not enable providers, it will be useless. Traccar-client cannot update location and send it.
There was a problem hiding this comment.
You said yes, but you haven't fixed it.
There was a problem hiding this comment.
I'm sorry, I'm still trying but have not been successful. I try to use AsyncTask (https://developer.android.com/reference/android/os/AsyncTask.html)
…gs, use TextUtils to check Location
| { | ||
| final AlertDialog.Builder builder = new AlertDialog.Builder(activity); | ||
| builder.setMessage(R.string.prompt_location_service) | ||
| .setPositiveButton("OK", |
| <string name="status_connectivity_change">Connectivity change</string> | ||
| <string name="hidden_app_name">Device Settings</string> | ||
| <string name="hidden_alert">The app has been hidden. To open it again please dial 8722227 (TRACCAR).</string> | ||
| <string name="prompt_location_service">Enable location service to find current location. Click OK to go to.</string> |
There was a problem hiding this comment.
Please use some better wording. Something like:
Please enable location services. Click OK to open settings screen.
| @@ -255,6 +277,10 @@ private void startTrackingService(boolean checkPermission, boolean permission) { | |||
| startService(new Intent(this, TrackingService.class)); | |||
There was a problem hiding this comment.
You said yes, but you haven't fixed it.
|
😁 |
|
Are the code conflicts resolved already? Is this feature ready for releasing? |
|
As you can see, there were no commits after my review, so nothing is solved. |
Display prompt for enabling GPS, when it disable. Because when forget to enable Location service, Traccar client cannot send location at all.