Monday, August 22, 2011

How call a method/function inside a APK file in Android?

Today I came across this piece of code and thought of sharing it with others.

PathClassLoader c = new PathClassLoader("/system/app/Mms.apk", getClassLoader());
Class.forName("com.android.mms.util.ContactInfoCache", true, c)
.getMethod("init", Context.class).invoke(null, context);
Class.forName("com.android.mms.transaction.MessagingNotification", true, c)
.getMethod("updateAllNotifications", Context.class).invoke(null, context);

This piece of code will trigger Android new message arrival notification. Interesting ...

No comments:

Post a Comment