Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add a utility function

  • Loading branch information...
commit adacf6a320b09bd5167673d1d8d05edcd2c7fb0b 1 parent b8fc833
@timsu timsu authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 src/com/todoroo/andlib/utility/AndroidUtilities.java
View
16 src/com/todoroo/andlib/utility/AndroidUtilities.java
@@ -23,6 +23,8 @@
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.ConnectivityManager;
@@ -492,6 +494,20 @@ public static Intent remoteIntent(String appPackage, String activityClass) {
return intent;
}
+ /**
+ * Gets application signature
+ * @return application signature, or null if an error was encountered
+ */
+ public static String getSignature(Context context, String packageName) {
+ try {
+ PackageInfo packageInfo = context.getPackageManager().getPackageInfo(packageName,
+ PackageManager.GET_SIGNATURES);
+ return packageInfo.signatures[0].toCharsString();
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
// --- internal
private static ExceptionService exceptionService = null;
Please sign in to comment.
Something went wrong with that request. Please try again.