dpa99c / phonegap-launch-navigator

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

appSelection optional parameter not working #140

Closed jyotigupta007 closed 7 years ago

jyotigupta007 commented 7 years ago

Hello, I want to limit the number of map application to be shown on the action sheet when selecting the map application to only launchnavigator.APP.GOOGLE_MAPS launchnavigator.APP.WAZE and launchnavigator.APP.APPLE_MAPS. I tried it by passing optional parameter "appSelection" in launchnavigator.navigate(destination, options). In the object "appSelection" I passed "list" as an array with above mentioned names. But it seems the code is not working...Its neither giving any error. It had no effect of the code. I am really eager and in a hurry to know the correct approach to achieve this task. Please reply ASAP Thanks

dpa99c commented 7 years ago

The list should be passed as options.appSelection.list, for example:

launchnavigator.navigate("London", {
    appSelection:{
        list: [
            launchnavigator.APP.GOOGLE_MAPS,
            launchnavigator.APP.WAZE,
            launchnavigator.APP.APPLE_MAPS
        ]
    }
});

A working example can be seen in the AdvancedExample in the example project repo which illustrates usage of this option

image

image

jyotigupta007 commented 7 years ago

Hello, I am grateful for your reply but it still does not work. Let me tell you that I am using it in ionic+angular phone application. I have tried all ways of coding like :-


launchnavigator.navigate([payload.r_des_lat,payload.r_des_lng], appSelectionCallback , {appSelection:{list: [launchnavigator.APP.GOOGLE_MAPS]}}); ==> doesnot work, no action sheet is launched the screen gets hanged

launchnavigator.navigate([payload.r_src_lat,payload.r_src_lng], { appSelectionCallback , appSelection:{list: [ launchnavigator.APP.GOOGLE_MAPS]}}); ==> launchnavigator works..but app selection is not working...all the apps get listed launchnavigator.navigate([payload.r_des_lat,payload.r_des_lng], {appSelection:{list: [launchnavigator.APP.GOOGLE_MAPS]}}); ==> doesnot work, no action sheet is launched the screen gets hanged


where payload.r_src_lat and payload.r_src_lng are latitude and longitude of the address and appSelectionCallback is the success callback

I have gone the the link you provided to check the advance examples, I used it this way :

var opts = { successCallback: function(){ console.log("Launched navigator app"); }, errorCallback: function(err){ console.log("Error launching navigator app: ",err); }, appSelection:{ dialogHeaderText: "Custom header", cancelButtonText: "Custom cancel text", list: ['launchnavigator.APP.GOOGLE_MAPS'], callback: function(app){ console.info("User selected app: "+app); } }, enableDebug: true
}; launchnavigator.navigate([payload.r_src_lat,payload.r_src_lng], opts); But got an error : Error launching navigator app: No apps in selection list are available

dpa99c commented 7 years ago

Please make sure you are using the most recent version of the plugin (v4).

Also please confirm whether you are able validate that the plugin is working within the example project.

dpa99c commented 7 years ago

Closed due to no response from OP

Alb93 commented 7 years ago

Also here problem with Android device on options passed to navigate method. The plugin version is 4.0.2 and I use it with ionic framework.

My intent is to change the text shows by the plugin (i.e. dialogHeaderText) but no attempts were succesful.

dpa99c commented 7 years ago

@Alb93 This can be seen working in the AdvancedExample in the example repo.

If you are using Ionic Native, make sure the Typescript wrapper is up-to-date as the options object structure has changed in v4 of this plugin.

Alb93 commented 7 years ago

@dpa99c How I can check this?

I've downloaded the plugin by following the ionic standard guide about 2 days ago. I've tried to replicate the object structure in this way let opts:LaunchNavigatorOptions = { appSelection:{ dialogHeaderText: "Custom header", cancelButtonText: "Custom cancel text" } };

and in some other ways but still nothing.

dpa99c commented 7 years ago

It's possible there's a bug in the updated Ionic Native Typescript wrapper when it comes to mapping of the revised options object. You can try invoking the plugin directly:

declare var launchnavigator : any;

launchnavigator.navigate("some destination", {
    appSelection:{
        dialogHeaderText: "Custom header",
        cancelButtonText: "Custom cancel text",
    }
});

I would recommend debugging the JS by connecting a remote debugger session to the Webview (Safari/Chrome).

Alb93 commented 7 years ago

declare var launchnavigator : any;

This is nice and seems to work well.

How and where I can report the presumable "bug in the updated Ionic Native Typescript wrapper "?

dpa99c commented 7 years ago

Typescript wrapper is here so you can open any issues here.