Skip to content

Commit 93bb3ca

Browse files
Update README.md
1 parent 94efb5a commit 93bb3ca

File tree

1 file changed

+0
-206
lines changed

1 file changed

+0
-206
lines changed

README.md

Lines changed: 0 additions & 206 deletions
Original file line numberDiff line numberDiff line change
@@ -1,207 +1 @@
1-
<img src=https://raw.githubusercontent.com/amitshekhariitbhu/Android-Debug-Database/master/assets/debug_db_banner.png >
21

3-
# Android Debug Database
4-
5-
[![Mindorks](https://img.shields.io/badge/mindorks-opensource-blue.svg)](https://mindorks.com/open-source-projects)
6-
[![Mindorks Community](https://img.shields.io/badge/join-community-blue.svg)](https://mindorks.com/join-community)
7-
[![Mindorks Android Store](https://img.shields.io/badge/Mindorks%20Android%20Store-Android%20Debug%20Database-blue.svg?style=flat)](https://mindorks.com/android/store)
8-
[![API](https://img.shields.io/badge/API-9%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=9)
9-
[![Download](https://api.bintray.com/packages/amitshekhariitbhu/maven/debug-db/images/download.svg) ](https://bintray.com/amitshekhariitbhu/maven/debug-db/_latestVersion)
10-
[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=102)](https://opensource.org/licenses/Apache-2.0)
11-
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/amitshekhariitbhu/Android-Debug-Database/blob/master/LICENSE)
12-
13-
## Android Debug Database is a powerful library for debugging databases and shared preferences in Android applications
14-
15-
### Android Debug Database allows you to view databases and shared preferences directly in your browser in a very simple way
16-
17-
### What can Android Debug Database do?
18-
19-
* See all the databases.
20-
* See all the data in the shared preferences used in your application.
21-
* Run any sql query on the given database to update and delete your data.
22-
* Directly edit the database values.
23-
* Directly edit the shared preferences.
24-
* Directly add a row in the database.
25-
* Directly add a key-value in the shared preferences.
26-
* Delete database rows and shared preferences.
27-
* Search in your data.
28-
* Sort data.
29-
* Download database.
30-
* Debug Room inMemory database.
31-
32-
## [My Personal Blog - amitshekhar.me](https://amitshekhar.me/blog) - High-quality content to learn Android concepts.
33-
34-
### All these features work without rooting your device -> No need of rooted device
35-
36-
### Check out our other Open Source Projects
37-
38-
* [Fast Android Networking Library](https://github.com/amitshekhariitbhu/Fast-Android-Networking)
39-
* [Learn to build a ride-sharing Android app like Uber, Lyft](https://github.com/MindorksOpenSource/ridesharing-uber-lyft-app)
40-
* [Kotlin-Coroutines-Android-Examples](https://github.com/MindorksOpenSource/Kotlin-Coroutines-Android-Examples)
41-
42-
### Using Android Debug Database Library in your application
43-
44-
Add this to your app's build.gradle
45-
46-
```groovy
47-
debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'
48-
```
49-
50-
Using the Android Debug Database with encrypted database
51-
52-
```groovy
53-
debugImplementation 'com.amitshekhar.android:debug-db-encrypt:1.0.6'
54-
```
55-
And to provide the password for the DB, you should add this in the Gradle:
56-
DB_PASSWORD_{VARIABLE}, if for example, PERSON is the database name: DB_PASSWORD_PERSON
57-
```groovy
58-
debug {
59-
resValue("string", "DB_PASSWORD_PERSON", "password")
60-
}
61-
```
62-
63-
Use `debugImplementation` so that it will only compile in your debug build and not in your release build.
64-
65-
That’s all, just start the application, you will see in the logcat an entry like follows :
66-
67-
* D/DebugDB: Open http://XXX.XXX.X.XXX:8080 in your browser
68-
69-
* You can also always get the debug address url from your code by calling the method `DebugDB.getAddressLog();`
70-
71-
Now open the provided link in your browser.
72-
73-
Important:
74-
75-
* Your Android phone and laptop should be connected to the same Network (Wifi or LAN).
76-
* If you are using it over usb, run `adb forward tcp:8080 tcp:8080`
77-
78-
Note : If you want use different port other than 8080.
79-
In the app build.gradle file under buildTypes do the following change
80-
81-
```groovy
82-
debug {
83-
resValue("string", "PORT_NUMBER", "8081")
84-
}
85-
```
86-
87-
You will see something like this :
88-
89-
### Seeing values
90-
91-
<img src=https://raw.githubusercontent.com/amitshekhariitbhu/Android-Debug-Database/master/assets/debugdb.png >
92-
93-
### Editing values
94-
95-
<img src=https://raw.githubusercontent.com/amitshekhariitbhu/Android-Debug-Database/master/assets/debugdb_edit.png >
96-
97-
### Working with emulator
98-
99-
* Android Default Emulator: Run the command in the terminal - `adb forward tcp:8080 tcp:8080` and open http://localhost:8080
100-
* Genymotion Emulator: Enable bridge from configure virtual device (option available in genymotion)
101-
102-
### Getting address with toast, in case you missed the address log in logcat
103-
104-
As this library is auto-initialize, if you want to get the address log, add the following method and call (we have to do like this to avoid build error in release build as this library will not be included in the release build) using reflection.
105-
106-
```java
107-
public static void showDebugDBAddressLogToast(Context context) {
108-
if (BuildConfig.DEBUG) {
109-
try {
110-
Class<?> debugDB = Class.forName("com.amitshekhar.DebugDB");
111-
Method getAddressLog = debugDB.getMethod("getAddressLog");
112-
Object value = getAddressLog.invoke(null);
113-
Toast.makeText(context, (String) value, Toast.LENGTH_LONG).show();
114-
} catch (Exception ignore) {
115-
116-
}
117-
}
118-
}
119-
```
120-
121-
### Adding custom database files
122-
123-
As this library is auto-initialize, if you want to debug custom database files, add the following method and call
124-
125-
```java
126-
public static void setCustomDatabaseFiles(Context context) {
127-
if (BuildConfig.DEBUG) {
128-
try {
129-
Class<?> debugDB = Class.forName("com.amitshekhar.DebugDB");
130-
Class[] argTypes = new Class[]{HashMap.class};
131-
Method setCustomDatabaseFiles = debugDB.getMethod("setCustomDatabaseFiles", argTypes);
132-
HashMap<String, Pair<File, String>> customDatabaseFiles = new HashMap<>();
133-
// set your custom database files
134-
customDatabaseFiles.put(ExtTestDBHelper.DATABASE_NAME,
135-
new Pair<>(new File(context.getFilesDir() + "/" + ExtTestDBHelper.DIR_NAME +
136-
"/" + ExtTestDBHelper.DATABASE_NAME), ""));
137-
setCustomDatabaseFiles.invoke(null, customDatabaseFiles);
138-
} catch (Exception ignore) {
139-
140-
}
141-
}
142-
}
143-
```
144-
145-
### Adding InMemory Room databases
146-
147-
As this library is auto-initialize, if you want to debug inMemory Room databases, add the following method and call
148-
149-
```java
150-
public static void setInMemoryRoomDatabases(SupportSQLiteDatabase... database) {
151-
if (BuildConfig.DEBUG) {
152-
try {
153-
Class<?> debugDB = Class.forName("com.amitshekhar.DebugDB");
154-
Class[] argTypes = new Class[]{HashMap.class};
155-
HashMap<String, SupportSQLiteDatabase> inMemoryDatabases = new HashMap<>();
156-
// set your inMemory databases
157-
inMemoryDatabases.put("InMemoryOne.db", database[0]);
158-
Method setRoomInMemoryDatabase = debugDB.getMethod("setInMemoryRoomDatabases", argTypes);
159-
setRoomInMemoryDatabase.invoke(null, inMemoryDatabases);
160-
} catch (Exception ignore) {
161-
162-
}
163-
}
164-
}
165-
```
166-
167-
### Find this project useful ? :heart:
168-
169-
* Support it by clicking the :star: button on the upper right of this page. :v:
170-
171-
### TODO
172-
173-
* Simplify emulator issue [Issue Link](https://github.com/amitshekhariitbhu/Android-Debug-Database/issues/6)
174-
* And of course many more features and bug fixes.
175-
176-
### [Check out Mindorks awesome open source projects here](https://mindorks.com/open-source-projects)
177-
178-
### Contact - Let's become friends
179-
180-
* [Twitter](https://twitter.com/amitiitbhu)
181-
* [GitHub](https://github.com/amitshekhariitbhu)
182-
* [Medium](https://medium.com/@amitshekhar)
183-
* [Facebook](https://www.facebook.com/amit.shekhar.iitbhu)
184-
185-
### License
186-
187-
```
188-
Copyright (C) 2019 Amit Shekhar
189-
Copyright (C) 2011 Android Open Source Project
190-
191-
Licensed under the Apache License, Version 2.0 (the "License");
192-
you may not use this file except in compliance with the License.
193-
You may obtain a copy of the License at
194-
195-
http://www.apache.org/licenses/LICENSE-2.0
196-
197-
Unless required by applicable law or agreed to in writing, software
198-
distributed under the License is distributed on an "AS IS" BASIS,
199-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200-
See the License for the specific language governing permissions and
201-
limitations under the License.
202-
```
203-
204-
### Contributing to Android Debug Database
205-
206-
All pull requests are welcome, make sure to follow the [contribution guidelines](CONTRIBUTING.md)
207-
when you submit pull request.

0 commit comments

Comments
 (0)