今天,我有一个问题需要帮助。 有没有办法让Android应用程序只在某种类型的设备上运行? (就像它只在三星或索尼设备上运行..) 怎么做?
感谢您的帮助!
答案 0 :(得分:-1)
您可以借助以下代码执行此操作....
public String getDeviceName() {
String manufacturer = Build.MANUFACTURER;
String model = Build.MODEL;
if (model.startsWith(manufacturer)) {
return capitalize(model);
} else {
return capitalize(manufacturer) + " " + model;
}
}
然后:
if (
manufactures == "Samsung" || "samsung")
{
Log.d ("device","This device manufactured from samsung");
}
else {
Log.d ("device","This device not manufactured from samsung Sorry!!!");
}