android-hidden-api


Source link: https://github.com/anggrayudi/android-hidden-api

Android Hidden API

Android Hidden API is a modified jar file which combines the android.jar from the Android SDK with the framework.jar from a real device. This jar enables to use Android's internal/hidden APIs in development.

What is Android internal and hidden APIs? The internal API is located in the com.android.internal package which is available in the framework.jar file from a real Android device, while the hidden API is located in the android.jar file with @hide javadoc attribute. Although the classes & methods are public you cannot access it directly. There are pretty methods and resources you can use from this package. I will assume this is one API and I will refer to it as to hidden API. Learn more about hidden API here.

What's the advantage? You don't need to create new classes, constants, methods or resources when you want to use the similar function in your project. For example, if you want to create a new String resource that contains the 'accept' word. Then you want to create a new translation to another language, e.g. Arabic, Indonesian, even with all languages in this world. This is too exhausting and a waste of time. Why don't you use com.android.internal.R.string.accept which is retrieved via InternalAccessor.getString("accept")?

Usage

If you plan to use only Android internal resources rather than internal classes or methods, do:

dependencies {

  compile 'com.anggrayudi:android-hidden-api:0.0.7' 
}
 repositories {

  maven {
 url 'https://dl.bintray.com/anggrayudi/maven/' 
}

  // Or, you can use jCenter instead
  jcenter() 
}

Here's some example of accessing internal resources:

import com.anggrayudi.hiddenapi.r.Rc;

String accept = InternalAccessor.getString(Rc.string.accept);

  float sbar_height = InternalAccessor.getDimension(Rc.dimen.status_bar_height);

  int notif_color = InternalAccessor.getColor("config_defaultNotificationColor");

If you also want to include the internal classes or methods, do the following:

  1. Go to <SDK location>/platforms/.
  2. Copy, paste and replace the downloaded hidden API file into this directory, e.g. android-25/android.jar.
  3. Change compileSdkVersion and targetSdkVersion to 25 (for example).
  4. Finally, rebuild your project.

Note: Higher compileSdkVersion and targetSdkVersion will be better.

License

Copyright 2015-2017 Anggrayudi Hardiannicko A.  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. 

Resources

HTML Content (Article) Extractor for Android - fork of Goose by Gravity Labs.

Adapter between RxJava V1 and V2.

Sketch can help developers to read images from local storage or network.

A simple comparison chart for rankings.

A view to show radar chart.

A library for showing different state of views (Content, Empty, Loading, Error).

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