Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.app.Application;

import android.content.Intent;

import android.content.pm.ResolveInfo;

public class Main {
    public static boolean isLauncherDefault(Application application) {
        final Intent intent = new Intent(Intent.ACTION_MAIN);
        intent.addCategory(Intent.CATEGORY_HOME);
        final ResolveInfo res = application.getPackageManager().resolveActivity(intent, 0);
        if (res.activityInfo == null) {
            return false;
        } else if ("android".equals(res.activityInfo.packageName)) {
            return false;
        } else {
            if (res.activityInfo.packageName.equals(application.getPackageName()))
                return true;
            else
                return false;
        }
    }
}