# capacitor-settings

> An Ionic Capacitor plugin to manage device settings and permissions directly from your app, including battery optimization, location accuracy, and more.

Latest version **0.0.2** (published 2024-11-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install capacitor-settings
pnpm add capacitor-settings
yarn add capacitor-settings
bun add capacitor-settings
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2024-11-26 |
| First published | 2024-11-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 48.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | USAMA |
| Maintainers | usama.dev |
| Keywords | capacitor, plugin, native, ionic, settings, permissions, battery, location, bluetooth, device, app settings, capacitor plugin, native functionality, device manager, settings manager, permission manager, location accuracy, battery unrestricted, enable bluetooth, enable location |

## Links

- npm: https://www.npmjs.com/package/capacitor-settings
- Repository: https://github.com/usama-DVLPR/capacitor-settings-plugin
- Homepage: https://github.com/usama-DVLPR/capacitor-settings-plugin#readme
- Issues: https://github.com/usama-DVLPR/capacitor-settings-plugin/issues
- npm.io page: https://npm.io/package/capacitor-settings

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2024-11-26
- 0.0.1 — 2024-11-26

## README

# Capacitor Settings

The CapacitorSettings plugin provides an easy way to manage critical device settings and permissions for your Android app. This plugin allows you to seamlessly prompt users to adjust important settings such as battery optimization, location accuracy, and Bluetooth configurations, without needing to navigate them to the system settings page. It includes methods to request permissions, open specific system settings, and check if the settings have already been configured.

## Features

- Manage Battery Optimization settings.
- Configure Location Accuracy prompts.
- Manage Bluetooth settings.


## Platform Support

| Feature | Android   | iOS   | Web   |
| :-------- | :-------- | :-------- | :-------- |
| Battery Optimization	Prompt   |  ✅  | ❌ | ❌ |
| Bluetooth Settings Prompt   |  ✅  | ❌ | ❌ |
| Location Accuracy Prompt	  |  ✅  | ❌ | ❌ |

⚠️ **Note:** This plugin currently supports only Android. iOS and Web support are not available.





## Installation

Install the plugin using npm:

```bash
  npm install capacitor-settings
  npx cap sync
```
    
## Usage/Examples

#### Location Accuracy Prompt

```javascript
import {CapacitorSettings} from 'capacitor-settings'
import { from } from 'rxjs';

 locationAccuracy() {
  from(CapacitorSettings.locationAccuracy())
    .subscribe({
      next: (res: any) => {
        console.log(res);
      },
      error: (err: any) => {
        console.log(err);
      }
    });
}
```

#### Battery Optimization Prompt

```javascript
import {CapacitorSettings} from 'capacitor-settings'
import { from } from 'rxjs';

 batteryOptimization() {
  from(CapacitorSettings.setBatteryMode())
    .subscribe({
      next: (res: any) => {
        console.log(res);
      },
      error: (err: any) => {
        console.log(err);
      }
    });
}
```

#### Bluetooth Settings Prompt

```javascript
import {CapacitorSettings} from 'capacitor-settings'
import { from } from 'rxjs';

 bluetoothEnable() {
  from(CapacitorSettings.bluetoothEnable())
    .subscribe({
      next: (res: any) => {
        console.log(res);
      },
      error: (err: any) => {
        console.log(err);
      }
    });
}
```


## API

#### Methods


| Method | Description     | Platforms                |
| :-------- | :------- | :------------------------- |
| `locationAccuracy` | `Checks and prompts the user to enable high accuracy location settings.` | **Android** |
| `bluetoothEnable` | `Requests the user to enable Bluetooth if it is not already turned on.` | **Android** |
| `setBatteryMode` | `	Requests the user to disable battery optimization for the app.` | **Android** |




## Demo

[CapacitorSettings Demo](demo/video.mp4)

---
_Source: https://npm.io/package/capacitor-settings · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
