如何使应用程序只在一种类型的Android设备上运行?

时间:2013-08-10 03:24:09

标签: android device samsung-mobile

今天,我有一个问题需要帮助。 有没有办法让Android应用程序只在某种类型的设备上运行? (就像它只在三星或索尼设备上运行..) 怎么做?

感谢您的帮助!

1 个答案:

答案 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!!!");
}