File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
AndroidSDKCore/src/main/java/com/leanplum/internal Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ public class ActionManager {
5454 private static final String LEANPLUM_LOCAL_PUSH_HELPER =
5555 "com.leanplum.internal.LeanplumLocalPushHelper" ;
5656 private static final String PREFERENCES_NAME = "__leanplum_messaging__" ;
57+ private static LocationManager locationManager ;
5758 private static boolean loggedLocationManagerFailure = false ;
5859
5960 public static class MessageMatchResult {
@@ -69,14 +70,19 @@ public static synchronized ActionManager getInstance() {
6970 return instance ;
7071 }
7172
72- public static LocationManager getLocationManager () {
73+ public static synchronized LocationManager getLocationManager () {
74+ if (locationManager != null ) {
75+ return locationManager ;
76+ }
77+
7378 if (Util .hasPlayServices ()) {
7479 try {
7580 // Reflection here prevents linker errors
7681 // if Google Play Services is not used in the client app.
77- return (LocationManager ) Class
82+ locationManager = (LocationManager ) Class
7883 .forName ("com.leanplum.LocationManagerImplementation" )
7984 .getMethod ("instance" ).invoke (null );
85+ return locationManager ;
8086 } catch (Throwable t ) {
8187 if (!loggedLocationManagerFailure ) {
8288 Log .w ("Geofencing support requires leanplum-location module and Google Play " +
You can’t perform that action at this time.
0 commit comments