更新记录

v1.0.1(2024-09-19) 下载此版本

  • 插件兼容性升级 根据平台要求,插件更新到Android 14 (API 34)版本,现已支持HBuidlerX 4.26-alpha平台云端打包。

v1.0.0(2024-07-05) 下载此版本

UNIPHIZ系统的钱箱调用插件


平台兼容性

Android Android CPU类型 iOS
适用版本区间:5.0 - 14.0 armeabi-v7a:支持,arm64-v8a:支持,x86:未测试 ×

原生插件通用使用流程:

  1. 购买插件,选择该插件绑定的项目。
  2. 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
  3. 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
  4. 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
  5. 开发完毕后正式云打包

付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios

注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择


UNIPHIZ-API-CashBox Specification

To use this plugin, you also need to install the UNIPHIZ-API-Common plugin, otherwise some functions may not work properly.

UNIPHIZ-API-CashBox provide users with ways to control the cash box pop-out and check the status of the cash box.

Environment

CompileSdkVersion 34

MinSdkVersion 21

TargetSdkVersion 34

Build Gradle JDK Version JDK-21.0.2

Source Compatibility JDK-1.8

Gradle Version gradle-8.7-bin

Android Gradle Plugin Version

Getting started

Open the sample project using HBuilderX 4.26-alpha.

How to use the plugins

  1. Recognize the name of the plugin's module.

Open the file pathed in ./nativeplugins/<plugin_name>/package.json, the plugin is described by the value of _dp_nativeplugin -> android -> plugins.

  1. Get instance of the plugin's module in the page files.

Use uni.requireNativePlugin(<module_name>) to get instance of the module.

  1. Call the function of the instance.

Project structure

  1. /nativeplugins

The folder named nativeplugins contains native plugins and their specification files. Each native plugin has one folder.

  1. /pages

The folder named pages contains page files in vue format.

  1. /unpackage

The folder named unpackage contains files generated by HBuilderX.

  1. manifest.json

The file named manifest.json contains the application configuration.

Custom Plugins

  1. Plugin description

Create folder ./nativeplugins/<plugin_name>/android in the root path firstly, and move the plugin file in AAR format to ./nativeplugins/<plugin_name>/android.

Then create the description file ./nativeplugins/<plugin_name>/package.json in the project root path, and fill in the content according to the sample project.

  1. Select local plugins

Each value of the key named of _dp_nativeplugin -> android -> plugins -> name must start with <plugin_name> firstly, then make sure value of the key named of version corresponds to the file in AAR format.

If the files in the nativeplugins directory are configured correctly, they will be listed in the app-plus -> nativePlugins section of the manifest.json file.

Finally open the manifest.json file in the project root path, and check the native plugins -> local plugins.

  1. Genarate Custom Playground

Modify versionCode to make it larger than the current value, change versionName to make it matches versionCode, and make sure to modify versionCode and versionName before each packaging.

Then click Run -> Mobile App Playground -> Generate Custom Playground, choose Customize playground native runner -> Standard Mode(upload code and certificate, DCloud promises not to keep).

Wait for packaging to complete.

  1. Run the program

Use USB cable to connect your device, then click Run -> Mobile App Playground -> Android Run.

Choose the connected device and then click Operating with custom playground -> run.

Interface Specification

Import

const cashBox = uni.requireNativePlugin("UNIPHIZ-API-CashBox-CashBoxManager")

Usage

1. init()

Initialize CashBoxManager

Returns:

  • JSON object of result
    • code - code of result
    • message - message of result
    • data - data of result

2. popOut()

Open the cash box

Returns:

  • JSON object of result
    • code - code of result
    • message - message of result
    • data - data of result

3. popOutByChannel(channel: number)

Open the cash box

Parameters:

  • channel (number) - cash box channel (0-255)

Returns:

  • JSON object of result
    • code - code of result
    • message - message of result
    • data - data of result

4. status()

Check the cash box status

Returns:

  • JSON object of result
    • code - code of result
    • message - message of result
    • data - 1 - Open; 0 - Closed or Unable to detect cash box status; <0 - Error occurred

5. statusOfChannel(channel: number)

Check the cash box status

Parameters:

  • channel (number) - cash box channel (0-255)

Returns:

  • JSON object of result
    • code - code of result
    • message - message of result
    • data - 1 - Open; 0 - Closed or Unable to detect cash box status; <0 - Error occurred

6. destroy()

Release CashBoxManager

Returns:

  • None

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

作者未提供license.md

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问