相关疑难解决方法(0)

Waze不会从Swift加载导航

我将Waze集成到我的Swift应用程序中,但当我点击按钮时,Waze打开但导航没有任何反应.我很高兴看到应用程序,而不是启动导航.

这是代码:

@IBAction func openWazeAction(_ sender: Any) {
    // open waze
    if UIApplication.shared.canOpenURL(URL(string: "waze://")!) {
        let urlStr = String(format: "waze://ul?ll=%f,%f&navigate=yes", (selectedBorne?.location?.x)!, (selectedBorne?.location?.y)!)

        print(urlStr)

        UIApplication.shared.open(URL(string: urlStr)!)
    } else {
        UIApplication.shared.open(URL(string: "http://itunes.apple.com/us/app/id323229106")!)
    }
}
Run Code Online (Sandbox Code Playgroud)

print(urlStr)返回正确的网址:waze://ul?ll=48.792914,2.366290&navigate=yes,但没有发生在Waze的应用程序.

(我把LSApplicationQueriesSchemes放在Info.plist文件中.)

这有什么不对?

openurl ios swift swift3 waze

6
推荐指数
1
解决办法
1593
查看次数

Waze Deep Links

我正在使用Xamarin Forms(跨平台)开发一个应用程序,我试图从我的应用程序打开Waze应用程序,通过纬度和经度.
它很好地打开了Waze,但是Waze刚打开,它没有试图找到我通过的地址或纬度/经度.

关于我如何使它工作的一些想法?

--- 编辑 ---
最后,它工作,使用@SushiHangover的想法,我设法达到了预期的结果.最终的代码在这里:

public static Task<bool> OpenWazeAndroid(decimal latitude, decimal longitude, string address)
        {
            if (IsAndroid())
            {
                try
                {
                    var lat = latitude.ToString().Replace(",",".");
                    var longi = longitude.ToString().Replace(",", "."); 
                    const string wazePrefix = "waze://";
                    Android.Content.Intent intent = new Android.Content.Intent(Android.Content.Intent.ActionView, Android.Net.Uri.Parse(wazePrefix));  
                    string wazeURL = ("https://waze.com/ul?q=" + address + "&ll=" + lat + "," + longi + "&z=8&navigate=yes");
                    wazeURL = wazeURL.Replace(" ", "%20");
                    var resolveInfo = Android.App.Application.Context.PackageManager.ResolveActivi??ty(intent, 0);
                    Android.Net.Uri wazeUri;
                    if (resolveInfo != null)
                    {
                        wazeUri = Android.Net.Uri.Parse(wazeURL);
                    } …
Run Code Online (Sandbox Code Playgroud)

c# android xamarin.android xamarin waze

5
推荐指数
0
解决办法
1542
查看次数

标签 统计

waze ×2

android ×1

c# ×1

ios ×1

openurl ×1

swift ×1

swift3 ×1

xamarin ×1

xamarin.android ×1