Android Document文档如下所示,提到建议使用 IntentService 的 onHandleIntent()函数管理任务,而不是简单的启动一个线程来处理:
Should you use a service or a thread? A service is simply a component that can run in the background even when the user is not interacting with your application. Thus, you should create a service only if that is what you need. If you need to perform work outside your main thread, but only while the user is interacting with your application, then you should probably instead create a new thread and not a service. For example, if you want to play some music, but only while your activity is running, you might create a thread in onCreate(), start running it in onStart(), then stop it in onStop(). Also consider using AsyncTask or HandlerThread, instead of the traditional Thread class. See the Processes and Threading document for more information about threads. Remember that if you do use a service, it still runs in your application's main thread by default, so you should still create a new thread within the service if it performs intensive or blocking operations.
网上也有人说 最好在accept()blocked 的时候关闭 ServerSocket ,就不会发生SocketTimeoutException了,不知道对不对,但都是dcloud内部的io.dcloud.net.http.MiniServer$Server的处理模式,不知道能否修改,求助大拿
13 个回复
Hadooper (作者)
按照支付宝的demo,都是在客户端实现的,但HBuilder里面却是通过服务器端实现的,有高手吗?
Hadooper (作者)
每次提交完毕,就显示“系统繁忙,请稍后再试”,不知道为什么
Hadooper (作者)
http://ask.dcloud.net.cn/article/71
虽然贴出来了,但// 对签名字符串转义function createLinkstring($para)函数中,对于¬没有处理,导致乱码,
while (list ($key, $val) = each ($para)) {
$arg.=htmlspecialchars($key.'="'.$val.'"&');
}
如上黑色字体部分,但修改后,提交还是提示“系统繁忙,请稍后再试”,错误码是62001取消订单,也不知道为什么
Hadooper (作者)
订单如下所示,看不出什么问题,就是无法成功,求大神支持。
service="mobile.securitypay.pay"&partner="2088712860900537"&_input_charset="UTF-8"&out_trade_no="20150321154919"&subject="ABC订单"&payment_type="1"&seller_id="apemeetit@sina.com"&total_fee="1"&body="ABC订单。"&it_b_pay="1d"¬ify_url="http%3A%2F%2F192.254.133.243%2Fpayment%2Fnotify.php"&show_url="http%3A%2F%2F192.254.133.243%2F"&sign="EJA2w4LhNJB4lpuCGPDcnxadZBbCURNFYa4K1SMh%2F4yO2ytzEVGIZYbHlOEZ2pP4cbrc6QYsG%2FIESuip3vECuMsGWqGP4I8gTrCzY3DTdZqBw8PMgMOk8nNiMR3V%2Bf3u0yjp9arYzTNJoJv%2FARCFaqpA4mfkEkojiV3JbesS3RM%3D"&sign_type="RSA"
Hadooper (作者)
PHP调试不方便,改成java后台,结果提示62008, 系统繁忙,请稍后再试(C6),很奇怪,查了文档,说是“网络问题引起的错误”
我也是醉了
Hadooper (作者)
将应用搬迁到Eclipse下面,使用调试模式,异常报错“系统繁忙,请稍后再试(C6)”, error的code是62008,Eclipse报错调试信息如下:
W/System.err(18647): java.net.SocketException: Socket closed
W/System.err(18647): at libcore.io.Posix.accept(Native Method)
W/System.err(18647): at libcore.io.BlockGuardOs.accept(BlockGuardOs.java:55)
W/System.err(18647): at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:98)
W/System.err(18647): at java.net.ServerSocket.implAccept(ServerSocket.java:203)
W/System.err(18647): at java.net.ServerSocket.accept(ServerSocket.java:128)
W/System.err(18647): at io.dcloud.net.http.MiniServer$Server.run(MiniServer.java:91)
W/System.err(18647): at java.lang.Thread.run(Thread.java:841)
W/IInputConnectionWrapper(18647): showStatusIcon on inactive InputConnection
请高手解析,看不懂了,都在dcloud内部了
Android_磊子
这块是localhost处理的地方,跟支付没有关系。
2015-03-23 10:40
Hadooper (作者)
是的,我也调试了dcloud的示例,确实Localhost部分一样的报错,示例可以继续执行,但我修改了服务器端,服务器端的响应代码基本一样,现在只能怀疑是不是私钥有没有问题了,我准备用支付宝示例文件试一下了
2015-03-23 21:58
Hadooper (作者)
Android Document文档如下所示,提到建议使用 IntentService 的 onHandleIntent()函数管理任务,而不是简单的启动一个线程来处理:
Should you use a service or a thread? A service is simply a component that can run in the background even when the user is not interacting with your application. Thus, you should create a service only if that is what you need. If you need to perform work outside your main thread, but only while the user is interacting with your application, then you should probably instead create a new thread and not a service. For example, if you want to play some music, but only while your activity is running, you might create a thread in onCreate(), start running it in onStart(), then stop it in onStop(). Also consider using AsyncTask or HandlerThread, instead of the traditional Thread class. See the Processes and Threading document for more information about threads. Remember that if you do use a service, it still runs in your application's main thread by default, so you should still create a new thread within the service if it performs intensive or blocking operations.
网上也有人说 最好在accept()blocked 的时候关闭 ServerSocket ,就不会发生SocketTimeoutException了,不知道对不对,但都是dcloud内部的io.dcloud.net.http.MiniServer$Server的处理模式,不知道能否修改,求助大拿
Hadooper (作者)
使用今天更新的H5builder,调试信息在界面上显示,但结果还是一样的,只是可以看到请求订单成功,但支付失败,提示结果是 [62008]: null
没有更多信息了
Hadooper (作者)
完整的debug日志如下所示,其中,url隐去了。
03-22 14:04:14.605: I/webview(8112): onLoadResource url=http://www.xxx.com/car/alipay.jsp?total=1
03-22 14:04:14.940: I/DCloud_LOG(8112): onPause
03-22 14:04:14.985: W/System.err(8112): java.net.SocketException: Socket closed
03-22 14:04:14.990: W/System.err(8112): at libcore.io.Posix.accept(Native Method)
03-22 14:04:14.995: W/System.err(8112): at libcore.io.BlockGuardOs.accept(BlockGuardOs.java:55)
03-22 14:04:14.995: W/System.err(8112): at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:98)
03-22 14:04:15.000: W/System.err(8112): at java.net.ServerSocket.implAccept(ServerSocket.java:203)
03-22 14:04:15.005: W/System.err(8112): at java.net.ServerSocket.accept(ServerSocket.java:128)
03-22 14:04:15.005: W/System.err(8112): at io.dcloud.net.http.MiniServer$Server.run(MiniServer.java:91)
03-22 14:04:15.010: W/System.err(8112): at java.lang.Thread.run(Thread.java:841)
03-22 14:04:15.060: W/IInputConnectionWrapper(8112): showStatusIcon on inactive InputConnection
03-22 14:04:16.955: I/DCloud_LOG(8112): onResume resumeTime=1427004256960
Hadooper (作者)
用了自带的测试了下,dcloud好像也是上面的socket报错,但却可以跳出支付宝快捷支付的画面,看来上面的错误虽然在,但不影响使用,那是不是我的服务器端有什么配置不对呢,求助大神们
tzheng517
建议参考这个示例:http://ask.dcloud.net.cn/question/2673
Hadooper (作者)
谢谢反馈,但我就是按照这个示例写的服务器端,还是不行
Hadooper (作者)
终于成功了,直接调用payservice就可以了,为什么用jsp写就不行了,我也是醉了
myzyq
请问是怎么改好了?
2015-07-08 17:56