Commit 76366bc3 authored by Varun Patil's avatar Varun Patil

Do not create async task in background process

parent 57049bc9
......@@ -130,9 +130,7 @@ public class InstiAppFirebaseMessagingService extends FirebaseMessagingService {
final Context context, final String imageUrl, final String largeIconUrl,
final int notification_id, final NotificationCompat.Builder builder, final String content){
new AsyncTask<Void, Void, Bitmap[]>() {
@Override
protected Bitmap[] doInBackground(Void... params) {
Bitmap[] bitmaps = null;
try {
Bitmap image = null;
if (imageUrl != null) {
......@@ -143,15 +141,11 @@ public class InstiAppFirebaseMessagingService extends FirebaseMessagingService {
largeIcon = getCroppedBitmap(
Picasso.get().load(Constants.resizeImageUrl(largeIconUrl, 200)).get(), 200);
}
return new Bitmap[]{image, largeIcon};
bitmaps = new Bitmap[]{image, largeIcon};
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Bitmap[] bitmaps) {
// Check if we loaded big image
if (bitmaps != null && bitmaps[0] != null) {
builder.setStyle(
......@@ -167,9 +161,6 @@ public class InstiAppFirebaseMessagingService extends FirebaseMessagingService {
}
showNotification(context, notification_id, builder.build());
super.onPostExecute(bitmaps);
}
}.execute();
}
/** Get circular center cropped bitmap */
......
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