code: public static void addMediaToGallery(Context context, String path) {
          Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
          File f = new File(path);
          Uri contentUri = Uri.fromFile(f);
          mediaScanIntent.setData(contentUri);
          context.sendBroadcast(mediaScanIntent);
      }
docs: Make media accessible outside the app.