network

Simple connection example part II - TCP communication

SDK Version: 
M3
Last time I wrote about UDP connection. I got some comments about the problem, that UDP packets are not guaranteed to be delivered.
This time I’m going to show you the safer option, the TCP connection.
TCP is probably the most commonly used protocol, simply because it is used for so many applications such as HTTP, POP, SMTP, etc. TCP is a protocol which guarantees that the receiver will receive exactly what the sender sent - there will be no errors, it will be in the correct order, everything will work just fine.

TCP communication time diagram.

  1. try {
  2.         Socket s = new Socket("http://helloandroid.com",80);
  3. } catch (UnknownHostException e) {
  4.         // TODO Auto-generated catch block
  5.         e.printStackTrace();
  6. } catch (IOException e) {

How to download file/image from url to your device

SDK Version: 
M3

We wrote a code for download image from a website to the phone. You can work with images (and files) in your applications, but this article may be useful for java developers too.

Data Storage tutorial, basic samples are included

SDK Version: 
M3

    Data Storage Methods

  • Preferences
  • Preferences is a lightweight mechanism to store and retrieve key-value pairs of primitive data types.
     
  • Files
  • You can store your data in files on your mobile phone, or in a removable storage medium.
     
  • Databases
  • Android Api supports SQLite databases. All databases, SQLite and others, are stored on the device in /data/data/package_name/databases.
     
  • Network
  • You can also use the Internet to store and receive data, whether it's an SQLite database, or just a simple textfile.

PhoneFinder - SMS Phone Locator

SDK Version: 
M5

In this tutorial we will create a GPS Phone Recovery application. The application will allow the user to setup a password that he or she can use to recover a lost or stolen phone. Once the user has setup the password, if they lose their phone they'll be able to send a text message to their phone from another cell phone and if the text message is formatted "SMSLOCATE:[password]" with the correct password then the phone will respond with all of the data about the phone's current location from the GPS. This includes latitude, longitude, altitude, heading, speed, and more.

NewsDroid RSS Reader

SDK Version: 
M3

In Hello Android's first tutorial we will walk through creating a simple RSS reader. This tutorial will show you how to parse XML files and use the SQLiteDatabase for storage.

Syndicate content