FuseJS/Maps Module (JS)

Hi guys,

So I’m trying to use FuseJS/Maps Module (JS).

I’m using the example shown in the documentation

var Maps = require("FuseJS/Maps");
Maps.searchNear(59.9117715, 10.7400957, "pizza restaurant");

I run the app on the Android device and I can access the map, but on iOS nothing happens.
There is nothing on the documentation that says that this only works on Android, so I suppose it’s for both platforms. So I might be missing something on iOS. Can you guys shed me some light on this?

__

As a foot note, in the documentation openAct(), searchNear(), searchNearby(), the example is always showing Maps.searchNear(...);.

Hey Ana! If you can upload a small, self-contained project that reproduces this issue, it’ll make it a lot easier to test on our end. You can use this Dropbox to send it to us in, if you wish to keep the files private: https://www.dropbox.com/request/ZgndLtJQm5eGzG9cicGK

Hi Bent.

Already sent you a small project where it works on Android but not iOS.

It’s pretty simple, a button when clicked opens the map.

Just like this:

MainView.ux

<App>


	<Panel>
		<NativeViewHost>
	   		<Button Text="Native button" Clicked="{buttonClick}"/>
		</NativeViewHost>
	</Panel>
	<JavaScript>
	
	var Maps = require("FuseJS/Maps");

	function buttonClick(){
		Maps.searchNear(59.9117715, 10.7400957, "pizza restaurant");	
	}

	module.exports = {
		buttonClick : buttonClick
	}
	</JavaScript>
	
</App>

.unoproj

{
  "RootNamespace":"",
  "Packages": [
    "Fuse",
    "FuseJS",
    "Fuse.Launcher"

  ],
  "Includes": [
    "*"
  ]
}

Hi!

Any news on this?

Thanks

Hi Ana,

did my testing, and this code works on both platforms:

<App>
    <JavaScript>
    
    var Maps = require("FuseJS/Maps");

    function openAt() {
        console.log('open at');
        Maps.openAt(59.9117715, 10.7400957);
    }
    function searchNearby() {
        console.log('search neaby');
        Maps.searchNearby(encodeURI("Fusetools"));
    }
    function searchNear() {
        console.log('search near');
        Maps.searchNear(59.9117715, 10.7400957, encodeURI("pizza restaurant"));
    }

    module.exports = {
        openAt: openAt,
        searchNearby: searchNearby,
        searchNear: searchNear
    }
    </JavaScript>
    
    <Panel>
        <NativeViewHost>
            <StackPanel ItemSpacing="16" Alignment="VerticalCenter">
                <Button Text="open at" Clicked="{openAt}" />
                <Button Text="search nearby" Clicked="{searchNearby}"/>
                <Button Text="search near" Clicked="{searchNear}"/>
            </StackPanel>
        </NativeViewHost>
    </Panel>
</App>

The only problem with your original code was that the query string part of the searchNear() function included a space in it. And since this lands in an InterApp call that opens an http://maps.apple.com/... link on iOS (which the device then opens in Maps application), the URL parameters obviously have to be urlencoded.

We should probably at least make a note of this in the docs, if not anything else. I will log a ticket on that.

Thank you for the time spent debugging this.

Yes, you should change this on the docs because I was trying the example that is there. And couldn’t figure out what was happening.

Just tested it and now it’s working.

Thank you so much (once again)!