UsA*_*R33 18 android google-play google-play-services
在我的应用程序中,我推荐相关的应用程序,但只想推荐它们,如果它们实际上可以安装在设备上(例如相关应用程序的目标国家/地区的设备,正确的操作系统版本等).请参阅https://developer.android.com/google/play/filters.html
遗憾的是,没有API可以将应用与特定设备进行比较.Play商店是在内部以某种方式做的.
所以,第二种方法是要走的路.最常见的过滤器是
国家(因为你无法检索"游戏商店国家",使用其他方法...)
String locale = context.getResources().getConfiguration().locale.getCountry();
// or if you are sure there is a SIM-card
TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String countryCode = tm.getSimCountryIso();
// or use country of current network (i.e. from 3G)
String countryCode = tm.getNetworkCountryIso()
Run Code Online (Sandbox Code Playgroud)if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD) {
// only for gingerbread and newer versions
}
Run Code Online (Sandbox Code Playgroud)Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
Run Code Online (Sandbox Code Playgroud)您可能想要检查其他信息,例如可用的传感器(您可以通过传感器进行检查getSensorList).要列出它们,所有都会创建一个很长的列表,找到所有找到这些东西的API很容易,所以我不会列出所有这些.
通过检查国家/地区,版本和屏幕大小,您应该对大多数应用程序都是安全的.
| 归档时间: |
|
| 查看次数: |
2873 次 |
| 最近记录: |