如何在没有任何HTTP呼叫的情况下获取用户的大陆?

时间:2016-05-14 21:56:07

标签: android geolocation location

我的游戏中有一个服务器列表,其中包含“欧洲服务器”,“美国服务器”等字样。我想对它们进行排序并在同一用户的大陆上显示更高的服务器。我不想添加任何其他权限,也不想进行任何HTTP调用(我觉得它们会增加加载持续时间)。我该怎么办?

2 个答案:

答案 0 :(得分:0)

您可以尝试使用cout << "Q1. Which of these languages is not used to make Computer Software?" << endl; cout << "a. Python" << endl; cout << "b. Java" << endl; cout << "c. C++" << endl; cout << "d. HTML" << endl; cout << "" << endl; cin >> ans; cout << "" << endl; cout << "Press Enter to Continue"; cin.ignore(); Locale.getDefault并按结果设置大陆。

答案 1 :(得分:0)

您考虑使用本地地理位置数据库。您只需收集用户IP地址,然后从数据库中查询它以获取国家和大陆信息。

有几个免费的数据库。作为参考,您可以从https://lite.ip2location.com/database-ip-country

下载免费数据库
相关问题