|
发表于 2011-11-2 15:53:12
|
显示全部楼层
This is my way to get the imei_number (same as phone-number for ChinaMobile) from http header, x-up-calling-line-id is for ChinaMobile, others is for some other different mobiles.
The fake_imei is my final defense, in case I cannot get the client unique id. 
public static String getImei(HttpServletRequest request)
{
String uni_id = request.getHeader("x-up-calling-line-id");
if (uni_id == null)
{
uni_id = request.getHeader("x-up-subno");
}
if (uni_id == null)
{
uni_id = request.getHeader("ClientID");
}
if (uni_id == null)
{
uni_id = "fake_imei";
} // if
System.out.println("imei: " + uni_id);
return uni_id;
}
I hope this helps. |
|