通过PC Opera浏览器访问:
GET /wapuid/spi/service.do HTTP/1.1
user-agent:Opera/9.80 (Windows NT 5.1; U; zh-cn) Presto/2.6.30 Version/10.61
host:218.137.168.240:8080
accept:text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
accept-language:zh-CN,zh;q=0.9,en;q=0.8
accept-charset:iso-8859-1, utf-8, utf-8, *;q=0.1
accept-encoding:deflate, gzip, x-gzip, identity, *;q=0
connection:Keep-Alive
手机CMWAP拨号访问(基于代理的应用模式):
清单1:
GET /wapuid/spi/service.do HTTP/1.1
host:218.137.168.240:8080
accept:*/*, text/x-vcard, text/x-vcalendar, image/gif, image/vnd.wap.wbmp
content-length:0
via:WTP/1.1 GDGZ-PB-GW011-WAP22 (Nokia WAP Gateway 4.1 CD1/ECD13_D/4.1.04) (说明经过了代理网关)
x-forwarded-for:10.249.142.203 (WAP网关地址)
x-up-calling-line-id:15659590673 (有可能是086打头)
x-source-id:SZHGGSN202BNk (核心网GGSN网元)
x-nokia-connection_mode:TCP
x-up-bearer-type:GPRS (无线网络类型)
x-nokia-gateway-id:NWG/4.1/Build4.1.04
connection:close
清单2:
GET /wapuid/spi/service.do HTTP/1.0
connection:Keep-Alive
host:218.137.168.240:8080
accept:application/vnd.wap.wmlc, application/vnd.wap.wmlscriptc, text/vnd.wap.wml, image/vnd.wap.wbmp, */*
accept-charset:utf-8, iso-8859-1
accept-language:en, zh-cn
x-online-host:218.137.168.240:8080
via:HTTP/1.1 GDSZ-PS-WAP11-GW029 (infoX-WISG, Huawei Technologies)
手机CMNET拨号访问:
清单1:
GET /wapuid/spi/service.do HTTP/1.1
host:218.137.168.240:8080
accept:*/*
user-agent:UNTRUSTED/1.0
x-online-host:218.137.168.240:8080
手机彩信拨号访问(基于代理的应用模式):
与CMWAP拨号的数据包格式相同
清单1:
GET /wapuid/spi/service.do HTTP/1.1
host:218.137.168.240:8080
accept:*/*
x-online-host:218.137.168.240:8080
cookie:jid=M5FmQZt1W5!1950346616;$path=/
x-forwarded-for:10.220.244.117
via:ZXWAP GateWay,ZTE Technologies
connection:close
应用1:
针对J2ME编程,不管用户是选择CMWAP拨号还是CMNET拨号,可以采用以下编程即可以访问
比如访问的URL为:url=http://218.137.168.240:8080/wapuid/spi/service.do
HttpConnection hc = (HttpConnection)Connector.open(url, Connector.READ, true);
hc.setRequestProperty("x-online-host","218.137.168.240");
如果是采用如下编程,即只能要求用户选择CMWAP拨号(假如WAP网关地址为10.0.0.172)
HttpConnection hc = (HttpConnection)Connector.open("http://10.0.0.172:8080/wapuid/spi/service.do", Connector.READ, true);
hc.setRequestProperty("x-online-host","218.137.168.240");
应用2:
服务器如何获取手机终端的APN类型:
可通过获取HTTP包头的"via"实体,如果该实体存在,即肯定是基于代理模式上网(如CMWAP拨号或彩信APN拨号)
如果服务器是白名单服务器,即不管是CMWAP拨号或彩信拨号均可以取到手机号
还有一种办法就是把移动的WAP网关IP都收集到,然后根据远程服务器的IP来判断。
在CheckBoxPreference中显示一个toast,他会在执行整个过程完毕 才出现toast
我想先出现toast在执行别的
myCheckBox.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Toast.makeText(Prefs.this,
"test",
Toast.LENGTH_SHORT).show(); ();
return false;
}
});
doSomething
上面不会先出现对话鲁昂 在出现dosoming
应该
myCheckBox.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Toast.makeText(Prefs.this,
"test",
Toast.LENGTH_SHORT).show();
Prefs.this.runOnUiThread(new Runnable() {
@Override
public void run() {
doSomething();
}
});
return false;
}
});
“上面不会先出现对话鲁昂 在出现dosoming”
Coordinating activities---activity实例间协调
When one activity starts another, they both experience lifecycle transitions. One pauses and may stop, while the other starts up. On occasion, you may need to coordinate these activities, one with the other.【翻译:当一个activity实例发出intent请求去启动另外一个activity实例的时候,这两个实例当前生命周期状态都将发生变化,一个进入暂停状态继而可能被stop,另一个被启动。有时候开发者可能需要两个实例相互协调。】
The order of lifecycle callbacks is well defined, particularly when the two activities are in the same process:---翻译:生命周期回调顺序是预定好的,尤其是当两个实例属于同一个进程的时候。
1. The current activity's onPause() method is called.---翻译:当前实例的onPause()方法被系统调用。
2. Next, the starting activity's onCreate(), onStart(), and onResume() methods are called in sequence.---翻译:之后,被启动的实例的onCreate(), onStart(), 和 onResume()方法被系统依次调用。
3. Then, if the starting activity is no longer visible on screen, its onStop() method is called.---翻译:然后,如果被启动的实例如果不在屏幕上显示的话,该实例的 onStop()方法被系统调用执行。