3
PackageManager pm = this.getPackageManager();
PackageInfo info = pm.getPackageInfo("pkgname", PackageManager.GET_SIGNATURES);
Signature[] sig = info.signatures;
String sigstring = new String(sig[0].toChars());
System.out.println(sigstring);`

我编写了以下脚本来提取签名,但它不起作用。

我在网上找到了这个。

我收到一个编译错误,因为“该类的方法 getPackageManager() 未定义”

我也尝试使用上下文类,但没有帮助。

4

1 回答 1

1

The method getPackageManager() belongs to the android.content.Context class and is therefore present in all subclasses.

If the code you have posted does not work you have implemented it most likely not in an Activity or Service. Both derive from Context and therefore have this method.

于 2012-09-10T13:35:25.763 回答