返回> 网站首页 

[转载]在J2ME联网应用中获得客户端的手机号码

yoours2011-04-18 14:13:11 阅读 1209

简介一边听听音乐,一边写写文章。

       J2ME程序开发过程中,为了一定的需要,经常需要来获得用户的手机号码,但是这个功能却在标准的J2ME类库中没有提供。

       在使用中国移动的CMWAP方式连接网络时,中国移动会将用户的手机号码放在一个名称为x-up-calling-line-id的头信息中,可以通过读取该头信息,获得用户的手机号码,具体代码如下:

       

String usermphone = http.getHeader("x-up-calling-line-id");

其中httpHttpConnction类型的对象。

补一下 我以前测试用的

a= request.ServerVariables("http_X_UP_subno")

b= request.ServerVariables("http_x-up-calling-line-id")

c= request.ServerVariables("http_user-agent")

d= request.ServerVariables("http_x_up_calling_line_id")

e= request.ServerVariables("deviceid")

f= request.ServerVariables("x_up_calling_line_id")

g= request.ServerVariables("x-up-calling-line-id")

h= request.ServerVariables("user_agent")

i= request.ServerVariables("user-agent")

j= request.ServerVariables("http_x_up_bear_type")

应该移动联通的手机就放在这么几个头里 全取出来测试下吧!

微信小程序扫码登陆

文章评论

1209人参与,0条评论