Compare commits

..
Author SHA1 Message Date
Daniel SoglandGitHub d98a0225b2 6.0.0-alpha.3 2022-06-03 18:04:02 +00:00
Daniel SoglandGitHub 81bde3fae1 Revert "bump angular and ts"
This reverts commit 3d5083bfa0.
2022-06-03 18:03:22 +00:00
Daniel SoglandGitHub c4127357be 6.0.0-alpha.2 2022-06-03 17:57:48 +00:00
Daniel SoglandGitHub 96aa615c81 reset changed compiler options 2022-06-03 17:57:34 +00:00
Daniel SoglandGitHub 5e6ab2a6cc 6.0.0-alpha.1 2022-06-03 17:53:05 +00:00
Daniel SoglandGitHub 667902ff73 bump minimum core version 2022-06-03 17:50:28 +00:00
Daniel SoglandGitHub 94b2e3deae 6.0.0-alpha.0 2022-06-03 17:42:58 +00:00
Daniel SoglandGitHub 745942c43a remove aot config 2022-06-03 17:26:49 +00:00
Daniel SoglandGitHub 0b1776c08e upgrade generated es targets 2022-06-03 17:21:55 +00:00
Daniel SoglandGitHub 25951b9d5e update library author 2022-06-03 17:21:03 +00:00
Daniel SoglandGitHub a2408c3fe3 try out angular compiler options 2022-06-03 17:11:59 +00:00
Daniel SoglandGitHub 3d5083bfa0 bump angular and ts 2022-06-03 17:11:40 +00:00
Daniel SoglandGitHub de726bc1e7 set enableIvy to true 2022-06-03 16:58:43 +00:00
422 changed files with 31093 additions and 23564 deletions
+4
View File
@@ -0,0 +1,4 @@
scripts/
docs/
dist/
node_modules/
+13
View File
@@ -0,0 +1,13 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "jsdoc"],
"extends": ["plugin:@typescript-eslint/recommended", "prettier", "plugin:jsdoc/recommended"],
"rules": {
"@typescript-eslint/no-unused-vars": ["off"],
"@typescript-eslint/no-explicit-any": ["warn"],
"@typescript-eslint/no-empty-function": ["off"],
"@typescript-eslint/ban-types": ["warn"],
"@typescript-eslint/no-empty-interface": ["warn"],
"@typescript-eslint/no-namespace": ["off"]
}
}
+13 -27
View File
@@ -1,33 +1,19 @@
# Contributing to Awesome Cordova Plugins
# Contributing to Ionic Native
## Have an issue?
#### There are no rules, but here are a few things to consider:
###### Before you submit an issue:
* Do a quick search to see if there are similar issues
* Make sure that you are waiting for `deviceready` to fire before interacting with any plugin. If you are using Ionic, this can be done using [the `Platform.ready()` function](http://ionicframework.com/docs/api/platform/Platform/#ready).
* **Check that you are using the latest version of** `ionic-native`, you can install the latest version by running `npm i --save @ionic-native/core@latest`
Before submitting an issue:
###### Still having problems? submit an issue with the following details:
* Short description of the issue
* Steps to reproduce
* Stack trace (if available)
- Search existing issues to avoid duplicates
- Make sure you are using the latest version of `@awesome-cordova-plugins/core`
- Ensure `deviceready` has fired before interacting with any plugin
Still having problems? [Open an issue](https://github.com/danielsogl/awesome-cordova-plugins/issues/new/choose) with:
## Feature request?
Have a plugin you'd like to see supported? Since Ionic Native is a thin wrapper around existing Cordova plugins, adding support for new plugins is as easy as creating a new wrapper for whatever plugin you'd like to add.
- Short description of the issue
- Steps to reproduce
- Stack trace (if available)
**Please do not submit support requests as issues.** Use the [Discussions](https://github.com/danielsogl/awesome-cordova-plugins/discussions) section instead.
## Want to add a plugin?
Awesome Cordova Plugins is a set of wrappers for Cordova plugins. Adding support for a new plugin is straightforward:
1. Run `npm run plugin:create -- -n PluginName` to scaffold a new plugin wrapper
2. Implement the wrapper following the patterns in existing plugins
3. Submit a pull request
## Development setup
```bash
npm ci
npm run build
npm test
```
Take a look at our [Developer Guide](https://github.com/ionic-team/ionic-native/blob/master/DEVELOPER.md) for more info on adding new plugins.
+28
View File
@@ -0,0 +1,28 @@
**I'm submitting a ...** (check one with "x")
[ ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://ionicworldwide.herokuapp.com/
**Current behavior:**
<!-- Describe how the bug manifests. -->
**Expected behavior:**
<!-- Describe what the behavior would be without the bug. -->
**Steps to reproduce:**
<!-- If you are able to illustrate the bug or feature request with an example, please provide steps to reproduce. -->
**Related code:**
```
insert any relevant code here
```
**Other information:**
<!-- List any other information that is relevant to your issue. Stack traces, related issues, suggestions on how to fix, Stack Overflow links, forum links, etc. -->
**Ionic info:** (run `ionic info` from a terminal/cmd prompt and paste output below):
```
insert the output from ionic info here
```
-63
View File
@@ -1,63 +0,0 @@
name: Bug Report
description: Report a bug in an Awesome Cordova Plugins wrapper
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to report a bug! Please fill out the sections below.
- type: input
id: plugin
attributes:
label: Plugin
description: Which @awesome-cordova-plugins/* package is affected?
placeholder: e.g. @awesome-cordova-plugins/camera
validations:
required: true
- type: textarea
id: current-behavior
attributes:
label: Current behavior
description: Describe what happens.
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: Describe what you expected to happen.
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to reproduce
description: How can we reproduce the issue?
validations:
required: true
- type: textarea
id: environment
attributes:
label: Environment
description: |
Relevant versions (fill in what you can):
value: |
- @awesome-cordova-plugins/core version:
- Cordova / Capacitor version:
- Angular version:
- Platform (iOS / Android / Browser):
validations:
required: false
- type: textarea
id: additional
attributes:
label: Additional context
description: Any other information, stack traces, or screenshots.
validations:
required: false
-5
View File
@@ -1,5 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: Support & Questions
url: https://github.com/danielsogl/awesome-cordova-plugins/discussions
about: Please use Discussions for support requests and questions.
@@ -1,35 +0,0 @@
name: Feature Request
description: Suggest a new plugin wrapper or enhancement
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
Have a plugin you'd like to see supported? Since Awesome Cordova Plugins
is a set of wrappers for Cordova plugins, adding support is as easy as
creating a new wrapper.
- type: textarea
id: description
attributes:
label: Description
description: What plugin or feature would you like to see added or improved?
validations:
required: true
- type: input
id: plugin-repo
attributes:
label: Cordova plugin repository
description: Link to the Cordova plugin (if requesting a new wrapper).
placeholder: https://github.com/example/cordova-plugin-example
validations:
required: false
- type: textarea
id: use-case
attributes:
label: Use case
description: Describe why this would be useful.
validations:
required: false
+16 -19
View File
@@ -1,27 +1,21 @@
name: CI
name: Node CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.3.1
strategy:
matrix:
node-version: [14.x]
- name: Setup Node.js
uses: actions/setup-node@v4.4.0
steps:
- uses: actions/checkout@v3.0.2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.2.0
with:
node-version: 22
cache: npm
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
@@ -29,8 +23,11 @@ jobs:
- name: Lint
run: npm run lint -- --quiet
- name: Test
run: npm test
- name: Build
run: npm run build
- name: Test
run: npm run test
- name: Readmes
run: npm run readmes
+35
View File
@@ -0,0 +1,35 @@
name: Release Packages
on:
workflow_dispatch:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.0.2
- uses: actions/setup-node@v3.2.0
with:
node-version: 14
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Readmes
run: npm run readmes
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.0.2
- uses: actions/setup-node@v3.2.0
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run shipit
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
-39
View File
@@ -1,39 +0,0 @@
name: Publish to npm
on:
workflow_call:
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.3.1
- name: Setup Node.js
uses: actions/setup-node@v4.4.0
with:
node-version: 22
cache: npm
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint -- --quiet
- name: Test
run: npm test
- name: Build
run: npm run build
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm run npmpub
-34
View File
@@ -1,34 +0,0 @@
name: Release Please
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
version: ${{ steps.release.outputs.version }}
steps:
- name: Run Release Please
id: release
uses: googleapis/release-please-action@v4.4.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
publish:
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
uses: ./.github/workflows/publish.yml
secrets: inherit
+14 -22
View File
@@ -1,30 +1,22 @@
name: Stale issues and PRs
name: Mark stale issues and pull requests
on:
schedule:
- cron: "0 6 * * 1"
permissions:
issues: write
pull-requests: write
- cron: '0 0 * * *'
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v9.1.0
with:
stale-issue-message: >
This issue has been automatically marked as inactive due to lack of
recent activity. It will be closed in 14 days if no further activity
occurs.
stale-pr-message: >
This PR has been automatically marked as inactive due to lack of
recent activity. It will be closed in 14 days if no further activity
occurs.
stale-issue-label: "status: inactive"
stale-pr-label: "status: inactive"
days-before-stale: 60
days-before-close: 14
exempt-issue-labels: "pinned,keep"
exempt-pr-labels: "pinned,keep"
- uses: actions/stale@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'There has been no recent activity and this issue has been marked inactive.'
stale-pr-message: 'There has been no recent activity and this PR has been marked inactive.'
stale-issue-label: 'status: inactive'
stale-pr-label: 'status: inactive'
+4
View File
@@ -2,6 +2,10 @@
node_modules/
.idea
.tmp
aot/
scripts/ionic-native-bower
scripts/docs-json/*.json
scripts/docs-json/typedoc-docs
dist/
src/@awesome-cordova-plugins/plugins/**/ngx
*.d.ts
+1
View File
@@ -0,0 +1 @@
_
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install lint-staged
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npm test
+1 -1
View File
@@ -4,7 +4,7 @@ node_modules
.vscode
dist
CHANGELOG.md
lefthook.yml
.husky
.prettierignore
LICENSE
docs/
-3
View File
@@ -1,3 +0,0 @@
{
".": "9.0.1"
}
+8 -986
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,6 +1,6 @@
# Awesome Cordova Plugins Developer Guide
# Ionic Native Developer Guide
This is a short guide on creating new plugin wrappers for Awesome Cordova Plugins.
This is a short guide on creating new plugin wrappers for Ionic Native.
## Creating Plugin Wrappers
+118 -44
View File
@@ -1,4 +1,4 @@
![](https://img.shields.io/npm/v/@awesome-cordova-plugins/core.svg)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) ![](https://img.shields.io/npm/v/@awesome-cordova-plugins/core.svg)
# Awesome Cordova Plugins
@@ -10,7 +10,7 @@ To learn more about the reasons why Ionic Native was renamed to Awesome Cordova
## Capacitor Support
In addition to Cordova, Awesome Cordova Plugins also works with [Capacitor](https://capacitorjs.com), Ionic's official native runtime. Basic usage below. For complete details, [see the Capacitor documentation](https://capacitorjs.com/docs/v2/cordova/using-cordova-plugins).
In addition to Cordova, Awesome Cordova Plugins also works with [Capacitor](https://capacitor.ionicframework.com), Ionic's official native runtime. Basic usage below. For complete details, [see the Capacitor documentation](https://capacitor.ionicframework.com/docs/cordova/using-cordova-plugins).
## Installation
@@ -28,53 +28,58 @@ For the full Awesome Cordova Plugins documentation, please visit [https://ionicf
### Basic Usage
#### Ionic/Angular apps (Standalone)
#### Ionic/Angular apps
Angular v14+ uses standalone components by default. To use a plugin, register it as a provider in your application bootstrap and inject it using Angular's `inject()` function.
To use a plugin, import and add the plugin provider to your `@NgModule`, and then inject it where you wish to use it.
Make sure to import the injectable class from the `/ngx` directory as shown in the following examples:
```typescript
// main.ts
import { bootstrapApplication } from '@angular/platform-browser';
// app.module.ts
import { Camera } from '@awesome-cordova-plugins/camera/ngx';
import { Geolocation } from '@awesome-cordova-plugins/geolocation/ngx';
import { AppComponent } from './app/app.component';
bootstrapApplication(AppComponent, {
providers: [Camera, Geolocation],
});
...
@NgModule({
...
providers: [
...
Camera
...
]
...
})
export class AppModule { }
```
```typescript
import { Component, OnInit } from '@angular/core';
import { inject } from '@angular/core';
import { Geolocation } from '@awesome-cordova-plugins/geolocation/ngx';
import { Platform } from '@ionic/angular';
import { Platform } from 'ionic-angular';
@Component({
selector: 'app-my-component',
standalone: true,
template: `<p>My Component</p>`,
})
export class MyComponent implements OnInit {
private geolocation = inject(Geolocation);
private platform = inject(Platform);
@Component({ ... })
export class MyComponent {
async ngOnInit() {
await this.platform.ready();
constructor(private geolocation: Geolocation, private platform: Platform) {
// get position
const pos = await this.geolocation.getCurrentPosition();
console.log(`lat: ${pos.coords.latitude}, lon: ${pos.coords.longitude}`);
this.platform.ready().then(() => {
// watch position
const watch = this.geolocation.watchPosition().subscribe((pos) => {
console.log(`lat: ${pos.coords.latitude}, lon: ${pos.coords.longitude}`);
// get position
this.geolocation.getCurrentPosition().then(pos => {
console.log(`lat: ${pos.coords.latitude}, lon: ${pos.coords.longitude}`)
});
// watch position
const watch = geolocation.watchPosition().subscribe(pos => {
console.log(`lat: ${pos.coords.latitude}, lon: ${pos.coords.longitude}`)
});
// to stop watching
watch.unsubscribe();
});
// to stop watching
watch.unsubscribe();
}
}
```
@@ -121,9 +126,9 @@ const Tab1: React.FC = () => {
};
```
#### ES2015+/TypeScript (without Angular)
#### ES2015+/TypeScript
These modules can also be used without Angular by calling static methods directly:
These modules can work in any ES2015+/TypeScript app (including Angular/Ionic apps). To use any plugin, import the class from the appropriate package, and use it's static methods.
```js
import { Camera } from '@awesome-cordova-plugins/camera';
@@ -135,17 +140,64 @@ document.addEventListener('deviceready', () => {
});
```
#### AngularJS
Awesome Cordova Plugins generates an AngularJS module in runtime and prepares a service for each plugin. To use the plugins in your AngularJS app:
1. Download the latest bundle from the [Github releases](https://github.com/danielsogl/awesome-cordova-plugins/releases) page.
2. Include it in `index.html` before your app's code.
3. Inject `ionic.native` module in your app.
4. Inject any plugin you would like to use with a `$cordova` prefix.
```js
angular.module('myApp', ['ionic.native']).controller('MyPageController', function ($cordovaCamera) {
$cordovaCamera.getPicture().then(
function (data) {
console.log('Took a picture!', data);
},
function (err) {
console.log('Error occurred while taking a picture', err);
}
);
});
```
#### Vanilla JS
To use Awesome Cordova Plugins in any other setup:
1. Download the latest bundle from the [Github releases](https://github.com/danielsogl/awesome-cordova-plugins/releases) page.
2. Include it in `index.html` before your app's code.
3. Access any plugin using the global `IonicNative` variable.
```js
document.addEventListener('deviceready', function () {
IonicNative.Camera.getPicture().then(
function (data) {
console.log('Took a picture!', data);
},
function (err) {
console.log('Error occurred while taking a picture', err);
}
);
});
```
### Mocking and Browser Development (Ionic/Angular apps only)
Awesome Cordova Plugins makes it possible to mock plugins and develop nearly the entirety of your app in the browser or in `ionic serve`.
To do this, you need to provide a mock implementation of the plugins you wish to use. Here's an example of mocking the `Camera` plugin to return a stock image while in development:
First create a mock class that extends the `Camera` class:
First import the `Camera` class in your `src/app/app.module.ts` file:
```typescript
import { Camera } from '@awesome-cordova-plugins/camera/ngx';
```
Then create a new class that extends the `Camera` class with a mock implementation:
```typescript
class CameraMock extends Camera {
getPicture(options) {
return new Promise((resolve, reject) => {
@@ -155,23 +207,45 @@ class CameraMock extends Camera {
}
```
Then override the `Camera` provider in your application bootstrap:
Finally, override the previous `Camera` class in your `providers` for this module:
```typescript
// main.ts
import { bootstrapApplication } from '@angular/platform-browser';
providers: [{ provide: Camera, useClass: CameraMock }];
```
Here's the full example:
```typescript
import { ErrorHandler, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { Camera } from '@awesome-cordova-plugins/camera/ngx';
import { AppComponent } from './app/app.component';
import { HomePage } from '../pages/home/home';
import { MyApp } from './app.component';
class CameraMock extends Camera {
getPicture(options) {
return Promise.resolve('BASE_64_ENCODED_DATA_GOES_HERE');
return new Promise((resolve, reject) => {
resolve('BASE_64_ENCODED_DATA_GOES_HERE');
});
}
}
bootstrapApplication(AppComponent, {
providers: [{ provide: Camera, useClass: CameraMock }],
});
@NgModule({
declarations: [MyApp, HomePage],
imports: [BrowserModule, IonicModule.forRoot(MyApp)],
bootstrap: [IonicApp],
entryComponents: [MyApp, HomePage],
providers: [
{ provide: ErrorHandler, useClass: IonicErrorHandler },
{ provide: Camera, useClass: CameraMock },
],
})
export class AppModule {}
```
### Runtime Diagnostics
@@ -182,7 +256,7 @@ Spent way too long diagnosing an issue only to realize a plugin wasn't firing or
## Plugin Missing?
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/danielsogl/awesome-cordova-plugins/blob/main/DEVELOPER.md) for more on how to contribute. :heart:
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/danielsogl/awesome-cordova-plugins/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
# Credits
-4
View File
@@ -216,10 +216,6 @@
* [Printer](plugins/printer.md)
* [Browser Tab](plugins/browser-tab.md)
* [Dynamsoft Barcode Scanner](plugins/dynamsoft-barcode-scanner.md)
* [GCDWebServer](plugins/gcdwebserver.md)
* [Smtp Client](plugins/smtp-client.md)
* [Cashfree PG](plugins/cashfree-pg/README.md)
* [Save Dialog](plugins/save-dialog/README.md)
* [Installation](installation.md)
* [FAQ](faq.md)
+56 -51
View File
@@ -8,56 +8,68 @@ These plugins are submitted and maintained by the Ionic community. While communi
For professional developers and teams that require dedicated native plugin support & SLAs, ongoing maintenance, and security patches, please explore our [premium options](https://ionicframework.com/native), including plugin support and pre-built solutions for common native use cases.
> These docs are for apps built with Ionic Framework 4.0.0 and greater. For older Ionic v3 projects, please [see here](https://ionicframework.com/docs/v3/native).
### [Capacitor Support](https://ionicframework.com/docs/native/community#capacitor-support) <a id="capacitor-support"></a>
In addition to Cordova, Awesome Cordova Plugins also works with [Capacitor](https://capacitorjs.com/), Ionic's official native runtime. Basic usage below. For complete details, [see the Capacitor documentation](https://capacitorjs.com/docs/cordova/using-cordova-plugins).
In addition to Cordova, Ionic Native also works with [Capacitor](https://capacitor.ionicframework.com/), Ionic's official native runtime. Basic usage below. For complete details, [see the Capacitor documentation](https://capacitor.ionicframework.com/docs/cordova/using-cordova-plugins).
### [Usage](https://ionicframework.com/docs/native/community#usage) <a id="usage"></a>
All plugins have two components - the native code (Cordova) and the TypeScript code (Awesome Cordova Plugins). Cordova plugins are also wrapped in a `Promise` or `Observable` in order to provide a common plugin interface and modernized development approach.
All plugins have two components - the native code \(Cordova\) and the TypeScript code \(Ionic Native\). Cordova plugins are also wrapped in a `Promise` or `Observable` in order to provide a common plugin interface and modernized development approach.
Using the [Camera plugin](https://ionicframework.com/docs/native/camera) as an example, first install it:
Using the [Camera plugin](https://ionicframework.com/docs/native/camera) as an example, first install it:CORDOVACAPACITOR
```bash
# Install Cordova plugin
ionic cordova plugin add cordova-plugin-camera
```text
// Install Cordova plugin
$ ionic cordova plugin add cordova-plugin-camera
# Install Awesome Cordova Plugins TypeScript wrapper
npm install @awesome-cordova-plugins/camera
// Install Ionic Native TypeScript wrapper
$ npm install @ionic-native/camera
# Install Awesome Cordova Plugins core library (once per project)
npm install @awesome-cordova-plugins/core
// Install Ionic Native core library (once per project)
$ npm install @ionic-native/core
```
Next, begin using the plugin, following the various framework usage options below. For FAQ, see [here](https://ionicframework.com/docs/native/faq).
### [Angular (Standalone)](https://ionicframework.com/docs/native/community#angular) <a id="angular"></a>
### [Angular](https://ionicframework.com/docs/native/community#angular) <a id="angular"></a>
Angular apps can use either Cordova or Capacitor to build native mobile apps. Register the plugin as a provider in your application bootstrap. For Angular, the import path should end with `/ngx`. Angular's change detection is automatically handled.
Angular apps can use either Cordova or Capacitor to build native mobile apps. Import the plugin in a `@NgModule` and add it to the list of Providers. For Angular, the import path should end with `/ngx`. Angular's change detection is automatically handled.
```typescript
// main.ts
import { bootstrapApplication } from '@angular/platform-browser';
import { Camera } from '@awesome-cordova-plugins/camera/ngx';
import { AppComponent } from './app/app.component';
```text
// app.module.ts
import { Camera } from '@ionic-native/camera/ngx';
bootstrapApplication(AppComponent, {
providers: [Camera],
});
...
@NgModule({
...
providers: [
...
Camera
...
]
...
})
export class AppModule { }
```
After the plugin has been registered, inject it in any component or service using Angular's `inject()` function:
CopyCopied
```typescript
After the plugin has been declared, it can be imported and injected like any other service:
```text
// camera.service.ts
import { Injectable, inject } from '@angular/core';
import { Camera, CameraOptions } from '@awesome-cordova-plugins/camera/ngx';
import { Injectable } from "@angular/core";
import { Camera, CameraOptions } from "@ionic-native/camera/ngx";
@Injectable({
providedIn: 'root',
providedIn: "root",
})
export class PhotoService {
private camera = inject(Camera);
constructor(private camera: Camera) {}
takePicture() {
const options: CameraOptions = {
@@ -73,35 +85,26 @@ export class PhotoService {
},
(err) => {
// Handle error
console.log('Camera issue: ' + err);
console.log("Camera issue: " + err);
}
);
}
}
```
CopyCopied
### [React](https://ionicframework.com/docs/native/community#react) <a id="react"></a>
React apps must use Capacitor to build native mobile apps. However, Awesome Cordova Plugins (and therefore, Cordova plugins) can still be used.
```bash
# Install Core library (once per project)
npm install @awesome-cordova-plugins/core
# Install Awesome Cordova Plugins TypeScript wrapper
npm install @awesome-cordova-plugins/barcode-scanner
# Install Cordova plugin
npm install phonegap-plugin-barcodescanner
# Update native platform project(s) to include newly added plugin
ionic cap sync
```
React apps must use Capacitor to build native mobile apps. However, Ionic Native \(and therefore, Cordova plugins\) can still be used.// Install Core library \(once per project\)npm install @ionic-native/core
// Install Ionic Native TypeScript wrappernpm install @ionic-native/barcode-scanner
// Install Cordova pluginnpm install phonegap-plugin-barcodescanner
// Update native platform project\(s\) to include newly added pluginionic cap sync
Import the plugin object then use its static methods:
```typescript
import { BarcodeScanner } from '@awesome-cordova-plugins/barcode-scanner';
```text
import { BarcodeScanner } from "@ionic-native/barcode-scanner";
const Tab1: React.FC = () => {
const openScanner = async () => {
@@ -123,17 +126,19 @@ const Tab1: React.FC = () => {
};
```
### [ES2015+/TypeScript](https://ionicframework.com/docs/native/community#vanilla-javascript) <a id="vanilla-javascript"></a>
CopyCopied
ES2015+ and TypeScript apps can use either Cordova or Capacitor to build native mobile apps. To use any plugin, import the class from the appropriate package and use its static methods:
### [Vanilla JavaScript](https://ionicframework.com/docs/native/community#vanilla-javascript) <a id="vanilla-javascript"></a>
```typescript
import { Camera } from '@awesome-cordova-plugins/camera';
Vanilla JavaScript apps, targeting ES2015+ and/or TypeScript, can use either Cordova or Capacitor to build native mobile apps. To use any plugin, import the class from the appropriate package and use its static methods:
document.addEventListener('deviceready', () => {
```text
import { Camera } from "@ionic-native/camera";
document.addEventListener("deviceready", () => {
Camera.getPicture()
.then((data) => console.log('Took a picture!', data))
.catch((e) => console.log('Error occurred while taking a picture', e));
.then((data) => console.log("Took a picture!", data))
.catch((e) => console.log("Error occurred while taking a picture", e));
});
```
+3 -1
View File
@@ -15,5 +15,7 @@ ABBYY Real-Time Recognition SDK (RTR SDK) in apps.
## Supported platforms
- Android
- iOS
- iOS
+6 -4
View File
@@ -16,8 +16,10 @@ Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see
## Supported platforms
- Android
- Browser
- iOS
- Windows
- Windows Phone 8
- Browser
- iOS
- Windows
- Windows Phone 8
+3 -1
View File
@@ -16,5 +16,7 @@ Requires Cordova plugin: `com.adjust.sdk`. For more info, please see the [Adjust
## Supported platforms
- Android
- iOS
- iOS
+14 -1
View File
@@ -9,8 +9,21 @@ $ npm install @awesome-cordova-plugins/admob-plus
Plugin Repo: [https://github.com/admob-plus/admob-plus](https://github.com/admob-plus/admob-plus)
## Supported platforms
- Android
- iOS
- iOS
n-admob-free, which provides a cleaner API and build with modern tools.
## Supported platforms
- Android
- iOS
+4 -2
View File
@@ -16,6 +16,8 @@ IMPORTANT NOTICE: this plugin takes a percentage out of your earnings if you pro
## Supported platforms
- Android
- iOS
- Windows Phone 8
- iOS
- Windows Phone 8
+4 -2
View File
@@ -21,6 +21,8 @@ Supports:**
## Supported platforms
- Android
- iOS
- Browser
- iOS
- Browser
@@ -1,18 +0,0 @@
# AdvancedImagePicker
```
$ ionic cordova plugin add cordova-plugin-advanced-imagepicker
$ npm install @awesome-cordova-plugins/advanced-image-picker
```
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/advanced-image-picker/)
Plugin Repo: [https://github.com/EinfachHans/cordova-plugin-advanced-imagepicker](https://github.com/EinfachHans/cordova-plugin-advanced-imagepicker)
This Cordova Plugin is for a better (multiple) ImagePicker with more options.
## Supported platforms
- Android
- iOS
+3 -1
View File
@@ -16,5 +16,7 @@ The encryption and decryption are performed on the device native layer so that t
## Supported platforms
- Android
- iOS
- iOS
-18
View File
@@ -1,18 +0,0 @@
# Airship
```
$ ionic cordova plugin add @ua/cordova-airship
$ npm install @awesome-cordova-plugins/airship
```
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/airship/)
Plugin Repo: [https://www.npmjs.com/package/@ua/cordova-airship](https://www.npmjs.com/package/@ua/cordova-airship)
This plugin does something
## Supported platforms
- Android
- iOS
+3 -1
View File
@@ -17,5 +17,7 @@ For more information about Paytm All-in-One SDK, please visit https://developer.
## Supported platforms
- Android
- iOS
- iOS
+3 -1
View File
@@ -14,5 +14,7 @@ Google Analytics Firebase plugin for Ionic Native apps.
## Supported platforms
- Android
- iOS
- iOS
+2
View File
@@ -16,4 +16,6 @@ https://github.com/google/ExoPlayer
## Supported platforms
- Android
@@ -16,4 +16,6 @@ In Android 4.4+, however, you can now enter true full screen, fully interactive
## Supported platforms
- Android
+2
View File
@@ -16,4 +16,6 @@ This plugin works on all android versions, but we can only detect notches starti
## Supported platforms
- Android
@@ -16,4 +16,6 @@ You can find all permissions here: https://developer.android.com/reference/andro
## Supported platforms
- Android
+3 -1
View File
@@ -14,5 +14,7 @@ Anyline provides an easy-to-use SDK for applications to enable Optical Character
## Supported platforms
- Android
- iOS
- iOS
+3 -1
View File
@@ -16,5 +16,7 @@ Requires Cordova plugin: cordova-plugin-appavailability. For more info, please s
## Supported platforms
- Android
- iOS
- iOS
+3 -1
View File
@@ -19,5 +19,7 @@ For more info, please see https://docs.microsoft.com/en-us/appcenter/sdk/analyti
## Supported platforms
- Android
- iOS
- iOS
+3 -1
View File
@@ -19,5 +19,7 @@ For more info, please see https://docs.microsoft.com/en-us/appcenter/sdk/crashes
## Supported platforms
- Android
- iOS
- iOS
+3 -1
View File
@@ -15,5 +15,7 @@ For more info, please see: https://github.com/Microsoft/appcenter-sdk-cordova/tr
## Supported platforms
- Android
- iOS
- iOS
+3 -1
View File
@@ -14,5 +14,7 @@ For more info, please see https://docs.microsoft.com/en-us/appcenter/sdk/push/co
## Supported platforms
- Android
- iOS
- iOS
+3 -1
View File
@@ -16,5 +16,7 @@ For more info, please see https://docs.microsoft.com/en-us/appcenter/sdk/other-a
## Supported platforms
- Android
- iOS
- iOS
+8 -6
View File
@@ -14,10 +14,12 @@ This plugin allows you to read and write app preferences
## Supported platforms
- Android
- BlackBerry 10
- Browser
- iOS
- macOS
- Windows 8
- Windows Phone
- BlackBerry 10
- Browser
- iOS
- macOS
- Windows 8
- Windows Phone
+5 -3
View File
@@ -16,7 +16,9 @@ Requires Cordova plugin: cordova-plugin-apprate. For more info, please see the [
## Supported platforms
- Android
- BlackBerry 10
- iOS
- Windows
- BlackBerry 10
- iOS
- Windows
-18
View File
@@ -1,18 +0,0 @@
# App Review
```
$ ionic cordova plugin add cordova-plugin-app-review
$ npm install @awesome-cordova-plugins/app-review
```
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/app-review/)
Plugin Repo: [https://github.com/chemerisuk/cordova-plugin-app-review](https://github.com/chemerisuk/cordova-plugin-app-review)
Cordova plugin to review app
## Supported platforms
- Android
- iOS
+4 -2
View File
@@ -16,6 +16,8 @@ Requires Cordova plugin: `cordova-plugin-app-version`. For more info, please see
## Supported platforms
- Android
- iOS
- Windows
- iOS
- Windows
+2
View File
@@ -14,4 +14,6 @@ A Cordova plugin that enables users from Add Payment Cards to their Apple Wallet
## Supported platforms
- iOS
-18
View File
@@ -1,18 +0,0 @@
# Applovin
```
$ ionic cordova plugin add cordova-plugin-applovin-max
$ npm install @awesome-cordova-plugins/applovin
```
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/applovin/)
Plugin Repo: [https://github.com/AppLovin/AppLovin-MAX-Cordova](https://github.com/AppLovin/AppLovin-MAX-Cordova)
This plugin allows you to easily configure, integrate and interact with Applovin ads.
## Supported platforms
- Android
- iOS
+5 -3
View File
@@ -1,13 +1,13 @@
# HTTP
```
$ ionic cordova plugin add @approov/cordova-plugin-advanced-http
$ ionic cordova plugin add cordova-approov-advanced-http
$ npm install @awesome-cordova-plugins/approov-advanced-http
```
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/approov-advanced-http/)
Plugin Repo: [https://github.com/approov/quickstart-cordova-advancedhttp](https://github.com/approov/quickstart-cordova-advancedhttp)
Plugin Repo: [https://github.com/approov/quickstart-ionic-advancedhttp](https://github.com/approov/quickstart-ionic-advancedhttp)
Cordova / Phonegap plugin for communicating with HTTP servers. Supports iOS and Android.
@@ -22,5 +22,7 @@ we have only added approov functionality on top of it. All credit goes to the ac
## Supported platforms
- Android
- iOS
- iOS
+3 -1
View File
@@ -14,5 +14,7 @@ Appsflyer Cordova SDK support for Attribution
## Supported platforms
- iOS
- Android
- Android
-18
View File
@@ -1,18 +0,0 @@
# Audio Management
```
$ ionic cordova plugin add clovelced-plugin-audiomanagement
$ npm install @awesome-cordova-plugins/audio-management
```
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/audio-management/)
Plugin Repo: [https://github.com/clovelCed/cordova-plugin-audiomanagement](https://github.com/clovelCed/cordova-plugin-audiomanagement)
A Cordova plugin to manage volume of audio streams for: ring, music, notification and system. Possible
ringer values for those streams are: silent, vibrate and normal.
## Supported platforms
- Android
+2
View File
@@ -16,4 +16,6 @@ For more detail, please see https://github.com/transistorsoft/cordova-plugin-bac
## Supported platforms
- iOS
+6 -4
View File
@@ -15,8 +15,10 @@ Requires Cordova plugin: cordova-plugin-background-mode. For more info about plu
## Supported platforms
- AmazonFire OS
- Android
- Browser
- iOS
- Windows
- Android
- Browser
- iOS
- Windows
+4 -2
View File
@@ -1,7 +1,7 @@
# BackgroundUpload
```
$ ionic cordova plugin add @spoonconsulting/cordova-plugin-background-upload
$ ionic cordova plugin add cordova-plugin-background-upload
$ npm install @awesome-cordova-plugins/background-upload
```
@@ -14,5 +14,7 @@ This plugin does something
## Supported platforms
- Android
- iOS
- iOS
+5 -3
View File
@@ -18,7 +18,9 @@ Android Note: Badges have historically only been a feature implemented by third
## Supported platforms
- Android
- Browser
- iOS
- Windows
- Browser
- iOS
- Windows
+6 -4
View File
@@ -16,8 +16,10 @@ Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please
## Supported platforms
- Android
- BlackBerry 10
- Browser
- iOS
- Windows
- BlackBerry 10
- Browser
- iOS
- Windows
-16
View File
@@ -1,16 +0,0 @@
# Barkoder
```
$ ionic cordova plugin add barkoder-cordova
$ npm install @awesome-cordova-plugins/barkoder
```
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/barkoder/)
The barKoder Barcode Scanner SDK cordova plugin grants an easy to use solution with a great and completely customizable interface that can be instantly integrated in both iOS and Android apps.
## Supported platforms
- Android
- iOS
+5 -3
View File
@@ -14,7 +14,9 @@ Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see
## Supported platforms
- iOS
- Android
- Windows
- Browser
- Android
- Windows
- Browser
+3 -1
View File
@@ -14,5 +14,7 @@ BioCatch SDK Cordova support
## Supported platforms
- iOS
- Android
- Android
+5 -1
View File
@@ -1,16 +1,20 @@
# BiometricWrapper
```
$
$ ''
$ npm install @awesome-cordova-plugins/biometric-wrapper
```
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/biometric-wrapper/)
Plugin Repo: ['']('')
This plugin capture biometric(Iris and Fingerprint) and validate the user.
May be used in Banking domain
## Supported platforms
- Android
+3 -1
View File
@@ -26,5 +26,7 @@ Simultaneous connections to multiple peripherals are supported.
## Supported platforms
- Android
- iOS
- iOS
+3 -1
View File
@@ -15,5 +15,7 @@ blinkid-phonegap repository for available recognizers and other settings
## Supported platforms
- iOS
- Android
- Android
@@ -14,6 +14,8 @@ This plugin is written using the iOS Accessory Framework (MFi) to support Classi
## Supported platforms
- Android
- iOS
- Browser
- iOS
- Browser
+3 -1
View File
@@ -16,5 +16,7 @@ It supports peripheral **and** central modes and covers most of the API methods
## Supported platforms
- Android
- iOS
- iOS
+4 -2
View File
@@ -14,6 +14,8 @@ This plugin enables serial communication over Bluetooth. It was written for comm
## Supported platforms
- Android
- iOS
- Windows Phone 8
- iOS
- Windows Phone 8
+3 -1
View File
@@ -14,5 +14,7 @@ Branch.io is an attribution service for deeplinking and invitation links
## Supported platforms
- iOS
- Android
- Android
-20
View File
@@ -1,20 +0,0 @@
# Brightness
```
$ ionic cordova plugin add cordova-plugin-brightness
$ npm install @awesome-cordova-plugins/brightness
```
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/brightness/)
Plugin Repo: [https://github.com/mgcrea/cordova-plugin-brightness](https://github.com/mgcrea/cordova-plugin-brightness)
The Brightness plugin let you control the display brightness of your device.
Requires Cordova plugin: `cordova-plugin-brightness`. For more info, please see the [Brightness plugin docs](https://github.com/mgcrea/cordova-plugin-brightness).
## Supported platforms
- Android
- iOS
+4 -2
View File
@@ -14,6 +14,8 @@ This plugin adds exchanging events between native code and your app.
## Supported platforms
- Android
- iOS
- Browser
- iOS
- Browser
+1 -2
View File
@@ -14,5 +14,4 @@ This plugin provides an interface to in-app browser tabs that exist on some mobi
## Supported platforms
- Android
- iOS
- iOS
+7 -5
View File
@@ -14,9 +14,11 @@ This plugin provides build information.
## Supported platforms
- Android
- iOS
- Windows
- macOS
- browser
- Electron
- iOS
- Windows
- macOS
- browser
- Electron
+3 -1
View File
@@ -16,5 +16,7 @@ Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see th
## Supported platforms
- Android
- iOS
- iOS
+2
View File
@@ -15,4 +15,6 @@ to process the changes in the call directory extension.
## Supported platforms
- iOS
+3 -1
View File
@@ -15,5 +15,7 @@ NOTE**: The iOS Simulator (and maybe Android Simulators) do not provide access t
## Supported platforms
- Android
- iOS
- iOS
+10 -1
View File
@@ -1,5 +1,12 @@
# Camera Preview
<p style="color:orange">
This plugin is still in beta stage and may not work as expected. Please
submit any issues to the <a target="_blank"
href="/issues">plugin repo</a>.
</p>
```
$ ionic cordova plugin add cordova-plugin-camera-preview
$ npm install @awesome-cordova-plugins/camera-preview
@@ -16,5 +23,7 @@ Requires Cordova plugin: `https://github.com/cordova-plugin-camera-preview/cordo
## Supported platforms
- Android
- iOS
- iOS
+7 -5
View File
@@ -16,15 +16,17 @@ Requires the Cordova plugin: `cordova-plugin-camera`. For more info, please see
[Warning] Since IOS 10 the camera requires permissions to be placed in your config.xml add
```xml
<config-file parent="NSCameraUsageDescription" platform="ios" target="*-Info.plist">
<string>You can take photos</string>
<string>You can take photos</string>
</config-file>
```
inside of the `<platform name='ios>` section
inside of the <platform name='ios> section
## Supported platforms
- Android
- Browser
- iOS
- Windows
- Browser
- iOS
- Windows
-16
View File
@@ -1,16 +0,0 @@
# CFPaymentGateway
```
$ ionic cordova plugin add cordova-plugin-cashfree-pg
$ npm install @awesome-cordova-plugins/cashfree-pg
```
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/cashfree-pg/)
Plugin Repo: [https://github.com/cashfree/cordova-plugin-cashfree](https://github.com/cashfree/cordova-plugin-cashfree)
## Supported platforms
- Android
- iOS
+4 -2
View File
@@ -1,7 +1,7 @@
# Checkout
```
$
$ ''
$ npm install @awesome-cordova-plugins/checkout
```
@@ -14,5 +14,7 @@ Checkout.com cordova plugin
## Supported platforms
- Android
- iOS
- iOS
+3 -1
View File
@@ -26,5 +26,7 @@ The following must be added to config.xml to prevent crashing when selecting lar
## Supported platforms
- Android
- iOS
- iOS
+5 -3
View File
@@ -1,13 +1,13 @@
# Chooser
```
$ ionic cordova plugin add http://github.com/MaximBelov/cordova-plugin-chooser.git
$ ionic cordova plugin add cordova-plugin-chooser
$ npm install @awesome-cordova-plugins/chooser
```
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/chooser/)
Plugin Repo: [https://github.com/MaximBelov/cordova-plugin-chooser](https://github.com/MaximBelov/cordova-plugin-chooser)
Plugin Repo: [https://github.com/cyph/cordova-plugin-chooser](https://github.com/cyph/cordova-plugin-chooser)
File chooser plugin for Cordova.
@@ -26,5 +26,7 @@ The following must be added to config.xml to prevent crashing when selecting lar
## Supported platforms
- Android
- iOS
- iOS
+3 -1
View File
@@ -14,5 +14,7 @@ Cordova Plugin that wraps CleverTap SDK for Android and iOS
## Supported platforms
- Android
- iOS
- iOS
+4 -2
View File
@@ -14,6 +14,8 @@ Clipboard management plugin for Cordova that supports iOS, Android, and Windows
## Supported platforms
- Android
- iOS
- Windows Phone 8
- iOS
- Windows Phone 8
+4 -2
View File
@@ -1,7 +1,7 @@
# Cloud Settings
```
$ ionic cordova plugin add @marysuon/cordova-plugin-cloud-settings --variable ANDROID_BACKUP_SERVICE_KEY=myapikey
$ ionic cordova plugin add cordova-plugin-cloud-settings --variable ANDROID_BACKUP_SERVICE_KEY=myapikey
$ npm install @awesome-cordova-plugins/cloud-settings
```
@@ -14,5 +14,7 @@ Stores app settings in cloud storage so if the user re-installs the app or insta
## Supported platforms
- Android
- iOS
- iOS
+3 -1
View File
@@ -16,5 +16,7 @@ For more info, please see https://github.com/Dellos7/example-cordova-code-push-p
## Supported platforms
- Android
- iOS
- iOS
-25
View File
@@ -1,25 +0,0 @@
# Contacts
```
$ ionic cordova plugin add cordova-plugin-contacts
$ npm install @awesome-cordova-plugins/contacts
```
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/contacts/)
Plugin Repo: [https://github.com/herdwatch-apps/cordova-plugin-contacts](https://github.com/herdwatch-apps/cordova-plugin-contacts)
Access and manage Contacts on the device.
## Supported platforms
- Android
- BlackBerry 10
- Browser
- Firefox OS
- iOS
- Ubuntu
- Windows
- Windows 8
- Windows Phone
-273
View File
@@ -1,273 +0,0 @@
![](https://img.shields.io/npm/v/@awesome-cordova-plugins/core.svg)
# Awesome Cordova Plugins
Awesome Cordova Plugins is a curated set of wrappers for Cordova plugins that make adding any native functionality you need to your [Ionic](https://ionicframework.com/) mobile app easy.
Awesome Cordova Plugins wraps plugin callbacks in a Promise or Observable, providing a common interface for all plugins and making it easy to use plugins with Angular change detection.
To learn more about the reasons why Ionic Native was renamed to Awesome Cordova Plugins, read the official [Ionic blog](https://ionicframework.com/blog/a-new-chapter-for-ionic-native/) post by Max Lyncht.
## Capacitor Support
In addition to Cordova, Awesome Cordova Plugins also works with [Capacitor](https://capacitorjs.com), Ionic's official native runtime. Basic usage below. For complete details, [see the Capacitor documentation](https://capacitorjs.com/docs/v2/cordova/using-cordova-plugins).
## Installation
Run following command to install Awesome Cordova Plugins in your project.
```bash
npm install @awesome-cordova-plugins/core --save
```
You also need to install the Awesome Cordova Plugins package for each plugin you want to add. Please see the [Awesome Cordova Plugins documentation](https://ionicframework.com/docs/native/) for complete instructions on how to add and use the plugins.
## Documentation
For the full Awesome Cordova Plugins documentation, please visit [https://ionicframework.com/docs/native/](https://ionicframework.com/docs/native/).
### Basic Usage
#### Ionic/Angular apps
To use a plugin, import and add the plugin provider to your `@NgModule`, and then inject it where you wish to use it.
Make sure to import the injectable class from the `/ngx` directory as shown in the following examples:
```typescript
// app.module.ts
import { Camera } from '@awesome-cordova-plugins/camera/ngx';
...
@NgModule({
...
providers: [
...
Camera
...
]
...
})
export class AppModule { }
```
```typescript
import { Geolocation } from '@awesome-cordova-plugins/geolocation/ngx';
import { Platform } from 'ionic-angular';
@Component({ ... })
export class MyComponent {
constructor(private geolocation: Geolocation, private platform: Platform) {
this.platform.ready().then(() => {
// get position
this.geolocation.getCurrentPosition().then(pos => {
console.log(`lat: ${pos.coords.latitude}, lon: ${pos.coords.longitude}`)
});
// watch position
const watch = geolocation.watchPosition().subscribe(pos => {
console.log(`lat: ${pos.coords.latitude}, lon: ${pos.coords.longitude}`)
});
// to stop watching
watch.unsubscribe();
});
}
}
```
#### Ionic/React apps
React apps must use Capacitor to build native mobile apps. However, Awesome Cordova Plugins (and therefore, Cordova plugins) can still be used.
```bash
# Install Core library (once per project)
npm install @awesome-cordova-plugins/core
# Install Awesome Cordova Plugins TypeScript wrapper
npm install @awesome-cordova-plugins/barcode-scanner
# Install Cordova plugin
npm install phonegap-plugin-barcodescanner
# Update native platform project(s) to include newly added plugin
ionic cap sync
```
Import the plugin object then use its static methods:
```typescript
import { BarcodeScanner } from '@awesome-cordova-plugins/barcode-scanner';
const Tab1: React.FC = () => {
const openScanner = async () => {
const data = await BarcodeScanner.scan();
console.log(`Barcode data: ${data.text}`);
};
return (
<IonPage>
<IonHeader>
<IonToolbar>
<IonTitle>Tab 1</IonTitle>
</IonToolbar>
</IonHeader>
<IonContent>
<IonButton onClick={openScanner}>Scan barcode</IonButton>
</IonContent>
</IonPage>
);
};
```
#### ES2015+/TypeScript
These modules can work in any ES2015+/TypeScript app (including Angular/Ionic apps). To use any plugin, import the class from the appropriate package, and use it's static methods.
```js
import { Camera } from '@awesome-cordova-plugins/camera';
document.addEventListener('deviceready', () => {
Camera.getPicture()
.then((data) => console.log('Took a picture!', data))
.catch((e) => console.log('Error occurred while taking a picture', e));
});
```
#### AngularJS
Awesome Cordova Plugins generates an AngularJS module in runtime and prepares a service for each plugin. To use the plugins in your AngularJS app:
1. Download the latest bundle from the [Github releases](https://github.com/danielsogl/awesome-cordova-plugins/releases) page.
2. Include it in `index.html` before your app's code.
3. Inject `ionic.native` module in your app.
4. Inject any plugin you would like to use with a `$cordova` prefix.
```js
angular.module('myApp', ['ionic.native']).controller('MyPageController', function ($cordovaCamera) {
$cordovaCamera.getPicture().then(
function (data) {
console.log('Took a picture!', data);
},
function (err) {
console.log('Error occurred while taking a picture', err);
}
);
});
```
#### Vanilla JS
To use Awesome Cordova Plugins in any other setup:
1. Download the latest bundle from the [Github releases](https://github.com/danielsogl/awesome-cordova-plugins/releases) page.
2. Include it in `index.html` before your app's code.
3. Access any plugin using the global `IonicNative` variable.
```js
document.addEventListener('deviceready', function () {
IonicNative.Camera.getPicture().then(
function (data) {
console.log('Took a picture!', data);
},
function (err) {
console.log('Error occurred while taking a picture', err);
}
);
});
```
### Mocking and Browser Development (Ionic/Angular apps only)
Awesome Cordova Plugins makes it possible to mock plugins and develop nearly the entirety of your app in the browser or in `ionic serve`.
To do this, you need to provide a mock implementation of the plugins you wish to use. Here's an example of mocking the `Camera` plugin to return a stock image while in development:
First import the `Camera` class in your `src/app/app.module.ts` file:
```typescript
import { Camera } from '@awesome-cordova-plugins/camera/ngx';
```
Then create a new class that extends the `Camera` class with a mock implementation:
```typescript
class CameraMock extends Camera {
getPicture(options) {
return new Promise((resolve, reject) => {
resolve('BASE_64_ENCODED_DATA_GOES_HERE');
});
}
}
```
Finally, override the previous `Camera` class in your `providers` for this module:
```typescript
providers: [{ provide: Camera, useClass: CameraMock }];
```
Here's the full example:
```typescript
import { ErrorHandler, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { Camera } from '@awesome-cordova-plugins/camera/ngx';
import { HomePage } from '../pages/home/home';
import { MyApp } from './app.component';
class CameraMock extends Camera {
getPicture(options) {
return new Promise((resolve, reject) => {
resolve('BASE_64_ENCODED_DATA_GOES_HERE');
});
}
}
@NgModule({
declarations: [MyApp, HomePage],
imports: [BrowserModule, IonicModule.forRoot(MyApp)],
bootstrap: [IonicApp],
entryComponents: [MyApp, HomePage],
providers: [
{ provide: ErrorHandler, useClass: IonicErrorHandler },
{ provide: Camera, useClass: CameraMock },
],
})
export class AppModule {}
```
### Runtime Diagnostics
Spent way too long diagnosing an issue only to realize a plugin wasn't firing or installed? Awesome Cordova Plugins lets you know what the issue is and how you can resolve it.
![img](https://ionic-io-assets.s3.amazonaws.com/ionic-native-console.png)
## Plugin Missing?
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/danielsogl/awesome-cordova-plugins/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
# Credits
Ibby Hadeed - [@ihadeed](https://github.com/ihadeed)
Daniel Sogl - [@sogldaniel](https://twitter.com/sogldaniel)
Tim Lancina - [@timlancina](https://twitter.com/timlancina)
Mike Hartington - [@mhartington](https://twitter.com/mhartington)
Max Lynch - [@maxlynch](https://twitter.com/maxlynch)
Rob Wormald - [@robwormald](https://twitter.com/robwormald)
@@ -1,17 +0,0 @@
# Crop Plugin Privacy
```
$ ionic cordova plugin add cordova-plugin-crop-privacy
$ npm install @awesome-cordova-plugins/crop-plugin-privacy
```
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/crop-plugin-privacy/)
Plugin Repo: [https://github.com/BaraAksayeth25/cordova-plugin-crop-privacy](https://github.com/BaraAksayeth25/cordova-plugin-crop-privacy)
This plugin does something
## Supported platforms
- Android
-15
View File
@@ -1,15 +0,0 @@
# CustomUiSdk
```
$
$ npm install @awesome-cordova-plugins/custom-ui-sdk
```
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/custom-ui-sdk/)
This plugin is used to access Paytmpayments native CustomUiSdk framework's apis.
## Supported platforms
- Android, iOS
+3 -1
View File
@@ -1,7 +1,7 @@
# CustomUISDK
```
$
$ ''
$ npm install @awesome-cordova-plugins/custom-uisdk
```
@@ -14,4 +14,6 @@ This plugin is used to access Paytm's native CustomUISDK framework's apis.
## Supported platforms
- Android, iOS
+4 -2
View File
@@ -18,6 +18,8 @@ You must add `universal-links` to your `config.xml` and set up Apple App Site As
## Supported platforms
- Android
- Browser
- iOS
- Browser
- iOS
+2
View File
@@ -14,4 +14,6 @@ Gets the Google accounts associated with the Android device
## Supported platforms
- Android
+10 -8
View File
@@ -14,12 +14,14 @@ Requires Cordova plugin: `cordova-plugin-device-motion`. For more info, please s
## Supported platforms
- Android
- BlackBerry 10
- Browser
- Firefox OS
- iOS
- Tizen
- Ubuntu
- Windows
- Windows Phone 8
- BlackBerry 10
- Browser
- Firefox OS
- iOS
- Tizen
- Ubuntu
- Windows
- Windows Phone 8
+11 -9
View File
@@ -14,13 +14,15 @@ Requires Cordova plugin: `cordova-plugin-device-orientation`. For more info, ple
## Supported platforms
- Amazon Fire OS
- Android
- BlackBerry 10
- Browser
- Firefox OS
- iOS
- Tizen
- Ubuntu
- Windows
- Windows Phone
- Android
- BlackBerry 10
- Browser
- Firefox OS
- iOS
- Tizen
- Ubuntu
- Windows
- Windows Phone
+6 -4
View File
@@ -14,8 +14,10 @@ Access information about the underlying device and platform.
## Supported platforms
- Android
- Browser
- iOS
- macOS
- Windows
- Browser
- iOS
- macOS
- Windows
+3 -1
View File
@@ -14,5 +14,7 @@ This plugin is a Wrapper to use Nordic Semiconductor's Device Firmware Update (D
## Supported platforms
- Android
- iOS
- iOS
+4 -2
View File
@@ -14,6 +14,8 @@ Checks whether device hardware features are enabled or available to the app, e.g
## Supported platforms
- Android
- iOS
- Windows
- iOS
- Windows
+6 -4
View File
@@ -16,8 +16,10 @@ Requires Cordova plugin: `cordova-plugin-dialogs`. For more info, please see the
## Supported platforms
- Amazon Fire OS
- Android
- Browser
- iOS
- Windows
- Android
- Browser
- iOS
- Windows
+2
View File
@@ -14,4 +14,6 @@ A plugin for Apache Cordova that enables applications to manually resolve hostna
## Supported platforms
- Android

Some files were not shown because too many files have changed in this diff Show More