Can anyone show a simple example of loading data in an android app from a DataAbstract schema?
I checked the examples that DataAbstract has but they all throw a lot of compiling errors(certain classes missing).
I just want to see a simple example where i create my components, fill a datatable and show it in a list
BinMessage lMessage = new BinMessage();
HttpClientChannel lChannel = new HttpClientChannel();
try {
lChannel.setTargetUrl(new URI("http://localhost:8099/bin"));
} catch (URISyntaxException e1) {
e1.printStackTrace();
return;
}
Bin2DataStreamer lDataStreamer = new Bin2DataStreamer();
RemoteDataAdapter lDataAdapter = new RemoteDataAdapter();
lDataAdapter.setDataStreamer(lDataStreamer);
lDataAdapter.setMessage(lMessage);
lDataAdapter.setClientChannel(lChannel);
lDataAdapter.setDataServiceName("DataService");
TableRequestInfoV5 lRequestInfo = new TableRequestInfoV5();
lRequestInfo.setMaxRecords(-1); // no limits - return all records
lRequestInfo.setIncludeSchema(true); // update schema in the result data
// table to match recieved data
// (not necessarily).
DataTable lTable = new DataTable("Clients");
lDataAdapter.fill(lTable, lRequestInfo);
System.out.println(String.format(
"Data has been retrieved. Table: %s; columns count: %d", lTable.getTableName(), lTable.getColumns().getCount()));
I stopped all antivirus/firewalls that might’ve blocked the connection and the result is the same.
As i mentioned in my early post i also have a javascript app that connects to the same server and uses the same service.
This is the outout that i get:
03-21 16:56:11.827 4892-4892/com.example.attosoft.da W/System: ClassLoader referenced unknown path: /data/app/com.example.attosoft.da-1/lib/x86
03-21 16:56:11.861 4892-4892/com.example.attosoft.da I/System.out: START LOAD DATA
03-21 16:56:11.910 4892-4892/com.example.attosoft.da W/System.err: java.net.SocketException: socket failed: EACCES (Permission denied)
03-21 16:56:11.910 4892-4892/com.example.attosoft.da W/System.err: at libcore.io.IoBridge.socket(IoBridge.java:619)
03-21 16:56:11.910 4892-4892/com.example.attosoft.da W/System.err: at java.net.PlainSocketImpl.create(PlainSocketImpl.java:198)
03-21 16:56:11.910 4892-4892/com.example.attosoft.da W/System.err: at java.net.Socket.checkOpenAndCreate(Socket.java:689)
03-21 16:56:11.911 4892-4892/com.example.attosoft.da W/System.err: at java.net.Socket.setSoTimeout(Socket.java:543)
03-21 16:56:11.911 4892-4892/com.example.attosoft.da W/System.err: at com.android.okhttp.internal.http.SocketConnector.connectRawSocket(SocketConnector.java:159)
03-21 16:56:11.911 4892-4892/com.example.attosoft.da W/System.err: at com.android.okhttp.internal.http.SocketConnector.connectCleartext(SocketConnector.java:67)
03-21 16:56:11.911 4892-4892/com.example.attosoft.da W/System.err: at com.android.okhttp.Connection.connect(Connection.java:152)
03-21 16:56:11.911 4892-4892/com.example.attosoft.da W/System.err: at com.android.okhttp.Connection.connectAndSetOwner(Connection.java:185)
03-21 16:56:11.911 4892-4892/com.example.attosoft.da W/System.err: at com.android.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:128)
03-21 16:56:11.911 4892-4892/com.example.attosoft.da W/System.err: at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:341)
03-21 16:56:11.911 4892-4892/com.example.attosoft.da W/System.err: at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330)
03-21 16:56:11.911 4892-4892/com.example.attosoft.da W/System.err: at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248)
03-21 16:56:11.911 4892-4892/com.example.attosoft.da W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:433)
03-21 16:56:11.911 4892-4892/com.example.attosoft.da W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:114)
03-21 16:56:11.911 4892-4892/com.example.attosoft.da W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:245)
03-21 16:56:11.911 4892-4892/com.example.attosoft.da W/System.err: at com.remobjects.sdk.HttpClientChannel.intDispatch()
03-21 16:56:11.911 4892-4892/com.example.attosoft.da W/System.err: at com.remobjects.sdk.ClientChannel.dispatch()
03-21 16:56:11.915 4892-4892/com.example.attosoft.da W/System.err: at com.remobjects.dataabstract.intf.DataAbstractService_Proxy.GetData()
03-21 16:56:11.916 4892-4892/com.example.attosoft.da W/System.err: at com.remobjects.dataabstract.RemoteDataAdapter.internalCallGetData()
03-21 16:56:11.916 4892-4892/com.example.attosoft.da W/System.err: at com.remobjects.dataabstract.RemoteDataAdapter.internalFill()
03-21 16:56:11.916 4892-4892/com.example.attosoft.da W/System.err: at com.remobjects.dataabstract.RemoteDataAdapter.fill()
03-21 16:56:11.916 4892-4892/com.example.attosoft.da W/System.err: at com.example.attosoft.da.DataModule.(DataModule.java:56)
03-21 16:56:11.916 4892-4892/com.example.attosoft.da W/System.err: at com.example.attosoft.da.MainActivity.onCreate(MainActivity.java:28)
03-21 16:56:11.916 4892-4892/com.example.attosoft.da W/System.err: at android.app.Activity.performCreate(Activity.java:6237)
03-21 16:56:11.916 4892-4892/com.example.attosoft.da W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
03-21 16:56:11.916 4892-4892/com.example.attosoft.da W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
03-21 16:56:11.916 4892-4892/com.example.attosoft.da W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
03-21 16:56:11.916 4892-4892/com.example.attosoft.da W/System.err: at android.app.ActivityThread.-wrap11(ActivityThread.java)
03-21 16:56:11.916 4892-4892/com.example.attosoft.da W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
03-21 16:56:11.917 4892-4892/com.example.attosoft.da W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
03-21 16:56:11.917 4892-4892/com.example.attosoft.da W/System.err: at android.os.Looper.loop(Looper.java:148)
03-21 16:56:11.917 4892-4892/com.example.attosoft.da W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5417)
03-21 16:56:11.917 4892-4892/com.example.attosoft.da W/System.err: at java.lang.reflect.Method.invoke(Native Method)
03-21 16:56:11.917 4892-4892/com.example.attosoft.da W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
03-21 16:56:11.917 4892-4892/com.example.attosoft.da W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
03-21 16:56:11.917 4892-4892/com.example.attosoft.da W/System.err: Caused by: android.system.ErrnoException: socket failed: EACCES (Permission denied)
03-21 16:56:11.918 4892-4892/com.example.attosoft.da W/System.err: at libcore.io.Posix.socket(Native Method)
03-21 16:56:11.918 4892-4892/com.example.attosoft.da W/System.err: at libcore.io.BlockGuardOs.socket(BlockGuardOs.java:282)
03-21 16:56:11.918 4892-4892/com.example.attosoft.da W/System.err: at libcore.io.IoBridge.socket(IoBridge.java:604)
03-21 16:56:11.918 4892-4892/com.example.attosoft.da W/System.err: … 34 more
03-21 16:56:11.921 4892-4906/com.example.attosoft.da D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
03-21 16:56:12.037 4892-4906/com.example.attosoft.da I/OpenGLRenderer: Initialized EGL, version 1.4
03-21 16:56:12.086 4892-4906/com.example.attosoft.da W/EGL_emulation: eglSurfaceAttrib not implemented
03-21 16:56:12.086 4892-4906/com.example.attosoft.da W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xad761fc0, error=EGL_SUCCESS
Sorry i bottered you with this.
It was a mistake i made. I generated so many apps to test this that i forgot to add permissions in my last app.
The error was generated because my app didn’t have permission to use internet