public void writePhotoToPath(final String contactId, final String file, final Promise promise) {
        getExecutor().execute(() -> {
            Context context = getReactApplicationContext();
            ContentResolver cr = context.getContentResolver();

            Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, Long.parseLong(contactId));
            InputStream inputStream = ContactsContract.Contacts.openContactPhotoInputStream(cr, uri);
            OutputStream outputStream = null;
            try {
                outputStream = new FileOutputStream(file);
                BitmapFactory.decodeStream(inputStream).compress(Bitmap.CompressFormat.PNG, 100, outputStream);
                promise.resolve(true);
            } catch (FileNotFoundException e) {
                promise.reject(e.toString());
            } finally {
                try {
                    if (outputStream != null) {
                        outputStream.close();
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            try {
                inputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        });
    }
Retrieves <code>contact</code> for contact, or <code>null</code> if not
available.

@param contactId contact identifier, <code>recordID</code>
android/src/main/java/com/rt2zz/reactnativecontacts/impl/ContactsManagerImpl.java