Socket
Socket
Sign inDemoInstall

@capacitor/android

Package Overview
Dependencies
0
Maintainers
7
Versions
685
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor/android

Capacitor: Cross-platform apps with JavaScript and the web


Version published
Weekly downloads
198K
decreased by-15.13%
Maintainers
7
Created
Weekly downloads
 

Package description

What is @capacitor/android?

@capacitor/android is a package that provides native Android functionality for Capacitor, a cross-platform app runtime that makes it easy to build web apps that run natively on iOS, Android, and the web. This package allows you to access native Android features and APIs directly from your JavaScript code.

What are @capacitor/android's main functionalities?

Accessing Device Information

This feature allows you to access detailed information about the device, such as the model, operating system, and manufacturer.

const { Device } = require('@capacitor/device');

async function getDeviceInfo() {
  const info = await Device.getInfo();
  console.log(info);
}

getDeviceInfo();

Geolocation

This feature allows you to get the current geographical location of the device using the device's GPS.

const { Geolocation } = require('@capacitor/geolocation');

async function getCurrentPosition() {
  const coordinates = await Geolocation.getCurrentPosition();
  console.log('Current position:', coordinates);
}

getCurrentPosition();

Camera Access

This feature allows you to access the device's camera to take pictures or record videos.

const { Camera } = require('@capacitor/camera');

async function takePicture() {
  const image = await Camera.getPhoto({
    quality: 90,
    allowEditing: false,
    resultType: CameraResultType.Uri
  });
  console.log('Image URI:', image.webPath);
}

takePicture();

Push Notifications

This feature allows you to register for and handle push notifications on the device.

const { PushNotifications } = require('@capacitor/push-notifications');

PushNotifications.register();

PushNotifications.addListener('registration', (token) => {
  console.log('Push registration success, token: ' + token.value);
});

PushNotifications.addListener('pushNotificationReceived', (notification) => {
  console.log('Push received: ', notification);
});

Other packages similar to @capacitor/android

Changelog

Source

5.3.0 (2023-08-23)

Bug Fixes

  • cookies: remove session cookies when initializing the cookie manager (037863b)
  • http: disconnect active connections if call or bridge is destroyed (a1ed6cc)
  • http: return numbers and booleans as-is when application/json is the content type (03dd3f9)

Features

FAQs

Package last updated on 23 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc