问题
The NFCEE_ADMIN permission is signature level. However, is it possible to "cheat" to get this permission on a rooted phone ? Maybe using a technique similar to the way ClockSync does it ?
I am trying to use reflexion techniques to get access to NFCExtras :
mAdapter = NfcAdapter.getDefaultAdapter(this);
try {
Class mynfcextras = Class.forName("android.nfc.INfcAdapterExtras");
Method getnfcExtras = mAdapter.getClass().getMethod("getNfcAdapterExtrasInterface");
Object nfcExtras = getnfcExtras.invoke(mAdapter);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
But of course get the following error : "NFCEE_ADMIN permission required: Neither user xxx nor current process has com.android.nfc.permission.NFCEE_ADMIN."
Edit : Of course, I did add the permission to the package, but it is removed during installation :
W/PackageManager( XXX): Not granting permission com.android.nfc.permission.NFCEE_ADMIN to package XXX (protectionLevel=2 flags=0x8be46)
回答1:
The signature of your app needs to be in /system/etc/nfcee_access.xml
. See e.g. http://code.google.com/p/seek-for-android/wiki/BuildingTheSystem for an example how to create it.
来源:https://stackoverflow.com/questions/9545734/how-to-obtain-nfcee-admin-permission-on-rooted-phone