79075614

Date: 2024-10-10 17:56:27
Score: 3
Natty:
Report link

i have the same problem but with location, im using expo-location to get the user current location and save it on firebase DB , the app works well with expo go but when i build the apk version and download it to my android device the app crushes when i click the button that trigger the getLocation function, the first run the app asks me for permission, i granted and then it crushes //Get Driver home Location const getLocation = async () => { Keyboard.dismiss() setLocationLoading(true) try { const isAvailable = await Location.hasServicesEnabledAsync(); if (!isAvailable) { createAlert('الرجاء تفعيل خدمات الموقع الجغرافي للتطبيق') setLocationLoading(false); return; }

      let { status } = await Location.requestForegroundPermissionsAsync();
      if (status !== 'granted') {
        createAlert('حدث خطأ اثناء تحديد الموقع. يرجى المحاولة مرة أخرى');
        setLocationLoading(false);
        return;
      }
      console.log('Getting current position...');
      let location = await Location.getCurrentPositionAsync({
        accuracy: Location.Accuracy.High,
      });
      console.log('Location obtained:', location)
      setLocation(location)

    } catch (error) {
      createAlert('حدث خطأ اثناء تحديد الموقع. يرجى المحاولة مرة أخرى');
      console.log(error)
    } finally {
      setLocationLoading(false)
    }
  }
Reasons:
  • Blacklisted phrase (1): i have the same problem
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): i have the same problem
  • Low reputation (1):
Posted by: Hamdi Ammari