I am trying to set a url to my notification's setLargeIcon but while doing this I got the android.os.NetWorkOnMainThreadException error , I saw some posts that mention using AsyncTask, but I do not know how to implement that into my code.
@Override
public void onReceive(final Context context, Intent intent) {
    Log.d(TAG, " START");
    try {
        if (intent == null)
        {
            Log.d(TAG, "Receiver intent null");
        }
        else
        {
                Log.d(TAG,intent.toString());
                String action = intent.getAction();
                Log.d(TAG, "got action " + action );
                String channel = intent.getExtras().getString("com.parse.Channel");
                JSONObject json = new JSONObject(intent.getExtras().getString("com.parse.Data"));
                Log.d(TAG, "got action " + action + " on channel " + channel + " with:");
                Iterator itr = json.keys();
                while (itr.hasNext()) {
                    String key = (String) itr.next();
                    Log.d(TAG, "..."+key+ "=>" +json.getString(key));
                    if (key.equals("customdata"))
                    {
                        Log.d(TAG,"1.0");
                        msg=json.getString(key);    
                        Log.d(TAG,msg.toString());
                    }
                    Log.d(TAG,"1.1");
                    if(key.equals("image_url"))
                    {
                        msg1=json.getString(key);       
                        Log.d("msg1",msg1.toString());
                    }
                }
                Bitmap bitmap = getBitmapFromURL(msg1);
    }           
    } catch (JSONException e) {
        Log.d(TAG, "JSONException: " + e.getMessage());
    }        
}
public Bitmap getBitmapFromURL(String strURL) {
    try {
        URL url = new URL(strURL);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setDoInput(true);
        connection.connect();
        InputStream input = connection.getInputStream();
        Bitmap myBitmap = BitmapFactory.decodeStream(input);
        return myBitmap;
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
}
 
     
     
    