Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* });
*
* let watch = this.geolocation.watchPosition();
* watch.subscribe((data) => {
* // data can be a set of coordinates, or an error (if an error occurred).
* // data.coords.latitude
* // data.coords.longitude
* });
* ```
* @interfaces
* Coordinates
* Geoposition
* PositionError
* GeolocationOptions
*/
@Plugin({
pluginName: 'Geolocation',
plugin: 'cordova-plugin-geolocation',
pluginRef: 'navigator.geolocation',
repo: 'https://github.com/apache/cordova-plugin-geolocation',
install:
'ionic cordova plugin add cordova-plugin-geolocation --variable GEOLOCATION_USAGE_DESCRIPTION="To locate you"',
installVariables: ['GEOLOCATION_USAGE_DESCRIPTION'],
platforms: ['Amazon Fire OS', 'Android', 'Browser', 'iOS', 'Windows']
})
@Injectable()
export class Geolocation extends IonicNativePlugin {
/**
* Get the device's current position.
*
* @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions).
* @returns {Promise} Returns a Promise that resolves with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or rejects with an error.
* Destroy a panorama completely
* @return {Promise}
*/
@CordovaInstance()
remove(): Promise {
return getPromise((resolve) => {
this._objectInstance.remove(() => resolve());
});
}
}
/**
* @hidden
*/
@Plugin({
pluginName: 'GoogleMaps',
plugin: 'cordova-plugin-googlemaps'
})
export class GoogleMap extends BaseClass {
constructor(element: HTMLElement | string, options?: GoogleMapOptions, __timeout?: number) {
if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === true) {
// ---------------
// Create a map
// ---------------
if (element instanceof HTMLElement) {
if (!element.offsetParent) {
throw new Error('Element must be under ');
}
if (element.offsetWidth >= 100 && element.offsetHeight >= 100) {
super(GoogleMaps.getPlugin().Map.getMap(element, options));
*
* @usage
* ```typescript
* import { Instagram } from '@ionic-native/instagram';
*
* constructor(private instagram: Instagram) { }
*
* ...
*
* this.instagram.share('data:image/png;uhduhf3hfif33', 'Caption')
* .then(() => console.log('Shared!'))
* .catch((error: any) => console.error(error));
*
* ```
*/
@Plugin({
pluginName: 'Instagram',
plugin: 'cordova-instagram-plugin',
pluginRef: 'Instagram',
repo: 'https://github.com/vstirbu/InstagramPlugin',
platforms: ['Android', 'iOS']
})
@Injectable()
export class Instagram extends IonicNativePlugin {
/**
* Detect if the Instagram application is installed on the device.
*
* @returns {Promise} Returns a promise that returns a boolean value if installed, or the app version on android
*/
@Cordova({
callbackStyle: 'node'
*
* constructor(private base64ToGallery: Base64ToGallery) { }
*
*
* ...
*
*
* this.base64ToGallery.base64ToGallery(base64Data, { prefix: '_img' }).then(
* res => console.log('Saved image to gallery ', res),
* err => console.log('Error saving image to gallery ', err)
* );
* ```
* @interfaces
* Base64ToGalleryOptions
*/
@Plugin({
pluginName: 'Base64ToGallery',
plugin: 'cordova-base64-to-gallery',
pluginRef: 'cordova',
repo: 'https://github.com/Nexxa/cordova-base64-to-gallery',
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
@Injectable()
export class Base64ToGallery extends IonicNativePlugin {
/**
* Converts a base64 string to an image file in the device gallery
* @param {string} data The actual base64 string that you want to save
* @param {any} [options] An object with properties
* @returns {Promise} returns a promise that resolves when the image is saved.
*/
@Cordova({
successIndex: 2,
* constructor(private barcodeScanner: BarcodeScanner) { }
*
* ...
*
*
* this.barcodeScanner.scan().then(barcodeData => {
* console.log('Barcode data', barcodeData);
* }).catch(err => {
* console.log('Error', err);
* });
* ```
* @interfaces
* BarcodeScannerOptions
* BarcodeScanResult
*/
@Plugin({
pluginName: 'BarcodeScanner',
plugin: 'phonegap-plugin-barcodescanner',
pluginRef: 'cordova.plugins.barcodeScanner',
repo: 'https://github.com/phonegap/phonegap-plugin-barcodescanner',
platforms: ['Android', 'BlackBerry 10', 'Browser', 'iOS', 'Windows']
})
@Injectable()
export class BarcodeScanner extends IonicNativePlugin {
Encode: {
TEXT_TYPE: string;
EMAIL_TYPE: string;
PHONE_TYPE: string;
SMS_TYPE: string;
} = {
TEXT_TYPE: 'TEXT_TYPE',
EMAIL_TYPE: 'EMAIL_TYPE',
* subtitle: 'Choose an action',
* buttonLabels: buttonLabels,
* addCancelButtonWithLabel: 'Cancel',
* addDestructiveButtonWithLabel: 'Delete',
* androidTheme: this.actionSheet.ANDROID_THEMES.THEME_HOLO_DARK,
* destructiveButtonLast: true
* };
*
* this.actionSheet.show(options).then((buttonIndex: number) => {
* console.log('Button pressed: ' + buttonIndex);
* });
* ```
* @interfaces
* ActionSheetOptions
*/
@Plugin({
pluginName: 'ActionSheet',
plugin: 'cordova-plugin-actionsheet',
pluginRef: 'plugins.actionsheet',
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet',
platforms: ['Android', 'Browser', 'iOS', 'Windows', 'Windows Phone 8']
})
@Injectable()
export class ActionSheet extends IonicNativePlugin {
/**
* Convenience property to select an Android theme value
*/
ANDROID_THEMES: {
THEME_TRADITIONAL: number;
THEME_HOLO_DARK: number;
THEME_HOLO_LIGHT: number;
*
* let items = [{label: "Hello", number: "123"}];
* this.callDirectory.addIdentification(items)
* .then((res: any) => console.log(res))
* .catch((error: any) => console.error(error));
*
* this.callDirectory.reloadExtension()
* .then(res: string) => console.log(res))
* .catch((error: any) => console.error(error));
* ```
*
* @Interfaces
* CallDirectoryItem
* CallDirectoryLog
*/
@Plugin({
pluginName: 'CallDirectory',
plugin: 'cordova-plugin-call-directory',
pluginRef: 'CallDirectory',
repo: 'https://github.com/GEDYSIntraWare/cordova-plugin-call-directory',
install: 'cordova plugin add cordova-plugin-call-directory --variable EXT_NAME="Cordova-Directory" --variable ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES="NO"',
installVariables: ['EXT_NAME', 'ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'],
platforms: ['iOS']
})
@Injectable()
export class CallDirectory extends IonicNativePlugin {
/**
* Check if the call directory extension is available and enabled
* @return {Promise} Returns a promise with result
*/
@Cordova()
* @usage
* ```typescript
* import { FirebaseCrashlytics } from '@ionic-native/firebase-crashlytics/ngx';
*
*
* constructor(private firebaseCrashlytics: FirebaseCrashlytics) { }
*
* ...
*
*
* const crashlytics = this.firebaseCrashlytics.initialize();
* crashlytics.logException('my caught exception');
*
* ```
*/
@Plugin({
pluginName: 'FirebaseCrashlytics',
plugin: 'cordova-plugin-firebase-crashlytics',
pluginRef: 'FirebaseCrashlytics',
repo: 'https://github.com/ReallySmallSoftware/cordova-plugin-firebase-crashlytics',
install: 'ionic cordova plugin add cordova-plugin-firebase-crashlytics --variable ANDROID_FIREBASE_CORE_VERSION=16.0.0',
installVariables: ['ANDROID_FIREBASE_CORE_VERSION'],
platforms: ['Android', 'iOS']
})
@Injectable()
export class FirebaseCrashlytics extends IonicNativePlugin {
/**
* Simply add the plugin to get the default Crashlytics functionality. Note that crashes and logged exceptions will only be reported when the application restarts. In order to log caught exceptions the following can be used:
*
* @returns {void}
*/
@Cordova({
* @description
* The NavigationBar plugin allows you to hide and auto hide the android navigation bar.
*
* @usage
* ```typescript
* import { NavigationBar } from '@ionic-native/navigation-bar';
*
* constructor(private navigationBar: NavigationBar) { }
*
* ...
*
* let autoHide: boolean = true;
* this.navigationBar.setUp(autoHide);
* ```
*/
@Plugin({
pluginName: 'NavigationBar',
plugin: 'cordova-plugin-navigationbar',
pluginRef: 'navigationbar',
repo: 'https://github.com/cranberrygame/cordova-plugin-navigationbar',
platforms: ['Android']
})
@Injectable()
export class NavigationBar extends IonicNativePlugin {
/**
* hide automatically (or not) the navigation bar.
* @param autohide {boolean}
* @return {Promise}
*/
@Cordova({
callbackStyle: 'object',
* android: 'market://details?id=',
* windows: 'ms-windows-store://review/?ProductId='
* }
* }
*
* this.appRate.promptForRating(false);
* ```
*
* @interfaces
* AppRatePreferences
* AppUrls
* AppRateCallbacks
* AppRateCustomLocal
*
*/
@Plugin({
pluginName: 'AppRate',
plugin: 'cordova-plugin-apprate',
pluginRef: 'AppRate',
repo: 'https://github.com/pushandplay/cordova-plugin-apprate',
platforms: ['Android', 'BlackBerry 10', 'iOS', 'Windows']
})
@Injectable()
export class AppRate extends IonicNativePlugin {
/**
* Configure various settings for the Rating View.
* See table below for options
*/
@CordovaProperty()
preferences: AppRatePreferences;
/**