【问题标题】:Trace mobile service provider name追踪移动服务提供商名称
【发布时间】:2013-01-08 06:31:23
【问题描述】:

我被分配了访问移动服务提供商名称而不是位置的任务。我搜索并提到了很多东西。但我找不到。所有都显示有关位置(即纬度和经度值),其中一些显示网络提供商名称。我需要像 Cell Info Display Name 这样的东西。

Example: If I'm using Vodafone Network it will display the service provider name that my mobile is currently using.

我不需要在地图中显示位置和地点。我只需要显示服务提供商名称。有什么方法吗?谁能通过示例代码解释一下?

【问题讨论】:

  • 它没有显示清楚。我想显示塔名而不是操作员姓名
  • 你看不到塔的名字,你只能得到它的单元格ID
  • 从cell id如何识别地点?

标签: android service-provider


【解决方案1】:
// Returns the alphabetic name of current registered operator

public String getServiceProvider() {

      TelephonyManager manager = (TelephonyManager)
      getSystemService(Context.TELEPHONY_SERVICE);

      String carrierName = manager.getNetworkOperatorName(); // alphabetic name of current registered operator

      return carrierName;
}

示例输出: 沃达丰

【讨论】:

  • 描述你的答案总是比仅仅发布代码更好
  • @user4010519 如果我使用双卡移动方式,我如何获得两个运营商名称?
【解决方案2】:

请检查以下代码

 TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
        String deviceID =telephonyManager.getDeviceId();
        String deviceID1 =telephonyManager.getSimSerialNumber();
        String deviceID2 =telephonyManager.getSimOperatorName();

获取您的手机 ID: http://android-coding.blogspot.in/2011/06/get-location-of-cell-id-from.html使用此链接..

从上面的链接中,您将使用 HttpGet() 从 opencellid.org 获取 Cell ID 的位置。

编辑 2

您好,请参阅下面相同类型问题的链接。

Get Cell Tower Locations - Android

【讨论】:

  • 没有。我想得到塔区的结果(即塔所在的地名)
  • 为此您需要获取当前位置..然后需要进行反向地理编码..这样您将获得当前区域..
  • 您好,请查看我编辑的帖子链接..从中您将获得单元格 ID。和位置..所以从那个尝试
  • 嗨,从反向地理编码我会得到位置。不是塔名。反正我会试试的
【解决方案3】:

使用此代码,它将为您提供您的服务提供商名称:

TelephonyManager telephonyManager = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE));
String operatorName = telephonyManager.getNetworkOperatorName();

【讨论】:

  • 它会提供塔名吗?我认为它只会显示提供者名称
  • 是的,此方法只会为您提供服务提供商名称。因此,您还希望塔名称与服务提供商名称。
  • 我只想显示塔名。它不会那样做
  • 无法直接获取塔名。你只能得到 cell id 。您必须找到一种使用单元格 ID 获取塔名的方法。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-04-04
  • 2020-07-22
  • 1970-01-01
相关资源
最近更新 更多