Soru & Cevap

AsyncTask ile Server Bağlantı Kontrolünü Nasıl Yaparım?

11.03.2014 - 11:51

Merhaba

Asynctask kullanarak bir server da bağlantı varmı yokmu nasıl kontrol edebilirim? Konuyla ilgili bazı kodlar buldum ama işe yaradıkları söylenemez!

Sizin konuyla ilgili düşünceleriniz yada önerileriniz nelerdir? Denediğim kodlar ve aldığım hataları sizlerle paylaşıyorum.

Teşekkürler

Örnek Kod 1;

 public boolean isConnectedToServer(String url, int timeout) {
        try{
            URL myUrl = new URL(url);
            URLConnection connection = myUrl.openConnection();
            connection.setConnectTimeout(timeout);
            connection.connect();
            return true;
        } catch (Exception e) {
            // Handle your exceptions
            return false;
        }
    }

Örnek Kod1 Hatası;

03-11 09:43:49.428: E/ActivityThread(644): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d5c4b8 that was originally bound here
03-11 09:43:49.428: E/ActivityThread(644): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d5c4b8 that was originally bound here
03-11 09:43:49.428: E/ActivityThread(644):     at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
03-11 09:43:49.428: E/ActivityThread(644):     at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
03-11 09:43:49.428: E/ActivityThread(644):     at android.app.ContextImpl.bindService(ContextImpl.java:1418)
03-11 09:43:49.428: E/ActivityThread(644):     at android.app.ContextImpl.bindService(ContextImpl.java:1407)
03-11 09:43:49.428: E/ActivityThread(644):     at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
03-11 09:43:49.428: E/ActivityThread(644):     at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
03-11 09:43:49.428: E/ActivityThread(644):     at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
03-11 09:43:49.428: E/ActivityThread(644):     at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
03-11 09:43:49.428: E/ActivityThread(644):     at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
03-11 09:43:49.428: E/ActivityThread(644):     at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
03-11 09:43:49.428: E/ActivityThread(644):     at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
03-11 09:43:49.428: E/ActivityThread(644):     at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
03-11 09:43:49.428: E/ActivityThread(644):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-11 09:43:49.428: E/ActivityThread(644):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-11 09:43:49.428: E/ActivityThread(644):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-11 09:43:49.428: E/ActivityThread(644):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-11 09:43:49.428: E/ActivityThread(644):     at java.lang.Thread.run(Thread.java:856)
03-11 09:43:49.458: E/StrictMode(644): null
03-11 09:43:49.458: E/StrictMode(644): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d5c4b8 that was originally bound here
03-11 09:43:49.458: E/StrictMode(644):     at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
03-11 09:43:49.458: E/StrictMode(644):     at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
03-11 09:43:49.458: E/StrictMode(644):     at android.app.ContextImpl.bindService(ContextImpl.java:1418)
03-11 09:43:49.458: E/StrictMode(644):     at android.app.ContextImpl.bindService(ContextImpl.java:1407)
03-11 09:43:49.458: E/StrictMode(644):     at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
03-11 09:43:49.458: E/StrictMode(644):     at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
03-11 09:43:49.458: E/StrictMode(644):     at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
03-11 09:43:49.458: E/StrictMode(644):     at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
03-11 09:43:49.458: E/StrictMode(644):     at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
03-11 09:43:49.458: E/StrictMode(644):     at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
03-11 09:43:49.458: E/StrictMode(644):     at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
03-11 09:43:49.458: E/StrictMode(644):     at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
03-11 09:43:49.458: E/StrictMode(644):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-11 09:43:49.458: E/StrictMode(644):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-11 09:43:49.458: E/StrictMode(644):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-11 09:43:49.458: E/StrictMode(644):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-11 09:43:49.458: E/StrictMode(644):     at java.lang.Thread.run(Thread.java:856)
03-11 09:43:49.468: W/ActivityManager(288): Unbind failed: could not find connection for android.os.BinderProxy@40fcafa8
03-11 09:43:49.488: E/ActivityThread(644): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d5c110 that was originally bound here
03-11 09:43:49.488: E/ActivityThread(644): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d5c110 that was originally bound here
03-11 09:43:49.488: E/ActivityThread(644):     at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
03-11 09:43:49.488: E/ActivityThread(644):     at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
03-11 09:43:49.488: E/ActivityThread(644):     at android.app.ContextImpl.bindService(ContextImpl.java:1418)
03-11 09:43:49.488: E/ActivityThread(644):     at android.app.ContextImpl.bindService(ContextImpl.java:1407)
03-11 09:43:49.488: E/ActivityThread(644):     at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
03-11 09:43:49.488: E/ActivityThread(644):     at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
03-11 09:43:49.488: E/ActivityThread(644):     at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
03-11 09:43:49.488: E/ActivityThread(644):     at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
03-11 09:43:49.488: E/ActivityThread(644):     at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
03-11 09:43:49.488: E/ActivityThread(644):     at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
03-11 09:43:49.488: E/ActivityThread(644):     at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
03-11 09:43:49.488: E/ActivityThread(644):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-11 09:43:49.488: E/ActivityThread(644):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-11 09:43:49.488: E/ActivityThread(644):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-11 09:43:49.488: E/ActivityThread(644):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-11 09:43:49.488: E/ActivityThread(644):     at java.lang.Thread.run(Thread.java:856)
03-11 09:43:49.508: E/StrictMode(644): null
03-11 09:43:49.508: E/StrictMode(644): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d5c110 that was originally bound here
03-11 09:43:49.508: E/StrictMode(644):     at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
03-11 09:43:49.508: E/StrictMode(644):     at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
03-11 09:43:49.508: E/StrictMode(644):     at android.app.ContextImpl.bindService(ContextImpl.java:1418)
03-11 09:43:49.508: E/StrictMode(644):     at android.app.ContextImpl.bindService(ContextImpl.java:1407)
03-11 09:43:49.508: E/StrictMode(644):     at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
03-11 09:43:49.508: E/StrictMode(644):     at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
03-11 09:43:49.508: E/StrictMode(644):     at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
03-11 09:43:49.508: E/StrictMode(644):     at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
03-11 09:43:49.508: E/StrictMode(644):     at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
03-11 09:43:49.508: E/StrictMode(644):     at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
03-11 09:43:49.508: E/StrictMode(644):     at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
03-11 09:43:49.508: E/StrictMode(644):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-11 09:43:49.508: E/StrictMode(644):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-11 09:43:49.508: E/StrictMode(644):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-11 09:43:49.508: E/StrictMode(644):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-11 09:43:49.508: E/StrictMode(644):     at java.lang.Thread.run(Thread.java:856)

