npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

capacitor-googlemaps-native

v0.0.6

Published

Plugin using native Maps API for Android and iOS.

Downloads

10

Readme

Why ?

Maps SDK for Android & iOS bring better performance and offline caching compared to JS SDK and they're free to use.

Project Status

| Features | Android |     iOS     | Current Status | Pending | | ------------- | ------------- | ------------- | ------------- | ------------- | | Map Objects | | | create() | | Markers | WIP | WIP | addMarker() is implemented which allows you to show a marker with default tooltip design. Marker icons can be set using URL. Event: didTap | Info windows | | Business & POIs | | | Tap on any places of interest Event: didTapPOIWithPlaceID | | Lite Mode | | | create(liteMode?: boolean) | Not available for iOS | Street View | | WIP | createStreetView() | | Launch URL | | | | | Controls & Gestures | WIP | WIP | settings() allow to set all the map UI settings. | Allow users to get current state of map settings. | Events | WIP | WIP | | | Camera & View | | |setCamera() | Allow users to get current camera position | Location | WIP | WIP | android: enableCurrentLocation() onMyLocationButtonClick, onMyLocationClick iOS: enableCurrentLocation(), myLocation()| API wrapping needs improvement so that it becomes consistent for both platforms | | Drawing on Map | WIP | WIP | | Shapes, Ground Overlays, Tile Overlays | Utility Library | | | |

Getting Started

Installation

Install package from npm

npm i --save capacitor-googlemaps-native

Install plugin dependencies in native platforms

npx cap sync

Set up Google API Keys

You'll have two API keys by the end of this step. Lets proceed:

Add API key to your App

<application>
...

<meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="YOUR_ANDROID_MAPS_API_KEY"/>
...
</application>
  • On iOS, this step is little different and mentioned below.

Regsiter Plugin on Android

your-plugin/android/src/main/java/MainActivity.java

...
/* Import */
import com.hemangkumar.capacitorgooglemaps.CapacitorGoogleMaps;
...

public class MainActivity extends BridgeActivity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

      this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{

      /* Add Plugin Class */
      add(CapacitorGoogleMaps.class);


     }});
  }
}

Importing & Initializing the plugin

const { CapacitorGoogleMaps } = Plugins;

/* initialize() is important for iOS,
  Android doesn't need any initialization.
*/
await CapacitorGoogleMaps.initialize({
 key: "YOUR_IOS_API_KEY"
});

Usage

An example with Angular

component.html

<div id="map" #map></div>

component.css

#map {
    margin: 2em 1em;
    height: 250px;
    border: 1px solid black;
  }

component.ts

@ViewChild('map') mapView: ElementRef;

async ionViewDidEnter() {
    const boundingRect = this.mapView.nativeElement.getBoundingClientRect() as DOMRect;

    CapacitorGoogleMaps.create({
      width: Math.round(boundingRect.width),
      height: Math.round(boundingRect.height),
      x: Math.round(boundingRect.x),
      y: Math.round(boundingRect.y),
      latitude: -33.86,
      longitude: 151.20,
      zoom: 12
    });

    CapacitorGoogleMaps.addListener("onMapReady", async function() {

      /*
        We can do all the magic here when map is ready
      */

      CapacitorGoogleMaps.addMarker({
        latitude: -33.86,
        longitude: 151.20,
        title: "Custom Title",
        snippet: "Custom Snippet",
      });

      CapacitorGoogleMaps.setMapType({
        "type": "normal"
      })
    })
}

ionViewDidLeave() {
    CapacitorGoogleMaps.close();
}

Known Issues