My app keeps asking for permissions on a single Android device

Here is my code for the permission

  const getPermission = async () => {
    if (Platform.OS !== "web") {
      const { status } =
        await ImagePicker.requestMediaLibraryPermissionsAsync();
      if (status !== "granted") {
        Alert.alert(
          "Sorry, we need camera roll permissions to make this work!",
        );
      }
    }
  };

Full code of the screen where it happens can be found on github.

My app is not published. I have only about 5 users. Only for one my app keeps asking for permissions all the time on my NewScreen. We double-checked the settings. The Expo Go app has camera permissions. We removed permission and re-added via settings. We also re-installed Expo Go. Nothing changes.

How can I narrow that down?
I am unsure if it is:

  1. An Expo Go issue? Since it is my screen only, probably not?
  2. My app? I guess I could publish another sample app with ImagePicker and try that.
  3. His device? Anything I can check there? He has installed a recent Android version. Can I clear any internal caches of Expo Go or anything?

Any help is appreciated! Thanks in advance :).

Most likely the device. Btw, I use ‘expo-image-picker’; as shown in my code below, i do not need to request permissions and no problem

import * as ImagePicker from 'expo-image-picker';
import { manipulateAsync, SaveFormat } from 'expo-image-manipulator';

const pickImage = async () => {
    setIsLoading(true);
    const results = await ImagePicker.launchImageLibraryAsync({
      mediaTypes: ImagePicker.MediaTypeOptions.Images,
      aspect: [4, 3],
      quality: 1,
    });

    if (!results.canceled) {
      const picUris = results.assets.map((obj) => obj.uri);
      const compressedImages = await Promise.all(
        picUris.map((uri) => compressImage(uri, 100)) // Compress to 100KB
      );
      setImagePath(compressedImages[0].uri);
      setIsLoading(false);
    } else {
      setIsLoading(false);
    }
  };

  const compressImage = async (uri, maxFileSize) => {
    const result = await manipulateAsync(
      uri,
      [{ resize: { width: 400, height: 400 } }],
      { compress: 0.5, format: SaveFormat.JPEG }
    );
    if (result.size > maxFileSize * 1024) {
      return await compressImage(result.uri, maxFileSize);
    }
    return result;
  };
1 Like