Skip to content

Commit 6fb20bd

Browse files
committed
GoogleApiClient connected check to prevent rare edge case
1 parent 2c7fae8 commit 6fb20bd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

OneSignalSDK/onesignal/src/main/java/com/onesignal/LocationGMS.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ private static void receivedLocationPoint(Location location) {
235235
scheduleUpdate(classContext);
236236
}
237237

238+
// Hold on to reference incase gms uses weak referencing.
238239
private static LocationUpdateListener locationUpdateListener;
239240

240241
private static class GoogleApiClientListener implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
@@ -297,7 +298,9 @@ static PendingResult<Status> requestLocationUpdates(GoogleApiClient googleApiCli
297298
}
298299

299300
static PendingResult<Status> removeLocationUpdates(GoogleApiClient googleApiClient, LocationListener locationListener) {
300-
return LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, locationListener);
301+
if (googleApiClient.isConnected())
302+
return LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, locationListener);
303+
return null;
301304
}
302305

303306
@SuppressWarnings("MissingPermission")

OneSignalSDK/onesignal/src/unity/java/com/onesignal/OneSignalUnityProxy.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ public class OneSignalUnityProxy implements NotificationOpenedHandler, Notificat
4141

4242
private static String unityListenerName;
4343
private static java.lang.reflect.Method unitySendMessage;
44-
45-
private static OSPermissionObserver permissionObserver;
46-
private static OSSubscriptionObserver subscriptionObserver;
4744

4845
@SuppressWarnings({ "unchecked", "rawtypes" })
4946
public OneSignalUnityProxy(String listenerName, String googleProjectNumber, String oneSignalAppId, int logLevel, int visualLogLevel) {

0 commit comments

Comments
 (0)