Örnek Kod 2;

 public boolean isConnected() {
        try {
            ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
            NetworkInfo netInfo = cm.getActiveNetworkInfo();

            if (netInfo != null && netInfo.isConnected()) {
                // Network is available but check if we can get access from the
                // network.
                URL url = new URL(urls);
                HttpURLConnection urlc = (HttpURLConnection) url
                        .openConnection();
                urlc.setRequestProperty("Connection", "close");
                urlc.setConnectTimeout(2000); // Timeout 2 seconds.
                urlc.connect();

                if (urlc.getResponseCode() == 200) // Successful response.
                {
                    return true;
                } else {
                    Log.d("NO INTERNET", "NO INTERNET");
                    Toast.makeText(getApplicationContext(), "URL DOWN", Toast.LENGTH_LONG).show();
                    return false;
                }
            } else {
                Toast.makeText(getApplicationContext(), "NO İNTERNET CONNECTİON", Toast.LENGTH_LONG).show();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }

Örnek Kod2 Hata ;

03-11 09:49:12.600: I/Choreographer(352): Skipped 32 frames!  The application may be doing too much work on its main thread.
03-11 09:49:12.670: I/qtaguid(39): Tagging socket 27 with tag 3f500000000(1013) for uid 10046 failed errno=-2
03-11 09:49:17.880: E/WVMExtractor(39): Failed to open libwvm.so
03-11 09:49:19.781: I/Buffering(780): -2147483648
03-11 09:49:19.820: D/AudioSink(39): bufferCount (4) is too small and increased to 12
03-11 09:49:20.790: I/Buffering(780): -2147483648
03-11 09:49:21.794: I/Buffering(780): -2147483648
03-11 09:49:22.797: I/Buffering(780): -2147483648
03-11 09:49:23.800: I/Buffering(780): -2147483648
03-11 09:49:24.800: I/Buffering(780): -2147483648
03-11 09:49:25.807: I/Buffering(780): -2147483648
03-11 09:49:26.810: I/Buffering(780): -2147483648
03-11 09:49:27.810: I/Buffering(780): -2147483648
03-11 09:49:28.813: I/Buffering(780): -2147483648
03-11 09:49:29.812: I/Buffering(780): -2147483648
03-11 09:49:30.700: I/AudioService(290):  AudioFocus  abandonAudioFocus() from android.media.AudioManager@40cecb90com.android.music.MediaPlaybackService$3@40ceb7b0
03-11 09:49:30.822: I/Buffering(780): -2147483648
03-11 09:49:31.825: I/Buffering(780): -2147483648
03-11 09:49:32.830: I/Buffering(780): -2147483648
03-11 09:49:33.831: I/Buffering(780): -2147483648
03-11 09:49:34.010: D/ExchangeService(635): Received deviceId from Email app: null
03-11 09:49:34.010: D/ExchangeService(635): !!! deviceId unknown; stopping self and retrying
03-11 09:49:34.830: I/Buffering(780): -2147483648
03-11 09:49:35.840: I/Buffering(780): -2147483648
03-11 09:49:36.842: I/Buffering(780): -2147483648
03-11 09:49:37.840: I/Buffering(780): -2147483648
03-11 09:49:38.850: I/Buffering(780): -2147483648
03-11 09:49:39.050: D/ExchangeService(635): !!! EAS ExchangeService, onStartCommand, startingUp = false, running = false
03-11 09:49:39.060: W/ActivityManager(290): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found
03-11 09:49:39.060: D/ExchangeService(635): !!! Email application not found; stopping self
03-11 09:49:39.070: W/ActivityManager(290): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found
03-11 09:49:39.090: E/ActivityThread(635): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d19470 that was originally bound here
03-11 09:49:39.090: E/ActivityThread(635): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d19470 that was originally bound here
03-11 09:49:39.090: E/ActivityThread(635):     at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
03-11 09:49:39.090: E/ActivityThread(635):     at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
03-11 09:49:39.090: E/ActivityThread(635):     at android.app.ContextImpl.bindService(ContextImpl.java:1418)
03-11 09:49:39.090: E/ActivityThread(635):     at android.app.ContextImpl.bindService(ContextImpl.java:1407)
03-11 09:49:39.090: E/ActivityThread(635):     at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
03-11 09:49:39.090: E/ActivityThread(635):     at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
03-11 09:49:39.090: E/ActivityThread(635):     at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
03-11 09:49:39.090: E/ActivityThread(635):     at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
03-11 09:49:39.090: E/ActivityThread(635):     at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
03-11 09:49:39.090: E/ActivityThread(635):     at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
03-11 09:49:39.090: E/ActivityThread(635):     at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
03-11 09:49:39.090: E/ActivityThread(635):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-11 09:49:39.090: E/ActivityThread(635):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-11 09:49:39.090: E/ActivityThread(635):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-11 09:49:39.090: E/ActivityThread(635):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-11 09:49:39.090: E/ActivityThread(635):     at java.lang.Thread.run(Thread.java:856)
03-11 09:49:39.110: E/StrictMode(635): null
03-11 09:49:39.110: E/StrictMode(635): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d19470 that was originally bound here
03-11 09:49:39.110: E/StrictMode(635):     at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
03-11 09:49:39.110: E/StrictMode(635):     at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
03-11 09:49:39.110: E/StrictMode(635):     at android.app.ContextImpl.bindService(ContextImpl.java:1418)
03-11 09:49:39.110: E/StrictMode(635):     at android.app.ContextImpl.bindService(ContextImpl.java:1407)
03-11 09:49:39.110: E/StrictMode(635):     at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
03-11 09:49:39.110: E/StrictMode(635):     at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
03-11 09:49:39.110: E/StrictMode(635):     at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
03-11 09:49:39.110: E/StrictMode(635):     at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
03-11 09:49:39.110: E/StrictMode(635):     at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
03-11 09:49:39.110: E/StrictMode(635):     at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
03-11 09:49:39.110: E/StrictMode(635):     at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
03-11 09:49:39.110: E/StrictMode(635):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-11 09:49:39.110: E/StrictMode(635):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-11 09:49:39.110: E/StrictMode(635):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-11 09:49:39.110: E/StrictMode(635):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-11 09:49:39.110: E/StrictMode(635):     at java.lang.Thread.run(Thread.java:856)
03-11 09:49:39.120: W/ActivityManager(290): Unbind failed: could not find connection for android.os.BinderProxy@40f071b0
03-11 09:49:39.160: E/ActivityThread(635): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d19818 that was originally bound here
03-11 09:49:39.160: E/ActivityThread(635): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d19818 that was originally bound here
03-11 09:49:39.160: E/ActivityThread(635):     at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
03-11 09:49:39.160: E/ActivityThread(635):     at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
03-11 09:49:39.160: E/ActivityThread(635):     at android.app.ContextImpl.bindService(ContextImpl.java:1418)
03-11 09:49:39.160: E/ActivityThread(635):     at android.app.ContextImpl.bindService(ContextImpl.java:1407)
03-11 09:49:39.160: E/ActivityThread(635):     at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
03-11 09:49:39.160: E/ActivityThread(635):     at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
03-11 09:49:39.160: E/ActivityThread(635):     at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
03-11 09:49:39.160: E/ActivityThread(635):     at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
03-11 09:49:39.160: E/ActivityThread(635):     at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
03-11 09:49:39.160: E/ActivityThread(635):     at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
03-11 09:49:39.160: E/ActivityThread(635):     at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
03-11 09:49:39.160: E/ActivityThread(635):     at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
03-11 09:49:39.160: E/ActivityThread(635):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-11 09:49:39.160: E/ActivityThread(635):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-11 09:49:39.160: E/ActivityThread(635):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-11 09:49:39.160: E/ActivityThread(635):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-11 09:49:39.160: E/ActivityThread(635):     at java.lang.Thread.run(Thread.java:856)
03-11 09:49:39.240: E/StrictMode(635): null
03-11 09:49:39.240: E/StrictMode(635): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d19818 that was originally bound here
03-11 09:49:39.240: E/StrictMode(635):     at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
03-11 09:49:39.240: E/StrictMode(635):     at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
03-11 09:49:39.240: E/StrictMode(635):     at android.app.ContextImpl.bindService(ContextImpl.java:1418)
03-11 09:49:39.240: E/StrictMode(635):     at android.app.ContextImpl.bindService(ContextImpl.java:1407)
03-11 09:49:39.240: E/StrictMode(635):     at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
03-11 09:49:39.240: E/StrictMode(635):     at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
03-11 09:49:39.240: E/StrictMode(635):     at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
03-11 09:49:39.240: E/StrictMode(635):     at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
03-11 09:49:39.240: E/StrictMode(635):     at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
03-11 09:49:39.240: E/StrictMode(635):     at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
03-11 09:49:39.240: E/StrictMode(635):     at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
03-11 09:49:39.240: E/StrictMode(635):     at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
03-11 09:49:39.240: E/StrictMode(635):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-11 09:49:39.240: E/StrictMode(635):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-11 09:49:39.240: E/StrictMode(635):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-11 09:49:39.240: E/StrictMode(635):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-11 09:49:39.240: E/StrictMode(635):     at java.lang.Thread.run(Thread.java:856)
03-11 09:49:39.240: W/ActivityManager(290): Unbind failed: could not find connection for android.os.BinderProxy@40fd5ff0
03-11 09:49:39.280: D/dalvikvm(635): GC_CONCURRENT freed 346K, 17% free 2438K/2928K, paused 12ms+13ms, total 120ms
03-11 09:49:39.852: I/Buffering(780): -2147483648
03-11 09:49:40.855: I/Buffering(780): -2147483648
03-11 09:49:41.860: I/Buffering(780): -2147483648
03-11 09:49:41.900: E/ThrottleService(290): problem during onPollAlarm: java.lang.IllegalStateException: problem parsing stats: java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No such file or directory)

 

4 Görüntülenme

1 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

picture-4816-1393230227.jpg
selim.tekinarslan
11.03.2014 - 01:56

Selam Nurettin,

Network işlemlerini asynTask içinde yapmalısın ki ana thread etkilenmesin.

http://blog.melihmucuk.com/tag/android-asynctask-kullanimi/

Bağlantılarını asyntask doingback.  metodunda yapmalısın.

 

kolaylıklar

Nurettin
11.03.2014 - 02:04
Cevabınız için teşekkür ederim, ancak sorunum asyntask ile ilgili degil. Ben server da yayın olup olmadıgını dinlemek, yayın gelene kadar asynctask ı döndürmek, eğer yayın yoksa yayına ulasılamadı gibi bir uyarı verdirmek istiyorum. (Bir radyo projesi üzerinde calısıyorum).
Kemal Selim Tekinarslan
11.03.2014 - 03:33
openconnection dediğin kısımda timeout gelene kadar mı yayını kontrol ediyor şuanda ? Eğer öyle ise asyn task ı do while döngüsü ile çağırıp, bir flag bool yapmalısın, timeout exception aldığın zamanda flag true almazsan false olmalı.