简体   繁体   中英

Android Server Best Practices

I have a very general question because it's about something I know very little about. I'm aware it's better to ask a specific question, but when you know next to nothing, that's not possible.

I'm working on an Android phone app. The app will require some data to come from a server that I'll be creating. I'm still working out how much data and what kind. It may be very small amounts of text (<1KB) or at most 10KB and a couple of low res photos. The data on the server will need to be updated daily so the Android client app can see daily updates.

I have no experience with servers so I'm at a loss as to where to start researching for best practices. I've read things, but it doesn't seem to be getting me closer as to what direction to take.

I'm looking for something easy and simple to implement. Can someone suggest a technique, technology, tool, protocol, ... that might be good to use. I'm an expert C++ programmer and I've been learning Java for Android, if those skills help in making a suggestion.

Feel free to ask questions that may influence what choice would be best.

Thanks for being understanding about the generality of this question.

Please, no snark. Thanks.

I'm not sure if it helps but I've been using this to call for html files on my server (on android),

public String RequestURL(String url_location){
    try {
        URL url = new URL(url_location);
        URI uri;
        try {
            uri = new URI(url.getProtocol(),url.getHost(),url.getPath(),url.getQuery(),null);
            url_location = uri.toString();
            try{
                DefaultHttpClient httpClient = new DefaultHttpClient();
                HttpGet httpGet = new HttpGet(url_location);
                ResponseHandler<String> resHandler = new BasicResponseHandler();
                String data = httpClient.execute(httpGet,resHandler);
                return data;
            }catch(ClientProtocolException e){
                return "";
            }catch(IOException e){
                return "";
            }
        } catch (URISyntaxException e) {
            return "";
        }
    } catch (MalformedURLException e1) {
        return "";
    }
}

I've also recently begun to use the google appspot engine for my web hosting, it let's you program server-side java.

I think you want to build a http backend..

you can implement a restful one very easily and quick with something like restfulie Its java and will help you with client(android) and server side.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM