Android Debug Database


Source link: https://github.com/amitshekhariitbhu/Android-Debug-Database

Android Debug Database

Android Debug Database is a powerful library for debugging databases and shared preferences in Android applications.

Android Debug Database allows you to view databases and shared preferences directly in your browser in a very simple way.

What can Android Debug Database do?

  • See all the databases.
  • See all the data in the shared preferences used in your application.
  • Run any sql query on the given database to update and delete your data.
  • Directly edit the database values.
  • Directly edit the shared preferences.
  • Directly add a row in the database.
  • Directly add a key-value in the shared preferences.
  • Delete database rows and shared preferences.
  • Search in your data.
  • Sort data.
  • Download database.

All these features work without rooting your device -> No need of rooted device

Check out another awesome library for fast and simple networking in Android.

Using Android Debug Database Library in your application

Add this to your app's build.gradle

debugCompile 'com.amitshekhar.android:debug-db:1.0.1'

Use debugCompile so that it will only compile in your debug build and not in your release build.

That’s all, just start the application, you will see in the logcat an entry like follows :

  • D/DebugDB: Open http://XXX.XXX.X.XXX:8080 in your browser

  • You can also always get the debug address url from your code by calling the method DebugDB.getAddressLog();

Now open the provided link in your browser.

Important:

  • Your Android phone and laptop should be connected to the same Network (Wifi or LAN).
  • If you are using it over usb, run adb forward tcp:8080 tcp:8080

Note : If you want use different port other than 8080. In the app build.gradle file under buildTypes do the following change

debug {

  resValue("string", "PORT_NUMBER", "8081") 
}

You will see something like this :

Seeing values

Editing values

Working with emulator

  • Android Default Emulator: Run the command in the terminal - adb forward tcp:8080 tcp:8080 and open http://localhost:8080
  • Genymotion Emulator: Enable bridge from configure virtual device (option available in genymotion)

Getting address with toast, in case you missed the address log in logcat

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.

public static void showDebugDBAddressLogToast(Context context) {

  if (BuildConfig.DEBUG) {

  try {

 Class<?> debugDB = Class.forName("com.amitshekhar.DebugDB");

 Method getAddressLog = debugDB.getMethod("getAddressLog");

 Object value = getAddressLog.invoke(null);

 Toast.makeText(context, (String) value, Toast.LENGTH_LONG).show();

  
}
 catch (Exception ignore) {

}

  
}
 
}

Adding custom database files

As this library is auto-initialize, if you want to add custom database files, add the following method and call

public static void setCustomDatabaseFiles(Context context) {

  if (BuildConfig.DEBUG) {

try {

 Class<?> debugDB = Class.forName("com.amitshekhar.DebugDB");

 Class[] argTypes = new Class[]{
HashMap.class
}
;

 Method setCustomDatabaseFiles = debugDB.getMethod("setCustomDatabaseFiles", argTypes);

 HashMap<String, File> customDatabaseFiles = new HashMap<>();

 // set your custom database files

 customDatabaseFiles.put(ExtTestDBHelper.DATABASE_NAME,

new File(context.getFilesDir() + "/" + ExtTestDBHelper.DIR_NAME +

  "/" + ExtTestDBHelper.DATABASE_NAME));

 setCustomDatabaseFiles.invoke(null, customDatabaseFiles);

}
 catch (Exception ignore) {

 
}

  
}
 
}

Find this project useful ? ❤?

  • Support it by clicking the ⭐? button on the upper right of this page. ✌?

TODO

  • Simplify emulator issue Issue Link
  • And of course many more features and bug fixes.

Check out Mindorks awesome open source projects here

Contact - Let's become friends

License


Copyright (C) 2016 Amit Shekhar
 Copyright (C) 2011 Android Open Source Project
  Licensed under the Apache License, Version 2.0 (the "License");

 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License. 

Contributing to Android Debug Database

Just make pull request. You're in!

Resources

Circle progress view. Can be used as button.

Android Code Highlighter.

How to create instagram like Gradient color transition in android.

This is an Android Library for developer to use customized recyclerview with many features, like easy use Empty view, Refresh view, Floating Action Button, Load more. So all these features contain in one recyclerview.

In short, this is a GraphQL request JSON body builder for Kotlin. It will generate the JSON string for request body that work with GraphQL Server.

An easy way to check the settings before requesting location using RxJava. Based on Android-ReactiveLocation.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes