Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;

import android.os.Build;

public class Main {
    public static final boolean isKeyguardWidget(int appWidgetId, Context context) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context.getApplicationContext());

            return appWidgetManager.getAppWidgetOptions(appWidgetId).getInt(
                    AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY,
                    -1) == AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD;
        }

        return false;
    }
}