开发者

Getting city and country information on Android

I want to get a users city and country information WITHOUT GPS enabled? Is there a way 开发者_JS百科to obtain this data from their carriers?


Use LocationManager to get the location. You need to add permission for ACCESS_COARSE_LOCATION in the manifest file


TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String countryCode = tm.getNetworkCountryIso();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