Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing apps: Doesn't detect all installed apps #279

Closed
ansmlc opened this issue Mar 29, 2024 · 6 comments
Closed

Missing apps: Doesn't detect all installed apps #279

ansmlc opened this issue Mar 29, 2024 · 6 comments

Comments

@ansmlc
Copy link
Contributor

ansmlc commented Mar 29, 2024

I'm testing this library and I've noticed it doesn't detect all available apps. I've followed the managed expo workflow guide.

On my phone (iOS) I have following apps installed:

  • Mapy.cz
  • Navi
  • MAPS.ME
  • Moovit
  • Google Maps
  • Maps (Apple)
  • Waze

However, the lib only detects Apple Maps and Waze. (and Google Maps if alwaysIncludeGoogle is true).

This is my code:

import React, { useState, useEffect } from 'react';
import { Pressable, Text, View } from 'react-native';
import { Image } from 'expo-image';
import { getApps } from 'react-native-map-link';
import { GetAppsResponse } from 'react-native-map-link/lib/type';
import Colors from '@/src/constants/Colors';

type GetAppResult = {
  id: string;
  name: string;
  icon: NodeRequire;
  open: () => Promise<void>;
};

type DemoProps = {
  lat: number;
  long: number;
  title: string;
};


export const Demo: React.FC<DemoProps> = ({ lat, long, title }) => {
  const [availableApps, setAvailableApps] = useState<GetAppsResponse[]>([]);
  useEffect(() => {
    (async () => {
      const result = await getApps({
        latitude: lat,
        longitude: long,
        title: title,
        googleForceLatLon: true, // optionally force GoogleMaps to use the latlon for the query instead of the title
        alwaysIncludeGoogle: true, // optional, true will always add Google Maps to iOS and open in Safari, even if app is not installed (default: false)
      });
      setAvailableApps(result);
    })();
  }, []);

  return (
    <View style={{ flexDirection: 'column' }}>
      {availableApps.map(({ icon, name, id, open }) => (
        <Pressable
          key={id}
          onPress={open}
          style={{
            borderWidth: 1,
            borderColor: Colors.gray,
            borderRadius: 12,
            padding: 8,
            width: 120,
            display: 'flex',
            flexDirection: 'column',
            justifyContent: 'center',
            alignContent: 'center',
            alignItems: 'center',
            marginHorizontal: 4,
          }}
        >
          <Image source={icon} style={{ width: 25, height: 25 }} />
          <Text>{name}</Text>
        </Pressable>
      ))}
    </View>
  );
};

Screenshot
image

@tschoffelen
Copy link
Owner

Hi there - just to confirm, could you double check you've recompiled the app after adding the app.json config?

@ansmlc
Copy link
Contributor Author

ansmlc commented Mar 30, 2024

Hi, yes, if I check ios/app/Info.plist, it has this array:

    <key>LSApplicationQueriesSchemes</key>
    <array>
      <string>comgooglemaps</string>
      <string>citymapper</string>
      <string>uber</string>
      <string>lyft</string>
      <string>transit</string>
      <string>truckmap</string>
      <string>waze</string>
      <string>yandexnavi</string>
      <string>moovit</string>
      <string>yandextaxi</string>
      <string>yandexmaps</string>
      <string>kakaomap</string>
      <string>tmap</string>
      <string>szn-mapy</string>
      <string>mapsme</string>
      <string>osmandmaps</string>
      <string>gett</string>
      <string>nmap</string>
      <string>dgis</string>
      <string>lftgpas</string>
    </array>

I'm checking this by running a preview build on iOS device via the Expo Go app. Could this be the reason? But than again, how does it detect Waze.

Also, on Android it works fine - it detects almost all apps (except Maps.me).

@tschoffelen
Copy link
Owner

Oh I see! The Expo Go app has it's own whitelist of applications - which does include Waze, but none of the others:

https://github.com/expo/expo/blob/main/apps/expo-go/ios/Exponent/Supporting/Info.plist#L75-L82

@ansmlc
Copy link
Contributor Author

ansmlc commented Mar 31, 2024

Oh I see! The Expo Go app has it's own whitelist of applications - which does include Waze, but none of the others:

https://github.com/expo/expo/blob/main/apps/expo-go/ios/Exponent/Supporting/Info.plist#L75-L82

Ohh, I had no idea. So just to confirm, to really test the lib I'll need Apple's Dev account and install the app directly on the device, right? Since on the Simulator there's no App Store so can't install any navigation apps.

@ansmlc ansmlc closed this as completed Mar 31, 2024
@tschoffelen
Copy link
Owner

So just to confirm, to really test the lib I'll need Apple's Dev account and install the app directly on the device, right?

Yes, correct! Unfortunately that's the only way I'm aware of for Apple devices.

@ansmlc
Copy link
Contributor Author

ansmlc commented Apr 1, 2024

@tschoffelen Any idea why maps.me doesn't show up on Android? All other apps show up as expected. Tested on two different Android devices.

EDIT: related issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants