• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Day 4: data storage

justme2013

Newbie
Feb 4, 2013
16
0
Hi,

Today is my 4th day of learning adroid app dev, so, probably I'm very ignorant of what I'm going to discuss.
Reading android dev guide, App Components | Android Developers

But I'm puzzled by the Data Storage part, that is, I did not find any where it mentioned that an android app would be able to write and retrieve data from a centralized db server vs jdbc or whatever, if this is true, how would an android app for an enterprise work in terms of corporate data?

Please shed some light here.

Thanks.
 
You would write and host a number of web services on a remote server, then use any of the remote connecton interfaces available to Android/Java to connect to the service. On completion, the service should send a response back to the client containing any data you requested, along with a status code.
 
Upvote 0
You won't find any information in the 'connection section' of how to implement your web service. Only thing that you'll be told is to use the java.net.*, android.net.* packages...

It's totally up to you of how to design your web service (if you implement a new one) or up to the enterprise service you'd like to interact with. You or the enterprise could use JSON, some REST Api, SOAP, etc...
 
Upvote 0
ok, let's say, this enterprise has a web service to allow other system to consume its service, and say, it's 111.222.333.444/webservice?wsl&action=dataRetrieval&dtTBL=contacts

Which would retrieve all the contact info of the given data source.
Now, how would we code from the android end to consume such service? Where can I dig some sample code?

Thanks.
 
Upvote 0
You won't find much sample code because it's entirely dependent on how hte web service is setup. does it return JSON? plain text? what? First, look into connectin a remote hose and receiving a response. after you have that working, look into parsing the response, depending on how it is formatted.
 
Upvote 0
All right. I've done some research, using kSOAP2 to consume web service is a way to go with android. And i've downloaded two libraries, namely, ksoap2-android-assembly-3.0.0-RC.4-jar-with-dependencies.jar and added it to java path for the project, still got
import org.ksoap2.transport.AndroidHttpTransport UNRESOLVED error
then, downloaded the full library, ksoap2-j2se-full-2.1.2.jar
and added it to the project java path, still same error.

How come while importing other ksoap2 classes such as org.ksoap2.SoapEnvelope has no prob? Or am I doing something wrong?

Thanks.
 
Upvote 0
Did you put those jars in the libs folder of you project, e.g.: "myProjectName\libs" ?

Previously no, I just used ADT's function to add external library to the project, but just now I did, F5 did not seem to refresh or fix the prob, so, I close ADT and re-open it, still same error. Could it have something to do with my following code?

private final String NAMESPACE = "http://127.0.0.1:8600/myApp/";
private final String URL = "http://127.0.0.1:8600/myApp/getStuff.cfc?wsdl&method=getOnePart&pn=123456";
private final String SOAP_ACTION = "http://127.0.0.1:8600/myApp/getStuff.cfc?wsdl";
private final String METHOD_NAME = "getOnePart";

Btw, is NAMESPACE sort of like BASEURL? Not exactly sure it works with ksoap2. Also, the URL has been tested to return a simple value.

Thanks.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones