Skip to content

Commit 04d8c88

Browse files
authored
Merge pull request #87 from Leanplum/feature/fix-warnings
feat(deprecation): fixing deprecation warnings
2 parents cab1532 + 27632e6 commit 04d8c88

File tree

8 files changed

+26
-4
lines changed

8 files changed

+26
-4
lines changed

AndroidSDK/src/com/leanplum/LeanplumPushService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ private static void showNotification(Context context, Bundle message) {
350350
// level 26. For API level 26 and above we must use setImportance(int) for each notification
351351
// channel, not for each notification message.
352352
if (Build.VERSION.SDK_INT >= 16 && Build.VERSION.SDK_INT < 26) {
353+
//noinspection deprecation
353354
builder.setPriority(Notification.PRIORITY_MAX);
354355
}
355356
builder.setAutoCancel(true);

AndroidSDK/src/com/leanplum/LeanplumResources.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242

4343
// Description of resources.asrc file (we don't use this right nwo)
4444
// http://ekasiswanto.wordpress.com/2012/09/19/descriptions-of-androids-resources-arsc/
45-
45+
// Suppressing deprecation warnings for Resource methods,
46+
// because the resource syncing feature will likely be refactored/replaced in the future.
47+
@SuppressWarnings("deprecation")
4648
public class LeanplumResources extends Resources {
4749
public LeanplumResources(Resources base) {
4850
super(base.getAssets(), base.getDisplayMetrics(), base.getConfiguration());

AndroidSDK/src/com/leanplum/LocationManagerImplementation.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
3737
import com.google.android.gms.location.Geofence;
3838
import com.google.android.gms.location.Geofence.Builder;
39+
import com.google.android.gms.location.GeofencingRequest;
3940
import com.google.android.gms.location.LocationListener;
4041
import com.google.android.gms.location.LocationRequest;
4142
import com.google.android.gms.location.LocationServices;
@@ -264,6 +265,9 @@ private boolean isMetaDataSet() {
264265
}
265266
}
266267

268+
// Suppressing missing permission warning which since it is up to client to add location
269+
// permission to their manifest.
270+
@SuppressWarnings("MissingPermission")
267271
private void updateTrackedGeofences() {
268272
if (allGeofences == null || googleApiClient == null || !googleApiClient.isConnected()) {
269273
return;
@@ -282,8 +286,11 @@ private void updateTrackedGeofences() {
282286
}
283287
trackedGeofenceIds = new ArrayList<>();
284288
if (toBeTrackedGeofences != null && toBeTrackedGeofences.size() > 0) {
285-
LocationServices.GeofencingApi.addGeofences(
286-
googleApiClient, toBeTrackedGeofences, getTransitionPendingIntent());
289+
GeofencingRequest request = new GeofencingRequest.Builder()
290+
.addGeofences(toBeTrackedGeofences)
291+
.build();
292+
LocationServices.GeofencingApi.addGeofences(googleApiClient,
293+
request, getTransitionPendingIntent());
287294
for (Geofence geofence : toBeTrackedGeofences) {
288295
trackedGeofenceIds.add(geofence.getRequestId());
289296
//TODO: stateBeforeBackground doesn't get persisted.
@@ -432,6 +439,9 @@ public void onLocationChanged(Location location) {
432439
/**
433440
* Request location for user location update if googleApiClient is connected.
434441
*/
442+
// Suppressing missing permission warning which since it is up to client to add location
443+
// permission to their manifest.
444+
@SuppressWarnings("MissingPermission")
435445
private void requestLocation() {
436446
if (!Leanplum.isLocationCollectionEnabled() || googleApiClient == null
437447
|| !googleApiClient.isConnected()) {

AndroidSDK/src/com/leanplum/internal/ResourceQualifiers.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ public Object getMatch(String str) {
8080

8181
@Override
8282
public boolean isMatch(Object value, Configuration config, DisplayMetrics display) {
83+
// Suppressing deprecated locale.
84+
//noinspection deprecation
8385
return config.locale.getLanguage().equals(value);
8486
}
8587
}),
@@ -94,6 +96,8 @@ public Object getMatch(String str) {
9496

9597
@Override
9698
public boolean isMatch(Object value, Configuration config, DisplayMetrics display) {
99+
// Suppressing deprecated locale.
100+
//noinspection deprecation
97101
return config.locale.getCountry().toLowerCase().equals(value);
98102
}
99103
}),

AndroidSDK/src/com/leanplum/internal/Socket.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
*
4949
* @author Andrew First, Ben Marten
5050
*/
51+
// Suppressing deprecated apache dependency.
52+
@SuppressWarnings("deprecation")
5153
public class Socket {
5254
private static final String TAG = "Leanplum";
5355
private static final String EVENT_CONTENT_RESPONSE = "getContentResponse";

AndroidSDK/src/com/leanplum/internal/SocketIOClient.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
import java.util.Arrays;
4545
import java.util.HashSet;
4646

47+
// Suppressing deprecated apache dependency.
48+
@SuppressWarnings("deprecation")
4749
class SocketIOClient {
4850
interface Handler {
4951
void onConnect();

AndroidSDK/src/com/leanplum/internal/WebSocketClient.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
import javax.net.ssl.SSLSocketFactory;
5454
import javax.net.ssl.TrustManager;
5555

56+
// Suppressing deprecated apache dependency.
57+
@SuppressWarnings("deprecation")
5658
class WebSocketClient {
5759
private static final String TAG = "WebSocketClient";
5860

AndroidSDK/src/com/leanplum/messagetemplates/BaseMessageDialog.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,6 @@ public boolean onLongClick(View v) {
441441
webViewSettings.setMediaPlaybackRequiresUserGesture(false);
442442
}
443443
webViewSettings.setAppCacheEnabled(true);
444-
webViewSettings.getSaveFormData();
445444
webViewSettings.setAllowFileAccess(true);
446445
webViewSettings.setJavaScriptEnabled(true);
447446
webViewSettings.setDomStorageEnabled(true);

0 commit comments

Comments
 (0)