在Appcelerator Titanium中获取网络运营商名称 [英] Get network operator name in Appcelerator Titanium
问题描述
我正在寻找用户Android设备的运营商名称.
I am looking to get the name of the operator for the user's Android device.
E.g. "Verizon" or "Vodafone", I think I have found the Android equivalent documented here called getSimOperatorName() from http://developer.android.com/reference/android/telephony/TelephonyManager.html#getNetworkOperatorName()
我正在浏览Appcelerator Titanium的文档,但似乎无法在docs中找到做到这一点的方法(
I am scanning over the documentation for Appcelerator Titanium, but can't seem to find a way of doing this in the docs (http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Network).
在Appcelerator Titanium中有可能吗?
Is this possible in Appcelerator Titanium?
推荐答案
我无法使tinetworkinfo模块正常工作.但是,名为 TelephonyManager 的模块可以正常工作.
I could not get tinetworkinfo Module working. However, a module named TelephonyManager worked fine.
我在终端的项目中运行了这个
I ran this in the terminal for the project:
gittio安装com.goyya.telephonymanager
gittio install com.goyya.telephonymanager
然后使用此代码获取网络运营商名称:
Then this code to get the network operator name:
var telephonymanager = require("com.goyya.telephonymanager");
Ti.API.log('networkOperatorName: ' + telephonymanager.networkOperatorName);
这篇关于在Appcelerator Titanium中获取网络运营商名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!