本文主要是介绍获取android app uid,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
public static void getUid(Context context){
try {
String packageName = "com.test.example"; // 指定包名
PackageManager pm = context.getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo(packageName, PackageManager.GET_ACTIVITIES);
Log.d("UID", "getUid:" + ai.uid);
Toast.makeText(context, Integer.toString(ai.uid,10), Toast.LENGTH_SHORT).show();
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
}
这篇关于获取android app uid的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!