Commit 66e5a850 authored by Libin Lu's avatar Libin Lu Committed by GitHub

fix an android warning

parent 10ff9a29
...@@ -109,11 +109,11 @@ public class FIRLocalMessagingHelper { ...@@ -109,11 +109,11 @@ public class FIRLocalMessagingHelper {
//large icon //large icon
String largeIcon = bundle.getString("large-icon"); String largeIcon = bundle.getString("large-icon");
if(largeIcon != null){ if(largeIcon != null && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP){
int largeIconResId = res.getIdentifier(largeIcon, "mipmap", packageName); int largeIconResId = res.getIdentifier(largeIcon, "mipmap", packageName);
Bitmap largeIconBitmap = BitmapFactory.decodeResource(res, largeIconResId); Bitmap largeIconBitmap = BitmapFactory.decodeResource(res, largeIconResId);
if (largeIconResId != 0 && (largeIcon != null || android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP)) { if (largeIconResId != 0) {
notification.setLargeIcon(largeIconBitmap); notification.setLargeIcon(largeIconBitmap);
} }
} }
...@@ -125,7 +125,7 @@ public class FIRLocalMessagingHelper { ...@@ -125,7 +125,7 @@ public class FIRLocalMessagingHelper {
} }
//sound //sound
if (bundle.containsKey("sound")) { if (bundle.getString("sound") != null) {
int soundResourceId = res.getIdentifier(bundle.getString("sound"), "raw", packageName); int soundResourceId = res.getIdentifier(bundle.getString("sound"), "raw", packageName);
notification.setSound(Uri.parse("android.resource://" + packageName + "/" + soundResourceId)); notification.setSound(Uri.parse("android.resource://" + packageName + "/" + soundResourceId));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment