Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;
import android.content.pm.ApplicationInfo;

import android.content.pm.PackageManager;

import android.os.Bundle;

public class Main {
    public static String getAppKey(Context paramContext) {
        String str = null;
        try {
            ApplicationInfo localApplicationInfo = paramContext.getPackageManager()
                    .getApplicationInfo(paramContext.getPackageName(), 128);
            Bundle localBundle = null;
            str = null;
            if (localApplicationInfo != null)
                localBundle = localApplicationInfo.metaData;
            str = null;
            if (localBundle != null) {
                str = localBundle.getString("JPUSH_APPKEY");
                if (str != null) {
                    int i = str.length();
                    if (i == 24)
                        ;
                } else {
                    str = null;
                }
            }
            return str;
        } catch (PackageManager.NameNotFoundException localNameNotFoundException) {
        }
        return str;
    }
}