Android Signature - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Signature class.

This code example shows how to use the following methods: toByteArray
 
    private ContentValues createConsumer(String packageName, long regId, Signature sig,
            boolean isPublic) {
        ContentValues value = new ContentValues();
        value.put(Consumers.PACKAGE_NAME, packageName);
        value.put(Consumers.SIGNATURE, sig.toByteArray());
        value.put(Consumers.IS_SERVICE_PUBLIC, isPublic);
        value.put(Consumers.IS_BANNED, false);
        value.put(Consumers.OWNS_CONSUMER_KEY, true);
        value.put(Consumers.REGISTRY_ID, regId);
        return value;
    } 
 
    private void standardInsert() { 
        long[] ids = new long[6];
        ids[0] = mDB.insert("registry", "", createReg("test1"));
        ids[1] = mDB.insert("registry", "", createReg("test2"));
        ids[2] = mDB.insert("registry", "", createRegAuth("test3"));
        ids[3] = mDB.insert("registry", "", createRegAuth("test4"));
        ids[4] = mDB.insert("registry", "", createRegAuth("test5"));

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
        assertTrue(cur.moveToFirst());
        assertEquals(PACKAGE_UNDER_TEST, cur.getString(0));
        assertEquals(0, cur.getInt(1));
        assertEquals(1, cur.getInt(2));
        assertEquals(1, cur.getInt(3));
        assertEquals(new Signature(SIGNATURE_FOR_PACKAGE), new Signature(cur.getBlob(4)));
        cur.close();
    } 
 
    public void testShouldUpdateCorrectly() throws Exception { 
        setPackage(PACKAGE_UNDER_TEST);
        setSignature(SIGNATURE_FOR_PACKAGE);
 
        ContentValues value = new ContentValues();
        value.put(Registry.ACCESS_TOKEN_URL, "http://access");
        value.put(Registry.REQUEST_TOKEN_URL, "http://request");
        value.put(Registry.AUTHORIZE_URL, "http://authorize");
        value.put(Registry.CONSUMER_KEY, "key");
        value.put(Registry.CONSUMER_SECRET, "secret123");
        value.put(Registry.URL, "http://twitter.com");
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
        public PackageInfo getPackageInfo(String packageName, int flags)
                throws NameNotFoundException { 
 
            PackageInfo info = new PackageInfo();
            info.signatures = new Signature[] {
                new Signature(testSignature)
            }; 
            return info;
        } 
    } 
} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: toByteArray
    try { 
      md = MessageDigest.getInstance("SHA1");
    } catch (NoSuchAlgorithmException e) {
      return ""; 
    } 
    md.update(sig.toByteArray());
    return toHexString(md.digest());
  } 
 
  public static String getUserAgent(Context context) {
    PackageInfo pinfo;
    try { 
      pinfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
    } catch (NameNotFoundException e) {
      pinfo = null;
    } 
 
    final String versionName;
    final int versionCode;
    if (pinfo != null) {
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: toByteArray
        } 
        return false; 
    } 
 
    private X509Certificate toX509Certificate(Signature signature) throws CertificateException {
        byte[] cert = signature.toByteArray();
        InputStream input = new ByteArrayInputStream(cert);
        return (X509Certificate)this.certificateFactory.generateCertificate(input);
    } 
} 
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android Signature Questions & Answers:

See Code Examples for Android Signature Methods: