2010-10-27 173 views
-1

你好 在我的android應用程序中,我試圖運行一個使用GPRS連接而不是WIFI的應用程序。 當試圖運行在WiFi的應用程序運行良好。 瀏覽器可以正常使用APN設置,但是當嘗試使用我的應用程序連接到服務器時,它會給我套接字異常。套接字異常套接字未連接android

我在清單文件中使用下面的權限。

<uses-permission android:name="android.permission.INTERNET"></uses-permission> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses- permission> 
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission> 
<uses-permission android:name= "android.permission.CHANGE_NETWORK_STATE"></uses-permission> 
<uses-permission android:name= "android.permission.WRITE_APN_SETTINGS" ></uses-permission> 
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" ></uses-permission> 

我正在接收套接字未連接異常。 是否有任何其他許可,我需要添加使用除WIFI以外的GPRS連接。

日誌細節

10-27 18:26:19.689:WARN/CalSyncSvc(166):com.motorola.blur.service.email.protocol.activesync.ASException:問題執行HTTP POST 10 -27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur.service.email.protocol.activesync.ActiveSyncMgr.sendRequest(Unknown Source) 10-27 18:26:19.689:WARN/CalSyncSvc (166):at com.motorola.blur.service.email.protocol.activesync.ActiveSyncMgr.sendXMLCommandNoProvisoning(Unknown Source) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur。 service.email.protocol.activesync.ActiveSyncMgr.sendXMLCommand0(未知來源) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur.service.email.protocol.activesync.ActiveSyncMgr.sendXMLCommand(Unknown Source) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur.service.email.protocol.activesync.ActiveSyncMgr.sendFolderSyncCommand(Unknown Source) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola。 blur.service.email.protocol.activesync.ProviderAPI.sendFolderSync(Unknown Source) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur.service.email.protocol.activesync.ProviderAPI .updateMapFromFolderSync(Unknown Source) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur.service.email.protocol.activesync.ProviderAPI.updateFromFolderSync(Unknown Source) 10-27 18 :26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur.calendar.sync.activesync.Sync Service.syncAccount(Unknown Source) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur.calendar.sync.activesync.SyncService $ QueueEntry.run(Unknown Source) 10-27 18:26:19.689:WARN/CalSyncSvc(166):在java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:416) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at java.util.concurrent.FutureTask $ Sync.innerRun(FutureTask.java:256) 10-27 18:26:19.689:WARN/CalSyncSvc(166):在java.util.concurrent.FutureTask.run(FutureTask.java: 122) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at java.util.concurrent.ThreadPoolExecutor $ Worker.runTask(ThreadPoolExecutor.java:648) 10-27 18:26:19.689:WARN/CalSyncSvc(166):在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:673) 10-27 18:26:19.689 :WARN/CalSyncSvc(166):at java.lang.Thread.run(Thread.java:1058) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur.util.concurrent .BlurThreadFactory $ BlurPooledThread.run(未知源) 10-27 18:26:19.689:WARN/CalSyncSvc(166):導致:java.net.SocketTimeoutException:套接字未連接 10-27 18:26:19.689: WARN/CalSyncSvc(166):at org.apache.harmony.luni.platform.OSNetworkSystem.connectStreamWithTimeoutSocketImpl(Native Method) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.harmony.luni .platform.OSNetworkSystem.connectStreamWithTimeoutSocket(OSNetworkSystem.java:140) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl。java:229) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:521) 10-27 18:26: 19.689:WARN/CalSyncSvc(166):在java.net.Socket.connect(Socket.java:1019) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.http.conn。 ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:317) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:129) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119) 10 -27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348) 10-27 18:26:19.689:WARN/CalSyncSvc 166):at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.http.impl。 client.AbstractHttpClient.execute(AbstractHttpClient.java:487) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465) 10-27 18:26:19.689:WARN/CalSyncSvc(166):... 17更多 請讓我知道您的寶貴建議。

感謝提前:)

+0

將stacktrace添加到您的問題 – KevinDTimm 2010-10-27 12:36:09

+0

已編輯與日誌的問題。 – Remmyabhavan 2010-10-27 13:07:30

回答

0

我在這漫長的搜索後已經開始知道,Android應用程序不運行WAP客戶端上正常,但運行正常使用GPRS網絡連接。

這意味着如果您的移動網絡設置中只設置了WAP接入點,則可以使用瀏覽器進行一定的擴展,但不能直接套接字連接。您需要a)在「無線和網絡」/「移動網絡」中設置互聯網接入點,並將其選爲Android應用程序的默認設置,以獲得無限制的訪問權限。