Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google maps Windows phone place自动完成城市名称_Google Maps_Windows Phone 8.1 - Fatal编程技术网

Google maps Windows phone place自动完成城市名称

Google maps Windows phone place自动完成城市名称,google-maps,windows-phone-8.1,Google Maps,Windows Phone 8.1,我是Windows Phone Development 8.1的新手,我想创建一个文本框,它可以使用cities name(印度)执行place auto complete。 我试图安装程序包GMAPSAPINet0.13.4,但它给了我一个错误 错误是:您正试图以Windows Phone,Version=8.1为目标,但该包不包含任何与该框架兼容的程序集引用或内容文件 谢谢和问候, Kaushik.我认为这个软件包不起作用,因为你必须从谷歌控制台创建浏览器键,然后像下面这样调用 strin

我是Windows Phone Development 8.1的新手,我想创建一个文本框,它可以使用cities name(印度)执行place auto complete。 我试图安装程序包GMAPSAPINet0.13.4,但它给了我一个错误

错误是:您正试图以Windows Phone,Version=8.1为目标,但该包不包含任何与该框架兼容的程序集引用或内容文件

谢谢和问候,
Kaushik.

我认为这个软件包不起作用,因为你必须从谷歌控制台创建浏览器键,然后像下面这样调用

 string Entrypoint = String.Format("https://maps.googleapis.com/maps/api/place/autocomplete/json?input={0}&types=geocode&sensor=false&key={1}", txtCityName.Text.Trim(), Constant.GOOGLE_KEY);

首先,您需要创建一个如下所示的类

公共静态异步任务GetResponse(字符串url) { 尝试 { //printMsgOnConsole(“GetResponse中的Url=>”+Url); //创建客户端 HttpClient=新的HttpClient(); //PrintMsgConsole(“创建的HttpClient obj”+客户端)

现在您需要拨打如下所示的电话

字符串myhttp=”“+txtCityName.Text.Trim()+”&types=geocode&sensor=false&key=“+mykey

请注意 1] .txtCityName是文本框名称。 2] .mykey是由Google Api(网页)生成的密钥

这将返回一个json响应

谢谢,
Kaushik.

嗨,Kushal,你能提供我详细的代码吗?我是Windows Phone开发的新手,这是我的第一个应用程序。
            //Define URL. Replace current URL with your URL
            var uri = new Uri(url);
         //   CustomLogger.printMsgOnConsole("Create uri" + uri.ToString());
            //Call. Get response by Async
            var Response = await client.GetAsync(uri);
          //  CustomLogger.printMsgOnConsole("Calling get async");
            //Result & Code
            var statusCode = Response.StatusCode;
          //  CustomLogger.printMsgOnConsole("status code " + statusCode);
            //If Response is not Http 200 
            //then EnsureSuccessStatusCode will throw an exception
            Response.EnsureSuccessStatusCode();

            //Read the content of the response.
            //In here expected response is a string.
            //Accroding to Response you can change the Reading method.
            //like ReadAsStreamAsync etc..
            var ResponseText = await Response.Content.ReadAsStringAsync();

           // CustomLogger.printMsgOnConsole("Reponse in GetResponse =>" + ResponseText);

            return ResponseText;

        }