android - Why is Azure SQL query hanging my app? -
i'm writing first app makes use of azure mobile services platform. have sql server configured , table showing on azure management portal. have manually added entries table ensure nothing wrong on server-side.
my problems lie in fact app hangs when perform query on table. here's code:
public mumanager(context con){ context = con; try { log.i("counter", "before mclient"); mclient = new mobileserviceclient("https://blah.com","apikey",context); log.i("counter", "after mclient"); mutable = mclient.gettable("table1",muitem.class); } catch (malformedurlexception e) { log.i("counter", "malformedurl"); e.printstacktrace(); } log.i("counter", "end of constructor"); }
now, i'm not having issues above code, have no way of confirming client connecting azure mobile service.
below code causes issue.
public arraylist<mu> getmulist() throws executionexception, interruptedexception { log.i("counter", "start sql"); mobileservicelist<muitem> resultlist = mutable.where().field("fieldname").eq("fieldvalue").execute().get(); log.i("counter", "sql success!"); arraylist<mu> mulist = new arraylist<>(); log.i("counter", "mu initialization successful!"); for(muitem m:resultlist){ log.i("counter", m.name); mulist.add(getmufromitem(m)); } return mulist; }
the above code freezes when arrive @ line:
mobileservicelist<muitem> resultlist = mutable.where().field("fieldname").eq("fieldvalue").execute().get();
i receive no errors, never see sql success! statement appear in logs , app freezes if there io block or something.
i have necessary gradle dependencies think, here are:
compile 'com.android.support:appcompat-v7:21.0.3' compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.2-beta' compile 'com.google.android.gms:play-services:6.5.87' compile 'com.android.support:support-v4:21.0.3' compile 'com.google.code.gson:gson:2.2.2' compile 'com.google.guava:guava:18.0'
very confused, in advance!
edit: i've had play , found get() function causing code hang. don't know why, when command issued on insert order, seems cause hang. i'm reading why get() causes hang i'm struggling find of value
edit 2: connected phone, physical android device see if same error occur on physical has been in emulator. more verbose output, instead of app hanging receive following:
getaddrinfo+,hn 30(0x736565722d696e),sn(),family 0,flags 4 getaddrinfo-,err=8 getaddrinfo+,hn 30(0x736565722d696e),sn(),family 0,flags 1024 getaddrinfo-, 1 getaddrinfo_proxy+ getaddrinfo_proxy-,temp_failure_retry
it proceeds hang after that. ideas means?
i found solution problem, embarrassing actually! problem permissions clause asking internet access inside of clause!
Comments
Post a Comment