I'm developing my first android application, I'm trying to send video files I've recorded and saved in the applications External Cache Directory as well as other data like usernames, etc. I have a play application running on my server and have a mySQL DB running on my server.
I have experience with JDBC and oracle, but am unsure of how I should make the connection between the android app and the play app, I'm thinking I don't want the android app talking to the mySQL DB ever! that I'll send a JSON object from my android application to my play application, the play application will then take the JSON object parse it and update the DB with the user details and a pointer to the video file and also add the video file to the designated folder.
I'm unsure how to implement the connection on the the android app, do I create a new activity or maybe a fragment for the connection to the play app? a link to a simple tutorial taking a video file and sending it as a JSON object to a play application would really get me going.
I realize that might be a bit much to ask.
I was reading this post MultiPartEntity and thought it might be along the lines of how I would make the connection from the android app to the play app, but was unsure if it was using JSON(the comments suggest it does, but I can't see any JSON object creation)
is MultiPartEntity a good solution for my connection needs?
How do I deal with the JSON object when I receive it on the server end?
I'm thinking I'll have a route set up to deal with, but again a link to a similar example would be great.
Any help pointing me in the right direction is appreciated.
Your Play! application must have an endpoint to send data with post method (RestFul Web Service), Play! is Restful, just handle the uploaded file in your Action. In your Android Application, you can send data with Volley Library follow this link to do that How to multipart data using Android Volley
or your follow this tutorial with php web service but with what you want http://www.androidhive.info/2014/12/android-uploading-camera-image-video-to-server-with-progress-bar/
Related
I am new to android, and i m working on an app dat needs some server side code.For that i m thinking to use J2ee, now tell me(the concept n requirement only) so that i can send the data like log in form details to server from sqlite of android, and after some processing i want to send notifications to client devices.( i know for that i have to use google C2Dm).
But the actual problem is how do i test these things on my pc,before publishing the app.
also tell me the tools dat i need to install beside android sdk , and the language that i need to learn that can synchronize or simply send android data to server.
I have seen that when we register in websites they send us message for conformation. which technology is used here.
and last after my app is ready how to publish it, the whole process(including where i will be putting my server database and server code).
Hi I would like to suggest you to implementing a REST based web service in Java EE server. You can use JSONObject to consume this restful service.
An example for using the JSONObject with REST is given in the link:
https://blogs.oracle.com/enterprisetechtips/entry/implementing_restful_web_services_in
http://javapostsforlearning.blogspot.in/2013/04/restful-web-service-tutorial.html
and to call Web Services from Android
http://java.dzone.com/articles/invoke-webservices-android
http://www.codeproject.com/Articles/112381/Step-by-Step-Method-to-Access-Webservice-from-Andr
beside this lot of stuff you can find out through google!!
for needed tools visit
http://developer.android.com/tools/index.html
http://developer.android.com/tools/help/index.html
I have an Android app that is currently in the Google Play store. On my server, I generate Zip files containing JSON information. The server takes parameters from the Android app and generates an appropriate Zip file which the Android app downloads, unzips and processes.
I currently user he AndroidHttpClient method, but I suspect the HTTPUrlConnection would have been a better choice.
What would the approach be for using HTTPUrlConnection?
Will it handle situations where the Android app may make a call on a public Wifi which could cause a redirect? Is there any sample code that I could reference for doing this?
Thanks
JOhn
terramia.net/painter/HTTPClient/doc/urlcon_vs_httpclient.html to the pros and cons of httpclient and httpurlconection.
yes HTTPUrlConnection can be a better chocice.
why are you ziping at server and than downloading and than processing, please write some apis that sorer can respond on yours request and can send json data straight. it will save time complexity and space-complexity to some extent. just treat as my suggestion.
I have some questions about developing a Android application which shall be able to communicate with a NodeJS server.
The Android application gathers some data and saves everything in a .csv file.
This file now needs to be uploaded to a NodeJS server. The NodeJS server should save the file as well as storing the content in a MongoDB.
My question now is how I should implement the communication between the Android device and the server.
I know how to upload a single file to a NodeJS server using a HttpURLConnection with a DataOutputStream.
But I need more than just uploading the file because I need a unique identification of each Android device.
I thought about using the (encrypted) Google account E-Mail address of the user to distinguish the devices. I am not interested in knowing who uploads which data but I need to store the data for each device separately.
The problem is that I don't know how to communicate between the device and the server.
If I upload a file via HttpURLConnection and DataOutptStream it seems that I can only upload the file without any additional information like the unique key for the device.
I also thought about uploading the file via sockets. But I am not sure how to handle huge file sizes (5 MB or more).
I am not looking for code fragments. I rather need some hints to the right direction. Hopefully my problem was stated clearly and someone can help me with this.
Using a HttpUrlConnection on the Android side, and a RESTful server on the Node side would be a straightforward option.
You can embed information into the URL in a RESTful way:
pathParam: www.address.com/api/save/{clientId}/data
queryParam: www.address.com/api/save/data?c={clientID}
each uniquely identifying the client. This can be whatever scheme you choose. You will have to build the HttpUrlConnection each time as the URI is unique, and important!
The server side can then route the URL however you see fit. Node has a number of packages to aid in that (Express, Restify, etc.). Basically you'll grab the body of the request to store into your DB, but the other parameters are available too so it's all a unique and separated transaction.
Edit: The package you use for RESTful handling can stream large files for you as well. Processing of the request can really begin once the data is fully uploaded to the server.
Using a socket would be nearly just as easy. The most difficult part will be 'making your own protocol' which in reality could be very simple.
Upload 1 file at at time by sending data to the socket like this:
54::{filename:'myfilename.txt',length:13023,hash:'ss23vd'}xxxxxxxxxxx...
54= length of the JSON txt
:: = the delimiter between the length and the JSON
{JSON} = additional data you need
xxx... = 13023 bytes of data
Then once all the data is sent you can disconnect... OR if you need to send another file, you know where the next set of data should be.
And since node.js is javascript you already have wonderful JSON support to parse the JSON for you.
Would I suggest using a socket? Probably not. Because if you ever have to upload additional files at the same time, HTTP and node.js HTTP modules might do a better job. But if you can guarantee nothing will ever change, then sure, why not... But that's a bad attitude to have towards development.
Can someone please clarify this for me. I am reading the developer page about the blobstore at https://developers.google.com/appengine/docs/java/blobstore/overview. I can't seem to wrap my head around the process of saving and retrieving blobs? It sounds like
android app would directly send an image to the blobstore
after saving the image, the blobstore would then return a blobkey to my backend for me to put in the datastore
Is that the process? Maybe it's because I have had a long day, but I just can't see it. If someone has an example they don't mind sharing, please post it. I just need to save images from android in the blobstore and then be able to retrieve them with blobkey or otherwise.
I have already look at
Upload to Appengine Blobstore in Android
Using Google BlobStore with an Android application
Android Interaction with Google App Engine Blobstore Service
What is the syntax to get a Blobstore upload url from Android?
For the life of me, I don't know why they are not doing it for me.
I suppose some questions are:
How does android know where to send the blob to? I mean, does Google distinguish between my instances of the blobstore versus other people's instances, similar to how it distinguishes my instances of the datastore? In other words could I go to app engine Applications Overview and see all the blobs that belong to my app the way I could in the datastore? I suppose a complete, working piece of code could help me see these answers.
Part of my problem could be that I have never used servlet. I am presently using Google Cloud Endpoint for my api.
Actually there are two ways to upload to blobstore:
Using direct upload handler:
Server gets a unique one-time secret upload url via createUploadUrl(..) and sends this url to client.
Client uses multipart/form-data POST to upload data to this url.
The upside is that you can upload large files (>32mb).
Using blobstore FileService API which is deprecated and should not be used any more:
You create you own POST upload handler where client uploads data.
You use FileService API so save data to blobstore.
The downside is that you can upload max 32mb of data (generic GAE request limit).
The upside is that you have access to data so you can edit contents if needed.
Your description of the process is correct. The only step you miss is the first: the server side calls blobstoreService.createUploadUrl(redirecturl) to generate the URL to upload to. Then the handler at redirecturl will save the blob key to the datastore.
I just want to make a TV guide for Android and later some other Mobile Platform. I want to use an RSS updates to update my application. In this specific scenario I want to use http://tvprofil.net/ 's RSS resource. I thought that I could just call site's RSS XML from my Android app, parse it, show, and thats the end of the story.
But, my cousine told me that the best way to do things is through Asp.net Web Api Service. Something to deal with REST. So, If I have to change resource, to like some iptv provider's RSS I would just change the Service and not have to deal anything with my mobile application. Other advantage, he said, is if I want to build Windows Phone application or iOS aplication that works the same way, I would have that same service to do job for me and just create UI and basic things for those apps.
The problem is that I have no idea how Asp.net web Api is used.
Can anyone give me some usefull link, or even better, write an example of this thig. I just want the RSS from http://tvprofil.net/ to go through Asp.Net Web Api Service and that I can call service and get it as XML or ... even Json... or to get anything at all to my app.
The whole thing is pretty confusing to me
If a RSS feed has enough data for your application to function then you do not need ASP.NET Web Api. The only role ASP.NET Web Api could play in this scenario is if it acted as an intermediate. E.g. your client application contacts your server application (ASP.NET Web Api) which in turn pulls the data from the actual external data source (tvprofil.net RSS).
For completeness sake, a list of pro's and con's:
Advantages of using an intermediate server
Reliability. You can cache the data of the external data source and serve that data even while the external data source is offline. Also, by caching the data you can lighten the load on the external data source to a bare minimum.
Transformability. Your intermediate server can translate the data of an external data source to another format that is more suitable for your client application. This is useful when you have many external data sources that each serve data in another format. Your intermediate server acts as a layer of abstraction for your client application.
Disadvantages of using an intermediate server
More effort. It will take more effort to develop and host an intermediate server.
Reliability. You must ensure your intermediate server is online and connected to the internet 24/7