NativePlugin

NativePlugin Sample
York Cui0.0.10
platforms: android
$ cordova plugin add cn.edu.gdmec.t00385.cordova.carrier

cn.edu.gdmec.t00385.cordova.carrier

这是个用于测试cordova Ver3.0的插件编写的案例,可以返回android手机的运营商名称。

Installation 安装方法

cordova plugin add https://github.com/gdmec/carrierplugin.git

Supported Platforms

  • Android

Methods 调用方法

  • navigator.Carrier.getCarrierCode(onSuccess, onFailure);

Example

<button onclick="test();">获取手机运营商</button>
<script type="text/javascript">
    function test() {
        Carrier.getCarrierCode(onSuccess, onFailure);
    }
    function onSuccess(result) {
        alert("运营商: " + result);
    }
    function onFailure(err) {
        alert("Failure: " + err);
    }
</script>