2

my Android app created in Xamarin has problem with internet connection, below is error code.

Time Device Name Type PID Tag Message 10-09 05:04:52.256 Genymotion Samsung Galaxy S7 - 6.0.0 - API 23 - 1440x2560 Error 1453 AndroidRuntime android.runtime.JavaProxyThrowable: System.Net.WebException: Error: ConnectFailure (Network is unreachable) ---> System.Net.Sockets.SocketException: Network is unreachable at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x000b6] in <6c708cf596db438ebfc6b7e012659eee>:0 at System.Net.WebConnection.Connect (System.Net.HttpWebRequest request) [0x0016d] in <6c708cf596db438ebfc6b7e012659eee>:0 --- End of inner exception stack trace --- at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x000a7] in <3f9824dbe67544e1805773e0a3dbdf6b>:0 at GWAWE.localhost.Service1.Get_Data () [0x00001] in <1baad81b40d64c6886bf076df034661f>:0 at (wrapper remoting-invoke-with-check) GWAWE.localhost.Service1:Get_Data () at gwawe.MainActivity.BuildLayout () [0x00031] in <1baad81b40d64c6886bf076df034661f>:0 at gwawe.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x0004e] in <1baad81b40d64c6886bf076df034661f>:0 at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x0000f] in <9663139ab15947a89e15a6bcd9621f68>:0 at (wrapper dynamic-method) System.Object:e6ea694d-cf84-4098-a161-481a5ad1d4ae (intptr,intptr,intptr) at md5a9dcb246785c0066d52ff25b77e1a72d.MainActivity.n_onCreate(Native Method) at md5a9dcb246785c0066d52ff25b77e1a72d.MainActivity.onCreate(MainActivity.java:29) at android.app.Activity.performCreate(Activity.java:6237) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Force finishing activity GWAWE.gwawe/md5a9dcb246785c0066d52ff25b77e1a72d.MainActivity

I'm using Visual Studio 2017 with Xamarin and Genymotion. Visual Studio, Xamarin and Genymotion are up to date. App is created only for Android 6.0. In android manifest I added android.permission.RECEIVE_BOOT_COMPLETED. I'm using "Wi-Fi" on emulator.

Application have to autostart after device boot up and error show only when I reboot emulator. If I run application manually everything works fine. The application connects to IIS web service.

Does anybody have a clue what is going on here?

Brath
  • 53
  • 1
  • 5

1 Answers1

0

Well from what i understand either the internet permission isn't granted in your Android application or you do not have an internet connection, in case you don't have the permission all you have to do is add this line in your manifest.

  <uses-permission android:name="android.permission.INTERNET" />
FreakyAli
  • 13,349
  • 3
  • 23
  • 63
  • Before I created this topic I checked another topics and tutorials so I have this sentence in my android manifest file. Also strange is that sometimes this problem occure and sometimes everything is just fine. I add System.Net.HTML to references so problem don't occured in a few last tests. – Brath Oct 09 '17 at 16:19