dpa99c / phonegap-launch-navigator

Phonegap/Cordova plugin which launches native route navigation apps for Android, iOS and Windows
369 stars 131 forks source link

Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. #215

Closed madc0w closed 5 years ago

madc0w commented 5 years ago

I'm submitting a ... (check one with "x"):

Bug report

Current behavior:

On Android, call to launchnavigator.navigate([49.6087477, 6.136253200000056], function() { console.log("launchnavigator success"); }, function(err) { console.error("launchnavigator failed", err); }, {});

results in the error callback being called. Error message is:

Exception occurred: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

when debug is enabled, console output is:

LaunchNavigatorPlugin: Plugin action=availableApps
VM401:1 LaunchNavigatorPlugin: Plugin action=navigate
VM402:1 LaunchNavigator: Called navigate() with params; app=google_maps; dType=pos; dest=[49.6087477,6.136253200000056]; destNickname=null; sType=none; start=null; startNickname=null; transportMode=null; launchMode=maps; extras=null
VM403:1 LaunchNavigator: Using Google Maps to navigate to 49.6087477,6.136253200000056 from current location in maps mode
VM404:1 LaunchNavigator: URI: http://maps.google.com/maps?daddr=49.6087477,6.136253200000056
VM405:1 LaunchNavigatorPlugin: Exception occurred: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

Expected behavior:

Open navigation app selection dialog

Steps to reproduce:

execute the above code from console

Environment information

uk.co.workingedge.phonegap.plugin.launchnavigator version 5.0.2

Meteor 1.8.0.1 running Cordova app on device Android 6.0.1

nprail commented 5 years ago

I'm having this same issue.

dpa99c commented 5 years ago

Ok, I'll patch across the fix for https://github.com/dpa99c/react-native-launch-navigator/issues/1 when I get a minute

T3chTobi commented 5 years ago

Same issue, I use it without react, is there a solution too?

Android 4.4.2

dpa99c commented 5 years ago

Published in 5.0.3 which is now latest version on npm: https://www.npmjs.com/package/uk.co.workingedge.phonegap.plugin.launchnavigator