Tutorial: Mobile App Local Deployment

Tutorial: Mobile App Local Deployment

Disclaimer: This tutorial is for simplified demonstration/educational purposes and not intended for production applications. We cannot be held responsible for any misuse, errors, or damages. Use at your own risk.

In this tutorial, we’ll discuss how to load a simple http2demo android application in developer mode. We will use an android phone, but analogous method exist for IOS devices. Internally, the demo performs network system calls that send an HTTP GET request to a server and prints the response on the demo’s screen. This is just a really simple example for pedagogical purposes, and we can build a much more complex product tailored to your needs. 

1. Turn on Developer Mode on your phone.  

    • To do this, go to Settings.
    • Click About Phone several times until the developer activation confirmation message pops up (if developer Options is not yet activated)
    • You should see a tab called Developer Options in Settings. Go into that tab and turn ON Developer Options.

2. Next, connect the phone to your computer via USB. Be careful to select a USB cable capable of charging AND data transfer; cheaper cables may support only charging. Select PTP on the phone (Picture Transfer Protocol).

3. Drag the mobile app APK file onto the phone. 

4. Find the application installer on the phone. You can do that by looking for Files->Installers. You’ll get some warning messages about a non-signed application when installing; but that’s alright for testing.

5. Next, run the application! In this case, the application name is http2demo.

6. Below, you’ll see some screens of this sample application, which is available as a free demo upon request here, with descriptions below. Of course, you can do this process automatically by building and deploying directly with Android Studio (but that requires getting your Gradle files in proper shape). Steps 1-2 are still necessary in this alternate option.



HTTP Demo Start Screen

Click on the screen to get hidden menu. Click on HTTP Get to connect to a sample server.

Received response from Server

Extra Learnings! – Gradle Files

Gradle files are used to build your Android code. Unfortunately, many demos online have non-working Gradle file configurations. For example, the “Compile” keyword is now deprecated and replaced with “implementation.” Below is a Gradle file we made. Important takeaways are to look at the SDK versions (targetSDKVersion, compileSDkVersion, and minSdkVersion). Android Studio will yell at you if your versions are not correct; however, there are many correct combinations. As a tip, try to keep compileSdkVersion and targetSdkVersion identical to avoid compile errors.

//Tested with Android 7.1.1
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.httpdemo2"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation project(':httpcomm') //httpcomm is a module we developed

Leave a Reply

%d bloggers like this: