Design and Develop REST API (RESTful Web services: The basics)

 

What is API

In computer programming, an Application Programming Interface (API) is a set of subroutine definitions, protocols, and tools for building application software. In general terms, it is a set of clearly defined methods of communication between various software components. [Wikipedia]

For www and remote servers, An API isn’t the same as the remote server — rather it is the part of the server that receives requests and sends responses. [By Petr Gazarov – medium.freecodecamp.com]

Example of some popular API are Google maps  API, YouTube API, Facebook API etc.

What is REST API

History of REST:

REST was defined by Roy Fielding in his 2000 PhD dissertation “Architectural Styles and the Design of Network-based Software Architectures” at UC Irvine. Fielding developed the REST architectural style in parallel with HTTP 1.1 of 1996–1999, based on the existing design of HTTP 1.0 of 1996.

In a retrospective look at the development of REST, Roy Fielding said:

Throughout the HTTP standardization process, I was called on to defend the design choices of the Web. That is an extremely difficult thing to do within a process that accepts proposals from anyone on a topic that was rapidly becoming the center of an entire industry. I had comments from well over 500 developers, many of whom were distinguished engineers with decades of experience, and I had to explain everything from the most abstract notions of Web interaction to the finest details of HTTP syntax. That process honed my model down to a core set of principles, properties, and constraints that are now called REST. – [Wikipedia]

Introduction:

If we take one example of popular Android app : Evernote, all the data of the app is stored in a cloud database and communication between app and the database can be done using a REST API. If we uninstall the app anytime, no loss of data as data is stored in a cloud database and if we install the app and login all our data will be visible. So, REST API is a good architectural option to do the communication between the app and the server, if we want to manages all the user data on a central database.

REST (Representational State Transfer) defines a set of architectural principles by which you can design Web services that focus on a system’s resources, including how resource states are addressed and transferred over HTTP by a wide range of clients written in different languages.

Read More

How to convert any website to an android application

 

Now you can create an Android app for your website within minutes. Just we have to follow some steps. To convert any website to an android application what we need is WebView.

WebView (from android developers) : A View that displays web pages. This class is the basis upon which you can roll your own web browser or simply display some online content within your Activity. It uses the WebKit rendering engine to display web pages and includes methods to navigate forward and backward through a history, zoom in and out, perform text searches and more. You can download demo application code from Github (Download Code).

YouTube Tutorial:

Note:  To convert any website into an android app, website has to be responsive.

Read More

How to get current location in Android Google Map (FusedLocationProviderApi)

 

In this tutorial , we will learn how to make a Google Maps App that shows your current location. Best to use the FusedLocationProviderApi now, as it offers less battery drain than the old open source LocationManager API. Also, if you’re already using Google Play Services for Google Maps, there’s no reason not to use it. I have added sample code in Github, you can download the code from here (Download Code).

YouTube Video:

 

NOTEYou have to provide your own API_KEY in google_maps_api.xml, otherwise location will not display in your application.

Creating new Android Project:

1) Open Android Studio and make a new project with name “Current Location”  and company domain app.test.currentlocation.saidur.me.currentlocation;

2) Click Next and choose android version Lollipop. Again Click Next and Choose Google Maps Activity.

3) Leave all things remaining same and Click Finish.

Now you will be able to see three files:

  • google_maps_api.xml (…/GoogleMapsApp/app/src/debug/res/values/google_maps_api.xml)
  • MapsActivity.java (…/GoogleMapsApp/app/src/main/java/com/androidtutorialpoint/googlemapsapp/MapsActivity.java)
  • AndroidManifest.xml ( …/GoogleMapsApp/app/src/main/AndroidManifest.xml)
Read More

Android Native Development Kit (NDK) Hello World Example

 

Android apps are typically written in Java, with its elegant object-oriented design. However, at times, you need to overcome the limitations of Java, such as memory management and performance, by programming directly into Android native interface. The Android NDK is a toolset that lets you implement parts of your app using native-code languages such as C and C++. For certain types of apps, this can help you reuse code libraries written in those languages.

Step1: Download the NDK and Tools

To compile and debug native code for your app, you need the following components:

  • The Android Native Development Kit (NDK): a set of tools that allows you to use C and C++ code with Android.
  • CMake: an external build tool that works alongside Gradle to build your native library. You do not need this component if you only plan to use ndk-build.
  • LLDB: the debugger Android Studio uses to debug native code.
Read More

Why Ignoring Android Studio 2.3 Will Cost You Time and Sales

 

Stable Version of Android Studio 2.3 is Now Available. Android Studio 2.3 is available to download . The focus for this release is quality improvements across the IDE. This version is fast and reliable than the other version.

For more detail about the features added on top of the quality improvements Android Studio 2.3, check out the list of the new features below described by Google.

Read More

Java Tutorial for Beginners [Part-6] – Strings

 

Hello, this is Saidur Rahman. Welcome to the Java Tutorial for Beginners from saidur.me. Today we will learn Strings basics.

Strings, which are widely used in Java programming, are a sequence of characters. In Java programming language, strings are treated as objects.The Java platform provides the String class to create and manipulate strings.

For example:

is same as:

Java String class provides a lot of methods to perform operations on string such as compare(), concat(), equals(), split(), length(), replace(), compareTo(), intern(), substring() etc.

Read More

Java Tutorial for Beginners [Part-5] – Data Types

 

Hello, this is Saidur Rahman. Welcome to the Java Tutorial for Beginners from saidur.me.

Today we will learn Basic Data Types.

Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in the memory. Based on the data type of a variable, the operating system allocates memory and decides what can be stored in the reserved memory.

Data types represent the different values to be stored in the variable. In java, there are two types of data types:

  • Primitive data types
  • Non-primitive data types
Read More

Android Tutorial for Beginners [Part-1] Introduction – Android Platform

 

Hello, this is Saidur Rahman. Welcome to the Android Tutorial for Beginners from saidur.me. Throughout this series of tutorial we will learn details regarding Android development from Basic to Advanced level though the name of the tutorial series is Android tutorial for Beginners. I will try to share my knowledge regarding Android application development, Google play store and Android Studio.

What is Android?
Android is an open source and Linux-based operating system for mobile devices such as smartphones and tablet computers. This tutorial will teach you basic Android programming and will also take you through some advance concepts related to Android application development. Android programming is based on Java programming language so if you have basic understanding on Java programming then it will be a fun to learn Android application development.

Read More

How to Fix – A Lan Connection is Already Configured with IP Address (wifi hotspot) in Windows 10

 

Hello, this is Saidur Rahman. Welcome to the today’s tutorial from saidur.me. Today I will discuss regarding “How to Fix – A Lan Connection is Already Configured with IP Address (wifi hotspot) in Windows 10″.

During set up wifi hotspot and sharing your active internet connection in Windows 10 you may face error ” Cannot enable shared access. Error 765 : internet sharing cannot be enabled. A lan connection is already configured with the ip address that is required for automatic IP addressing.”

Follow below steps to fix the issue:

1) First of all start your hosted network connection by right click on “network” icon on task bar or from Control Panel – Network and Sharing Center – Click your hosted network connection.

Read More

Java Tutorial for Beginners [Part-4] – Variable

 

Hello, this is Saidur Rahman. Welcome to the Java Tutorial for Beginners from saidur.me.

Today we will learn variable. First question is what is a variable? Variable is a combination of “vary + able” that means its value can be changed.

1) Local Variable
A variable which is declared inside the method is called local variable.

Read More