Skip to content

CRUD operations on MySQL database from Android app using RESTful api.

Notifications You must be signed in to change notification settings

pfieffer/ConnDB

Repository files navigation

Connecting android to MySQL database

Uses Volley Library

Note: The app is merely simple, I wrote the php scripts (with the help of a friend) and the app just to learn the basics of RESTful api services and consuming the api on Android.

Future enhancements:

  • View details of a product on clicking a particular item in all products listview.
  • 
    

To test:

Do not follow striked steps as they were to setup database on local server. The database and php scripts have been moved to the remote server. So you only need to get the app running to test this

  • Clone the repo: git clone https://github.com/pfieffer/ConnDB.git or git clone [email protected]:pfieffer/ConnDB.git OR Download the zip.
  • Open the app project on Android Studio and run the app on phone.

The build.gradle file Module:app of the project is:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "np.com.ravi.dbconn"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile files('libs/volley.jar')
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

The sceenshot of JSON fetched from database is as follows:
JSON response


All Products Add a product Update a product Delete a Product
All Products Add product Update product Delete product

About

CRUD operations on MySQL database from Android app using RESTful api.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published