当前位置: 首页 > 软件库 > 手机/移动开发 > >

nativescript-google-place-picker

授权协议 View license
开发语言 JavaScript TypeScript
所属分类 手机/移动开发
软件类型 开源软件
地区 不详
投 递 者 顾琛
操作系统 iOS
开源组织
适用人群 未知
 软件概览

NativeScript plugin for Google Place Picker

This is a cross-platform (iOS & Android) Nativescript plugin for the Google Places Picker

Prerequisites

iOS - Cocoapods is installed

Android - Latest Google Play services SDK installed

Google Places API Key - Go to the Google Developers Console, create a project, and enable the Google Places API for Android and Google Places API for iOS APIs. Then under credentials, create an API key.

Google Maps API Key - Go to the Google Developers Console, create a project, and enable the Google Maps Android API and Google Maps SDK for iOS APIs. Then under credentials, create an API key.

Installation

Install the plugin using the NativeScript CLI tooling

tns plugin add nativescript-google-place-picker

Setup Google Maps API

Setup Android API Key

Add API key to app manifest(AndroidManifest.xml). Refer to Android/add key

The plugin will default to latest available version of the Android play-services-places SDK. If you need to change the version, you can add a project ext property googlePlayServicesVersion like so:

//   /app/App_Resources/Android/app.gradle

project.ext {
    googlePlayServicesVersion = "+"
}

Setup iOS API Key

In the main script of your app app.js, use the following to add the API key (providing your key in place of PUT_API_KEY_HERE)

if(application.ios) {
  PlacePicker.iosProvideAPIKey("PUT_API_KEY_HERE");
}

If you are using Angular, you need to modify the app.module.ts as follows:

import * as platform from "platform";
import {PlacePicker} from "nativescript-google-place-picker"
....
if (platform.isIOS) { 
  PlacePicker.iosProvideAPIKey("PUT_API_KEY_HERE");
}

Usage Example

...
public onShowPicker() {
  var picker = new PlacePicker()

  picker.present()
      .then((r)=>{
          console.log(r.latitude)
          console.log(r.longitude)
      })
      .catch((e)=>{
          console.log("Error: "+e);
      })
}
...
 相关资料
  • react-native-google-place-picker React Native Wrapper of Google Place Picker for iOS + Android. iOS Android Table of contents Install iOS Android Usage Example Response object Install npm install reac

  • nativescript-google-maps-utils NativeScript Google Maps SDK utility library to support features such as marker clustering, heatmap, ... State Android implemented. iOS not implemented. Dependencies nat

  • NativeScript plugin for the Google Maps SDK This is a cross-platform (iOS & Android) Nativescript plugin for the Google Maps API. Prerequisites iOS - Cocoapods must be installed. Android - The latest

  • 我有一个地图,如果用户触摸地图,我将只放置一个pin,我这样做了,但当用户想要更改pin位置时,他应该将pin拖动到新位置 当用户触摸另一个地方时,我想要的是删除之前的引脚并将新引脚放在新的地方而不拖动它。 我该怎么做?? 这是我的代码: 和MyItemizedOverlay

  • 此几何管理器通过将窗口小部件放置在父窗口小部件中的特定位置来组织窗口小部件。 语法 (Syntax) widget.place( place_options ) 以下是可能的选项列表 - anchor - 小部件其他选项的确切位置是指:可以是N,E,S,W,NE,NW,SE或SW,罗盘方向指示小部件的角落和侧面; 默认为NW(小部件的左上角) bordermode - INSIDE(默认值),表

  • 当我试图使用nativescript 7.2.0 Angular 8和nativescript-google-maps-sdk 3.0.2: 在android模拟器上替换谷歌地图时,我遇到了这个错误 js:错误错误:未捕获(在promise中):typeerror:nativescript_core__webpack_imported_module_1_。属性不是构造函数js:typeerror: