mattermoran / map_launcher

Flutter plugin for launching maps
MIT License
259 stars 116 forks source link

Maps.me Android issue #122

Closed rtfmko closed 1 month ago

rtfmko commented 2 years ago

Problem with open Maps.me on Android. With showDirections and showMarker. Version: map_launcher: ^2.2.3

Stack Trace:

E/MethodChannel#map_launcher(29650): Failed to handle method call
E/MethodChannel#map_launcher(29650): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=mapsme://map?v=1&ll=50.4115,30.6497 flg=0x10000000 pkg=com.mapswithme.maps.pro }
E/MethodChannel#map_launcher(29650):    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2100)
E/MethodChannel#map_launcher(29650):    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1747)
E/MethodChannel#map_launcher(29650):    at android.app.ContextImpl.startActivity(ContextImpl.java:1135)
E/MethodChannel#map_launcher(29650):    at android.app.ContextImpl.startActivity(ContextImpl.java:1106)
E/MethodChannel#map_launcher(29650):    at android.content.ContextWrapper.startActivity(ContextWrapper.java:420)
E/MethodChannel#map_launcher(29650):    at com.alexmiller.map_launcher.MapLauncherPlugin.launchMap(MapLauncherPlugin.kt:89)
E/MethodChannel#map_launcher(29650):    at com.alexmiller.map_launcher.MapLauncherPlugin.onMethodCall(MapLauncherPlugin.kt:112)
E/MethodChannel#map_launcher(29650):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#map_launcher(29650):    at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#map_launcher(29650):    at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#map_launcher(29650):    at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#map_launcher(29650):    at android.os.Handler.handleCallback(Handler.java:938)
E/MethodChannel#map_launcher(29650):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#map_launcher(29650):    at android.os.Looper.loopOnce(Looper.java:226)
E/MethodChannel#map_launcher(29650):    at android.os.Looper.loop(Looper.java:313)
E/MethodChannel#map_launcher(29650):    at android.app.ActivityThread.main(ActivityThread.java:8669)
E/MethodChannel#map_launcher(29650):    at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#map_launcher(29650):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
E/MethodChannel#map_launcher(29650):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

Code sample:

try {
    bool? result = await MapLauncher.isMapAvailable(availableMap!.mapType);
    if (result ?? false) {
       await MapLauncher.showDirections(
          mapType: availableMap.mapType,
          destination: Coords(lat, lon),
        );
    } else {
      throw LaunchException("isMapAvailable result $result", LocaleKeys.errors_open_map.tr());
    }
  } catch (error, stackTrace) {
    throw LaunchException(error.toString(), LocaleKeys.errors_open_map.tr(), stackTrace: stackTrace);
  }

Flutter Doctor:

[√] Flutter (Channel stable, 3.0.3, on Microsoft Windows [Version 10.0.19044.1806], locale en-US) • Flutter version 3.0.3 at C:\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 676cefaaff (9 days ago), 2022-06-22 11:34:49 -0700 • Engine revision ffe7b86a1e • Dart version 2.17.5 • DevTools version 2.12.2

Tested on three Android devices:

Realme 6, Android sdk: 29 version: 10 (RMX2001) Samsung Galaxy S22 Ultra, Android sdk: 31 version: 12 (S908B) Realme GT Neo2, Android sdk: 31 version 12 (RMX3370)

sgenou commented 2 years ago

I can confirm that i got the exact same problem. Maps.me not working anymore...

mattermoran commented 2 years ago

I guess in the new version of maps.me they changed the url scheme. Will try to find the new one when got time

sgenou commented 2 years ago

It seems that Waze has the problem too... Google Maps works well...

RANSoftRA commented 1 year ago

We ran into the same issue as well with Maps.me. We currently disabled Maps.me support for android devices and will add it again later.

@sgenou Waze did not seem to cause any problems on my test setup: Android 12, map_launcher 2.4.0

mattermoran commented 1 year ago

I just tested on installed version of maps.me on my device (v12) and it worked fine, after updating to v14 it stopped working indeed. They definitely did remove support for mapsme:// url scheme I guess it's time to move to universal links

gmarizy commented 10 months ago

Same problem here. Thanks to mapType, the workaround is easy.

hussenIbrahim commented 1 month ago

any updates ?

mattermoran commented 1 month ago

unfortunately maps.me developers removed the url scheme in newer versions of the app on android so doesn't look like I can get it to work atm. I think it's best to just remove support for it but keep ios as it still works

link https://github.com/mapsme/omim/issues/6386#issuecomment-1546859550

mattermoran commented 1 month ago

As this is out of my hands I just updated readme to mention maps.me only supported on ios and removed support for android one in the new version (v.3.3.1)

mattermoran commented 1 month ago

If you disagree and know a way to make it work let me know