In this post I will show you how to develop Simple Android YouTube App with JSON. In this we use youtube.json file as server side backend. You can stream any YouTube Video inside app just editing youtube.json file without any need to do change Android coding side. JSON code look like below.

Procedure of Android YouTube App:

Create a new Android Studio Project with an empty activity and name the activity as Android YouTube App and click on finish let Project loading finished.

youtube-app-json

youtube-app-json

Next download  YouTubeAndroidPlayerApi.jar file and copy it to libs folder and add below line to dependencies in your gradle file

Android Studio will ask you to Sync Project click on Sync Now, Wait until Android YouTube App project sync is finished.

Add Internet permission to you AndroidManifest.xml file

 

After adding permission AndroidManifest should look like this

 

Now create a new class with name  HttpHandler and below code code to that file. Remove all code except first line

Now add below code to yourube.xml remove existing code competely and add below code. Android YouTube App

Next add below code to YouTube.java replace evrything except first ;ine which has package name. In below code you need to change two things url and YOUTUBE_API_KEY

Fro URL you have to upload youtube.json to you server and replace http://androidmkab.com/config.json with your server url.

YouTube API Key you can get from here Google Developer Console

JSON code looks like below

Only one thing you have to change in this code is value of link that is DMhnJK38RlQ this value is from the url

So you have to change value to your video. For better understanding watch Video above.

 

Now run the application and see the output of Android YouTube App  like below

Android YouTube App

 

You can download source code from here