<h1 align="center">
  <img alt="OpenHPS" src="https://openhps.org/images/logo_text-512.png" width="40%" /><br />
  @openhps/capacitor-geolocation
</h1>
<p align="center">
    <a href="https://github.com/OpenHPS/openhps-capacitor/actions/workflows/main.yml" target="_blank">
        <img alt="Build Status" src="https://github.com/OpenHPS/openhps-capacitor/actions/workflows/main.yml/badge.svg">
    </a>
    <a href="https://codecov.io/gh/OpenHPS/openhps-capacitor">
        <img src="https://codecov.io/gh/OpenHPS/openhps-capacitor/branch/master/graph/badge.svg"/>
    </a>
    <a href="https://codeclimate.com/github/OpenHPS/openhps-capacitor/" target="_blank">
        <img alt="Maintainability" src="https://img.shields.io/codeclimate/maintainability/OpenHPS/openhps-capacitor">
    </a>
    <a href="https://badge.fury.io/js/@openhps%2Fcapacitor-geolocation">
        <img src="https://badge.fury.io/js/@openhps%2Fcapacitor-geolocation" alt="npm version" height="18">
    </a>
</p>

<h3 align="center">
    <a href="https://github.com/OpenHPS/openhps-core">@openhps/core</a> &mdash; <a href="https://openhps.org/docs/capacitor">API</a>
</h3>

<br />
This component uses the Web Geolocation API to retrieve the absolute position returned by the device.

## Getting Started

If you have [npm installed](https://www.npmjs.com/get-npm), start using @openhps/capacitor-geolocation with the following command.

```bash
npm install @openhps/capacitor-geolocation --save
```

## Requirements

- `@openhps/core`
    - E.g. `https://unpkg.com/@openhps/core@latest`

## Usage

The Geolocation Web API requires a secure environent (HTTPS) and a user interaction to be triggered.

```typescript
ModelBuilder.create().from(new GeolocationSourceNode({})).to(/* ... */).build();
```

### Android

https://capacitorjs.com/docs/apis/geolocation

## Contributors

The framework is open source and was developed as part of the PhD of Maxim Van de Wynckel under the supervision of Prof. Dr. Beat Signer. It is currently maintained by [MVdW-Software](https://mvdw-software.com).

## Contributing

Use of OpenHPS, contributions and feedback is highly appreciated. Please read our [contributing guidelines](CONTRIBUTING.md) for more information.

## License

Copyright (C) 2019-2026 Maxim Van de Wynckel & Vrije Universiteit Brussel

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
