I am trying to detect the device model and trying to do some operations based on that.
I do the code to detect the device model and manufacturer but for some reason its giving me a negative result.
Here's the code to detect the device model and manufacturer:
private Boolean isHTCone(){
//For model and manufacturer both
String HTC_MODEL_MANUFACTURER = android.os.Build.MODEL+""+android.os.Build.MANUFACTURER;
//If true then do something
Boolean isHTC = true;
//My model name
String HTCModel = "HTC6500LVW";
//For device model
String MyBuildModel = android.os.Build.MODEL;
//For manufacturer
String MyBuildManufacturer = android.os.Build.MANUFACTURER;
//Check for the condition
if(MyBuildModel==HTCModel){
Log.i("Device Model is: ", android.os.Build.MODEL);
return true;
}
else{
Log.i("Device is not HTC One");
return false;
}
}
Its always giving me a wrong value. Even when my device model is "HTC6500LVW", it's not accepting the if loop and is going to the else.
Can anyone tell me if I am doing something wrong here. I will really appreciate it.
Thanks in advance..:)