android - Can I use private API in my application then upload to Google play market? -


in application, used snippet code below

public static void setmobiledataenabled(context context, boolean enabled) { try {     final connectivitymanager conman = (connectivitymanager) context.getsystemservice(context.connectivity_service);     final class<?> conmanclass = class.forname(conman.getclass().getname());     final field iconnectivitymanagerfield = conmanclass.getdeclaredfield("mservice");     iconnectivitymanagerfield.setaccessible(true);     final object iconnectivitymanager = iconnectivitymanagerfield.get(conman);     final class<?> iconnectivitymanagerclass = class.forname(iconnectivitymanager.getclass().getname());     final method setmobiledataenabledmethod = iconnectivitymanagerclass.getdeclaredmethod("setmobiledataenabled", boolean.type);     setmobiledataenabledmethod.setaccessible(true);     setmobiledataenabledmethod.invoke(iconnectivitymanager, enabled); } catch (exception e) {     e.printstacktrace(); } 

can know when used code in application, google still allows me upload app, or prevent/reject - because private api / forbidden api?

yes, supported, , recommended in situation want compatibility multiple versions of android os in 1 apk file.

you can check article android official blog reflection.

http://android-developers.blogspot.com.br/2009/04/backward-compatibility-for-android.html


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -