File tree Expand file tree Collapse file tree 4 files changed +29
-2
lines changed
src/main/java/com/amitshekhar Expand file tree Collapse file tree 4 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,18 @@ Now open the provided link in your browser.
3333
3434Important : Your Android phone and laptop should be connected to the same Network (Wifi or LAN).
3535
36+ Note : If you want use different port other than 8080.
37+ In the app build.gradle file under buildTypes do the following change
38+
39+ ``` groovy
40+ debug {
41+ resValue("string", "PORT_NUMBER", "8081")
42+ }
43+ ```
44+
45+
46+
47+
3648You will see something like this :
3749
3850<img src=https://raw.githubusercontent.com/amitshekhariitbhu/Android-Debug-Database/master/assets/debugdb.png >
Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ android {
3131 testInstrumentationRunner " android.support.test.runner.AndroidJUnitRunner"
3232 }
3333 buildTypes {
34+ debug {
35+ resValue(" string" , " PORT_NUMBER" , " 8081" )
36+ }
3437 release {
3538 minifyEnabled false
3639 proguardFiles getDefaultProguardFile(' proguard-android.txt' ), ' proguard-rules.pro'
Original file line number Diff line number Diff line change @@ -31,7 +31,9 @@ android {
3131
3232 testInstrumentationRunner " android.support.test.runner.AndroidJUnitRunner"
3333
34+ resValue(" string" , " PORT_NUMBER" , " 8080" )
3435 }
36+
3537 buildTypes {
3638 release {
3739 minifyEnabled false
Original file line number Diff line number Diff line change @@ -41,9 +41,19 @@ private DebugDB() {
4141 }
4242
4343 public static void initialize (Context context ) {
44- clientServer = new ClientServer (context , DEFAULT_PORT );
44+ int portNumber ;
45+
46+ try {
47+ portNumber = Integer .valueOf (context .getString (R .string .PORT_NUMBER ));
48+ } catch (NumberFormatException ex ) {
49+ Log .e (TAG , "PORT_NUMBER should be integer" , ex );
50+ portNumber = DEFAULT_PORT ;
51+ Log .i (TAG , "Using Default port : " + DEFAULT_PORT );
52+ }
53+
54+ clientServer = new ClientServer (context , portNumber );
4555 clientServer .start ();
46- addressLog = NetworkUtils .getAddressLog (context , DEFAULT_PORT );
56+ addressLog = NetworkUtils .getAddressLog (context , portNumber );
4757 Log .d (TAG , addressLog );
4858 }
4959
You can’t perform that action at this time.
0 commit comments