Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/assets/locales/android_translatable_strings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -992,3 +992,5 @@ background.sync.fail=Background sync failed. Please try to trigger a normal Sync
android.package.name.org.commcare.dalvik.reminders=CommCare Reminders
android.package.name.callout.commcare.org.sendussd=Commcare USSD
android.package.name.org.commcare.dalvik.abha=CommCare ABHA

location.capture.cancelled=Location capture cancelled
2 changes: 2 additions & 0 deletions app/src/org/commcare/activities/FormEntryActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ public void onActivityResultSessionSafe(int requestCode, int resultCode, Intent
} else if (requestCode == FormEntryConstants.INTENT_CALLOUT) {
processIntentResponse(intent, true);
Toast.makeText(this, Localization.get("intent.callout.cancelled"), Toast.LENGTH_SHORT).show();
} else if (requestCode == FormEntryConstants.LOCATION_CAPTURE){
Toast.makeText(this, Localization.get("location.capture.cancelled"), Toast.LENGTH_SHORT).show();
}
} else {
switch (requestCode) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.commcare.location

import android.content.Context
import android.provider.Settings
import com.google.android.gms.common.ConnectionResult
import com.google.android.gms.common.GoogleApiAvailability

Expand All @@ -14,7 +15,7 @@ class CommCareLocationControllerFactory {
fun getLocationController(context: Context, mListener: CommCareLocationListener): CommCareLocationController {
// We only wanna use FusedLocationClient when play services are available.
// Otherwise, we'll fallback to using LocationManager, rather than asking user to update playservices.
return when (isPlayServiceAvailable(context)) {
return when (isPlayServiceAvailable(context) && !isAirplaneModeOn(context)) {
true -> CommCareFusedLocationController(context, mListener)
false -> CommCareProviderLocationController(context, mListener)
}
Expand All @@ -23,6 +24,9 @@ class CommCareLocationControllerFactory {
private fun isPlayServiceAvailable(context: Context): Boolean {
return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS
}
}

}
private fun isAirplaneModeOn(context: Context): Boolean {
return Settings.Global.getInt(context.contentResolver, Settings.Global.AIRPLANE_MODE_ON) != 0;
}
}
}
Loading