Skip to content

Commit f823783

Browse files
Add addressLog and update readme
1 parent 3804876 commit f823783

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ That’s all, just start the application, you will be able to see logs in the lo
2828

2929
* D/DebugDB: Open http://XXX.XXX.X.XXX:8080 in your browser
3030

31+
* You can always get the address log from your code by calling the method `DebugDB.getAddressLog();` ;
32+
3133
Now open the provided link in your browser.
3234

3335
Important : Your Android phone and laptop should be connected to the same Wifi.

debug-db/debug-db-upload.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def siteUrl = 'https://github.com/amitshekhariitbhu/Android-Debug-Database'
2424
def gitUrl = 'https://github.com/amitshekhariitbhu/Android-Debug-Database.git'
2525

2626
group = "com.amitshekhar.android"
27-
version = '0.1.0'
27+
version = '0.2.0'
2828

2929
install {
3030
repositories.mavenInstaller {

debug-db/src/main/java/com/amitshekhar/DebugDB.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class DebugDB {
3434
private static final String TAG = DebugDB.class.getSimpleName();
3535
private static final int DEFAULT_PORT = 8080;
3636
private static ClientServer clientServer;
37+
private static String addressLog = "not available";
3738

3839
private DebugDB() {
3940
// This class in not publicly instantiable
@@ -42,7 +43,13 @@ private DebugDB() {
4243
public static void initialize(Context context) {
4344
clientServer = new ClientServer(context, DEFAULT_PORT);
4445
clientServer.start();
45-
Log.d(TAG, NetworkUtils.getIpAccess(context, DEFAULT_PORT));
46+
addressLog = NetworkUtils.getAddressLog(context, DEFAULT_PORT);
47+
Log.d(TAG, addressLog);
48+
}
49+
50+
public static String getAddressLog() {
51+
Log.d(TAG, addressLog);
52+
return addressLog;
4653
}
4754

4855
public static void shutDown() {

debug-db/src/main/java/com/amitshekhar/utils/NetworkUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ private NetworkUtils() {
3232
// This class in not publicly instantiable
3333
}
3434

35-
public static String getIpAccess(Context context, int port) {
35+
public static String getAddressLog(Context context, int port) {
3636
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
3737
int ipAddress = wifiManager.getConnectionInfo().getIpAddress();
3838
final String formatedIpAddress = String.format("%d.%d.%d.%d", (ipAddress & 0xff), (ipAddress >> 8 & 0xff), (ipAddress >> 16 & 0xff), (ipAddress >> 24 & 0xff));

0 commit comments

Comments
 (0)