Upload a picture to ubuntu server through an android application - android

I have a problem with my application, and I was wondering if you guys could help.
So, I am making an application that communicates with a server that contains a SQL database. I am going to store a link of the user profile picture in the database. However, I want the pictures to be stored on my server - ubuntu server on raspberry pi 2. I've been looking around, but I cannot find a good tutorial on how to upload a file to the server at a specific location. So basically, I want to take a bitmap file, and then send it to my raspberry pi.
I would really appreciate it if someone could help me out. Thanks!

You can convert your file to a base 64 string and then send it
refer to this solution:
Android - Send Image file to the Server DB

Related

Recover an image from an android to send to server

I am currently working on an android application and I would like to add a file system to send images. But I don't know how to get an image from the local storage of an android, nor how to send it to a server. I am currently using a flask server to retrieve JSON files, and I don't know if retrieving images would be possible with this kind of server.
Would you have any clue how to retrieve a file on a button press and send it to a server please?
You can use this library to pick from local storage and upload it to the server with ease
https://github.com/gotev/android-upload-service
At this point, it doesn't matter what server you use as long as you can retrieve data.
You can do it using Retrofit. For detailed instruction, check This medium post!

How to save mobile number on heroku server

I want when someone signups with his mobile number through my android app (say abc) , the number must be stored or uploaded over the server. I don't know how to do that I have read a little bit about heroku volley etc. But didn't understand that. Is there anyone who wil be helpful for me.
Tell me how to save mobile number over server(heroku ) . I have zero knowledge about this.

connect between android, sql and dynamic web project

Before you shoot at me, i want to say that i searched and found some solutions for my problem, i tried them, but in general no one of them solve my issue.
The problem is that there are a lot of "small" answers for "small" problem, and i think that i have a "huge" problem with understanding.
After this introduction, my problem is:
I build a system that simulate an emergency center.
The center is the dynamic web project, built in java (eclipse), received emergency messages from the application and show the new data on the screen.
What i already have: a dynamic web project, with fabricated data that i created (MySql), and an android application.
What i want to be done is the connect between all parts.
I mean, i don't understand how to create the connection between the android and my web project. All i want is to send from the android a message to the MySql database and to show the new updated database.
What i already tried:
I saved the sql tables in a file (in phpMyAdmin: export->go) and uploaded it to 000webhost.com.
I tried to connect it from the eclipse, not in big success.
I tried this solution:
http://www.trustingeeks.com/connect-android-app-to-mysql-database/
and got stuck in part 4/5-too much errors in eclipse.
I tried this solution:
http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/
and spent half a day with configurate the ports of xampp and wamp (didn't succeed to avoid conflict).
I saw solutions that told me to upload my database to host server, other told me that my local server (xampp) is good enough. Someone told me to upload all my project, not only the sql tables.
I'm very confused...i didn't think that it will be so difficult.
So all this atemps bring me to write this post and to ask from someone to give me an organized solution, that include all i need to solve this.
Thanks in advance!!
Simply put file:
mysql-connector-java-5.1.40-bin.jar
in folder
project/WebContent/WEB-INF/lib
Hope that it helps
I have some Android apps that communicates with a central server which has a mysql database. To communicate to this data base I use two ways:
1) The one you mentioned, using a php script in the server which connects and updates the mysql database.
2) Using a webservice built in java. I publish it using Glassfish. For me after trying a bunch of possibilities, it was the easiest and fastest one to deploy. What you have to do is export your project to a .war file and upload it to your Glassfish server in the admin page, usually from "your.ip:4848". There you can easily configure where you want to publish your webservice (port number). For the communication from the Android app to the webservice I use a java library called "ksoap2".
In all cases I have my data base, the web service and the php script in the same host machine.
After a lot of days and night, trying to do complicated things, i found a very very simple solution, and i add it here for the next person that will encounter this problem.
Create a new account and database in this site: http://www.freemysqlhosting.net/
Now you have a DB on the net. I will call him new DB.
You have there an option of phpMyAdmin interface. All next instructions are refering to the phpMyAdmin interface there.
Receive the link of server, user, password etc' to your mail. save it.
Use 'export' to save your data from the old local DB in phpMyAdmin to a text file.
Copy it to SQL query in the new DB, and it will add all the data, instead of typing yourself a lot of records.
now all your old data is in the new DB, that standing on a hosting server.
In your mail, you have this message:
Hi
Your account number is: xxxxx
Your new database is now ready to use.
To connect to your database use these details
Host: xxx.freemysqlhosting.net
Database name: name
Database user: user
Database password: password
(according to your password and name, of course).
So, to connect in eclipse we will use this details:
private Connection connectToDB() throws ClassNotFoundException,SQLException
{
Connection connection = null;
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection("jdbc:mysql://xxx.freemysqlhosting.net:3306/user","user", "password");
return connection;
}
*my db user and db name are the same, so i don't know if need actually to add here "name" or "user". so if it's not working-try to change one of them to "name".
Done. now you are connected. Try to print some data to check it.
Hope i helped.

Accessing a file on an android device using asp.net webpage in chrome

I have an asp web page which needs to grab an xls file from the device storage area on my android tablet, convert it into bytes and store it in my SQL database.
I can do the converting and storing bit but I have no idea as to how to get the file using VB.
Can anyone tell me how I can get the file without the user having to search for it using an upload control?
I would also like to delete the file after processing..
Thank you..
Derek.
In order to think about this we need to have clear in our minds where the division between client and server exists: You've got a webserver running ASP and a client running a webbrowser on the android platform.
The file you are trying to upload exists on the client. As such any code which does the uploading will have to run on the client and, as the client is running on android, it's unlikely it'll be VB doing the uploading. You're likely to need to use a scripting language like Javascript and, if you care about cross-browser support, be careful how you do it.
The server cannot get the file directly from the client due to common security restrictions.
Once the client side script has got the file, it'd usually send the data to the server using a webservice or other endpoint, deletion of the file can then happen after that.

How do I read in a single line from an external text file (on server) to display in Android activity?

we have a text file stored on our server where I work, and I have searched on how to read in a specific line from that text file and have it display on the screen of my Android activity... but I haven't found a solution yet. Only two words, or so, of the text in the file on the server will be changed/replaced periodically, and I would like those changes to take effect/be updated in my Android app each time. Not sure why I couldn't find an answer to this yet. Any help is much appreciated! Thank you!
Actually the best way to have a secure transaction between an android app and server is to use web service like JSON. You request something from your android app to server, Then in server request will be analyse and response to your android app. You can send some request that tell the server what to do. Then in server side have a script that do your job and send response to your android app.

Categories

Resources