introduction
Hello koders I am here today to introduce my new one block Extention created by Mr_koder this is an extension method that checks if a specific app, identified by its package name, is installed on the device
block
source code
source code
package com.mrkoder.app.install.check;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
import android.content.pm.ApplicationInfo;
import android.util.Log;
import java.util.List;
@DesignerComponent(
version = 1,
description = "An extension tool created by Mr_koder for installation check is a software component that enables users to verify if a particular app is installed on a device or not",
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = "https://i.ibb.co/RCbDMbp/Icon.png")
@SimpleObject(external = true)
//Libraries
@UsesLibraries(libraries = "")
//Permissions
@UsesPermissions(permissionNames = "")
public class Appinstallcheck extends AndroidNonvisibleComponent {
//Activity and Context
private Context context;
private Activity activity;
public Appinstallcheck(ComponentContainer container){
super(container.$form());
this.activity = container.$context();
this.context = container.$context();
}
@SimpleFunction(description = "Check if the app with the specified package name is installed on the device")
public boolean IsAppInstalled(String packageName) {
PackageManager packageManager = context.getPackageManager();
try {
packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
return true;
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
}
Our socials
Download
Aix
❒ com.mrkoder.app.install.check.aix