1.0.1 • Published 5 years ago

capacitor-yooga-zoop-sdk v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

capacitor-yooga-zoop-sdk

Encapsulamento via Capacitor para integrar com o Zoop Java SDK.

Todas contribuições são bem vindas, o plugin ainda está em processo de desenvolvimento e o objetivo é encapsular o máximo possível e tornar simples e funcional no ambiente híbrido do Ionic

Installation

$ npm i --save capacitor-yooga-zoop-sdk

Android configuration

In file android/app/src/main/java/**/**/MainActivity.java, add the plugin to the initialization list:

this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
  [...]
  add(com.yooga.zoop.sdk.YoogaZoopSDK.class);
  [...]
}});

Usage

import { registerWebPlugin } from '@capacitor/core';
import { YoogaZoopSDK } from 'capacitor-yooga-zoop-sdk';

export class AnyService {

  constructor() {
    window.addEventListener("showMessage", (res: any) => {
      // Messages received from the terminal
    });

    window.addEventListener("paymentSuccessful", (res: any) => {
      //
    });

    try {
      registerWebPlugin(YoogaZoopSDK)
    } catch(err) {
      console.error(err)
    }
  }

  getBluetoothDevices() {    
    return Plugins.YoogaZoopSDK.getBluetoothDevices().then(res => {
      console.log(res) // Devices that already has been paired
    }).catch(err => {
      console.error(err)
    })
  }
  
  executeTransaction() {
    Plugins.YoogaZoopSDK.transaction({}).then(res => {
      console.log(res)
    }).catch(res => {
      console.error(res)
    })
  }
  
  setBluetooth(bluetooth) {

    let bluetoothObject = {
      name: bluetooth.name,
      uri: "btspp://" + bluetooth.name,
      communication: "Bluetooth",
      persistent: true,
      dateTimeDetected: "2019-08-23 10:06"
    }

    try {
      Plugins.YoogaZoopSDK.setBluetoothDevice(bluetoothObject).then(res => {
        console.log(res)
      }).catch(err => {
        console.error(err)
      })
    } catch(e) {
      console.error(e)
    }
  }
1.0.1

5 years ago

1.0.0

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago