You can use undocumented method android.app.ActivityThread.currentPackageName()
:
Class<?> clazz = Class.forName("android.app.ActivityThread");
Method method = clazz.getDeclaredMethod("currentPackageName", null);
String appPackageName = (String) method.invoke(clazz, null);
Caveat: This must be done on the main thread of the application.
Thanks to this blog post for the idea: http://blog.javia.org/static-the-android-application-package/ .