2010-09-02 8 views
2

J'ai une application qui télécharge un très gros fichier (plus de 50 Mo). Malheureusement, je reçois des rapports que le téléchargement échoue.Télécharger grand fichier dans Android

Ci-dessous se trouve le logcat d'une telle défaillance, qui se termine par java.net.SocketException: The operation timed out. Entre-deux il y a différents messages du . Je ne sais pas comment interpréter ces messages.

Y at-il quelque chose de spécial que je devrais faire pour télécharger un gros fichier, ou est-ce simplement un problème de connexion?

09-02 16:41:19.925 I/ActivityManager( 646): Displayed activity com.example/com.example.sp.MainActivity: 1110 ms (total 3786 ms) 
09-02 16:41:21.935 W/InputManagerService( 646): Window already focused, ignoring focus gain of: [email protected] 
09-02 16:41:23.495 I/global (7345): Default buffer size used in BufferedInputStream constructor. It would be better to be explicit if an 8k buffer is required. 
09-02 16:41:23.895 D/dalvikvm(7345): GC freed 5348 objects/307096 bytes in 160ms 
09-02 16:41:25.885 D/dalvikvm(7345): GC freed 15282 objects/713544 bytes in 124ms 
09-02 16:41:27.405 D/dalvikvm(7345): GC freed 11775 objects/524576 bytes in 131ms 
09-02 16:41:28.982 I/wpa_supplicant(7284): CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys 
09-02 16:41:28.985 V/WifiMonitor( 646): Event [CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys] 
09-02 16:41:28.985 V/WifiStateTracker( 646): New network state is DISCONNECTED 
09-02 16:41:28.985 I/wpa_supplicant(7284): CTRL-EVENT-STATE-CHANGE id=0 state=0 
09-02 16:41:28.985 V/WifiMonitor( 646): Event [CTRL-EVENT-STATE-CHANGE id=0 state=0] 
09-02 16:41:28.995 V/WifiStateTracker( 646): Changing supplicant state: COMPLETED ==> DISCONNECTED 
09-02 16:41:29.086 I/wpa_supplicant(7284): CTRL-EVENT-STATE-CHANGE id=0 state=2 
09-02 16:41:29.086 V/WifiMonitor( 646): Event [CTRL-EVENT-STATE-CHANGE id=0 state=2] 
09-02 16:41:29.086 V/WifiStateTracker( 646): Changing supplicant state: DISCONNECTED ==> SCANNING 
09-02 16:41:29.086 W/wpa_supplicant(7284): Failed to initiate AP scan. 
09-02 16:41:29.095 I/wpa_supplicant(7284): CTRL-EVENT-SCAN-RESULTS Ready 
09-02 16:41:29.095 I/wpa_supplicant(7284): Trying to associate with 00:1c:f0:6e:2a:56 (SSID='WLANR' freq=2412 MHz) 
09-02 16:41:29.095 E/wpa_supplicant(7284): Set_key: Wrong Key 
09-02 16:41:29.095 E/wpa_supplicant(7284): Set_key: Wrong Key 
09-02 16:41:29.095 E/wpa_supplicant(7284): Set_key: Wrong Key 
09-02 16:41:29.095 E/wpa_supplicant(7284): Set_key: Wrong Key 
09-02 16:41:29.095 E/wpa_supplicant(7284): Set_key: Wrong Key 
09-02 16:41:29.095 I/wpa_supplicant(7284): CTRL-EVENT-STATE-CHANGE id=0 state=3 
09-02 16:41:29.105 V/WifiMonitor( 646): Event [Trying to associate with 00:1c:f0:6e:2a:56 (SSID='WLANR' freq=2412 MHz)] 
09-02 16:41:29.105 V/WifiMonitor( 646): Event [CTRL-EVENT-STATE-CHANGE id=0 state=3] 
09-02 16:41:29.125 V/WifiStateTracker( 646): Changing supplicant state: SCANNING ==> ASSOCIATING 
09-02 16:41:29.825 I/wpa_supplicant(7284): CTRL-EVENT-STATE-CHANGE id=0 state=4 
09-02 16:41:29.825 V/WifiMonitor( 646): Event [CTRL-EVENT-STATE-CHANGE id=0 state=4] 
09-02 16:41:29.825 V/WifiStateTracker( 646): Changing supplicant state: ASSOCIATING ==> ASSOCIATED 
09-02 16:41:29.825 I/wpa_supplicant(7284): Associated with 00:1c:f0:6e:2a:56 
09-02 16:41:29.825 I/wpa_supplicant(7284): CTRL-EVENT-STATE-CHANGE id=0 state=7 
09-02 16:41:29.825 I/wpa_supplicant(7284): CTRL-EVENT-CONNECTED - Connection to 00:1c:f0:6e:2a:56 completed (reauth) [id=0 id_str=] 
09-02 16:41:29.825 I/wpa_supplicant(7284): wpa_supplicant - IPC_EVENT_AUTH_SUCC 
09-02 16:41:29.825 V/WifiMonitor( 646): Event [Associated with 00:1c:f0:6e:2a:56] 
09-02 16:41:29.825 V/WifiMonitor( 646): Event [CTRL-EVENT-STATE-CHANGE id=0 state=7] 
09-02 16:41:29.845 V/WifiStateTracker( 646): Changing supplicant state: ASSOCIATED ==> COMPLETED 
09-02 16:41:29.855 V/WifiMonitor( 646): Event [CTRL-EVENT-CONNECTED - Connection to 00:1c:f0:6e:2a:56 completed (reauth) [id=0 id_str=]] 
09-02 16:41:29.855 V/WifiStateTracker( 646): New network state is CONNECTED 
09-02 16:41:29.865 D/WifiStateTracker( 646): Deconfiguring interface and stopping DHCP 
09-02 16:41:29.865 E/wpa_supplicant(7284): prepare_filter_struct: type=5 
09-02 16:41:29.945 E/FileUtils(7345): Download failed 
09-02 16:41:29.945 E/FileUtils(7345): java.net.SocketException: The operation timed out 

Répondre

4

Le téléphone se déconnecte du Wi-Fi en mode veille, ce qui, je suppose, a été la cause ici? Jetez un oeil à WifiManager's WifiLock to see how you can prevent it.

+0

Si le problème est le mode veille, ne devrait pas il suffit d'utiliser \t \t getWindow(). AddFlags (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)? Est-il vraiment nécessaire de demander un WifiLock pour télécharger un gros fichier? – hpique

+2

Vous ne voudrez pas garder l'écran allumé car cela brûle la batterie. Acquérir un verrou WIFI à la place et laissez le service/tâche s'exécuter jusqu'à la fin, puis relâchez-le. Ce n'est pas beaucoup de code à la fin. –

Questions connexes