
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
react-native-launcher-kit
Advanced tools
React Native Launcher Kit is a comprehensive package for building launchers in React Native. It provides features like launching an app, opening device settings, checking app installation, getting default launcher app's bundle ID, opening default alarm ap
This is a React Native package for Android that provides a set of helper functions for launching apps and interacting with the launcher. It works with automatic linking on React Native versions 0.60 and higher. For older versions, manual linking is required.
npm install react-native-launcher-kit
or
yarn add react-native-launcher-kit
If you're using React Native 0.60 or higher, the package will be automatically linked for you. For older versions, you need to manually link the package.
react-native link react-native-launcher-kit
android/app/build.gradle
file in your project and add the following line to the dependencies
section:implementation
project(':react-native-launcher-kit')
MainApplication.java
file in your project and add the following import statement:import com.launcherkit;
protected List<ReactPackage> getPackages(){
return Arrays.asList(
new MainReactPackage(),
new LauncherKit() // <-- Add this line
);
}
The features of the React Native Launcher Kit include:
❤️ Love this project? Consider supporting its development!
Starting with Android 11 (API level 30), you need to add the following permission to your AndroidManifest.xml
file to query package information:
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
Important Note: Google Play Store has specific policies regarding the use of QUERY_ALL_PACKAGES
permission. Your app must have a core functionality that requires querying installed apps to use this permission. You may need to provide justification during the app review process. Make sure your app's use case complies with the Google Play Policy.
This permission is required for the following features in this package:
Enhanced Launch Parameters:
🚀 Launch Parameter Support
IntentAction
and MimeType
enumsLaunchParams
interfaceBreaking Changes:
🚀 Performance Optimization
🔄 API Changes
QUERY_ALL_PACKAGES
permission requirement to user's AndroidManifest.xml
Previously this was included in the package's manifest, now users need to add it manually if their app requires querying all packages
✨ New Features
First release
getApps(options: GetAppsOptions): Promise<AppDetail[]>
Returns an array of all installed apps on the device with optional version and accent color.
import { InstalledApps } from 'react-native-launcher-kit';
const result = await InstalledApps.getApps({ includeVersion: true, includeAccentColor: true });
getSortedApps(options: GetAppsOptions): Promise<AppDetail[]>
Returns an array of all installed apps on the device, sorted alphabetically by app label, with optional version and accent color.
import { InstalledApps } from 'react-native-launcher-kit';
const result = await InstalledApps.getSortedApps({ includeVersion: true, includeAccentColor: true });
AppDetail Interface
interface AppDetail {
label: string;
packageName: string;
icon: string;
version?: string;
accentColor?: string;
}
GetAppsOptions Interface
interface GetAppsOptions {
includeVersion: boolean;
includeAccentColor: boolean;
}
launchApplication
import { RNLauncherKitHelper } from 'react-native-launcher-kit';
// Simple app launch
RNLauncherKitHelper.launchApplication('com.example.app');
Google Maps Examples
import { RNLauncherKitHelper, IntentAction } from 'react-native-launcher-kit';
// Open specific location
RNLauncherKitHelper.launchApplication('com.google.android.apps.maps', {
action: IntentAction.VIEW,
data: `geo:40.7580,-73.9855?q=40.7580,-73.9855(Times Square)&z=16`
});
// Start navigation
RNLauncherKitHelper.launchApplication('com.google.android.apps.maps', {
action: IntentAction.VIEW,
data: `google.navigation:q=48.8584,2.2945&mode=driving`
});
Browser Examples
import { RNLauncherKitHelper, IntentAction } from 'react-native-launcher-kit';
// Open URL in Chrome
RNLauncherKitHelper.launchApplication('com.android.chrome', {
action: IntentAction.VIEW,
data: 'https://www.youtube.com'
});
Available intent actions for enhanced app launching:
enum IntentAction {
MAIN = 'android.intent.action.MAIN',
VIEW = 'android.intent.action.VIEW',
SEND = 'android.intent.action.SEND'
}
Common MIME types for content handling:
enum MimeType {
ALL = '*/*',
GENESIS_ROM = 'application/x-genesis-rom',
PSX_ROM = 'application/x-playstation-rom',
PDF = 'application/pdf',
TEXT = 'text/plain',
HTML = 'text/html'
}
interface LaunchParams {
action?: IntentAction | string;
data?: string;
type?: MimeType | string;
extras?: Record;
}
IntentAction
and MimeType
) are optional helpersextras
object accepts any key-value pairs needed by the target appcheckIfPackageInstalled: Promise<boolean>
Checks if an app with the given bundle ID is installed on the device.
import { RNLauncherKitHelper } from 'react-native-launcher-kit';
const result = await RNLauncherKitHelper.checkIfPackageInstalled(
'com.android.settings',
);
console.log(result); // true or false.
getDefaultLauncherPackageName: Promise<string>
Checks the default launcher app on the device.
import { RNLauncherKitHelper } from 'react-native-launcher-kit';
const result = await RNLauncherKitHelper.getDefaultLauncherPackageName();
console.log(result);
openSetDefaultLauncher: Promise<boolean>
Opens the "Set Default Launcher" screen on the device.
import { RNLauncherKitHelper } from 'react-native-launcher-kit';
const result = await RNLauncherKitHelper.openSetDefaultLauncher();
console.log(result); // true or false.
getBatteryStatus: Promise<BatteryStatus>
Returns the current battery status of the device and if the phone is currently charging or not.
import { RNLauncherKitHelper } from 'react-native-launcher-kit';
const result = await RNLauncherKitHelper.getBatteryStatus();
console.log(result); // {"isCharging": false, "level": 100}
BatteryStatus Interface
interface AppDetail {
level: number;
isCharging: boolean;
}
openAlarmApp: boolean
Opens the default alarm app on the device.
import { RNLauncherKitHelper } from 'react-native-launcher-kit';
const result = await RNLauncherKitHelper.getBatteryStatus();
console.log(result);
goToSettings
Opens the settings screen of the device.
import { RNLauncherKitHelper } from 'react-native-launcher-kit';
RNLauncherKitHelper.goToSettings();
Listens for app installations and provides app details when an app is installed.
import { InstalledApps } from 'react-native-launcher-kit';
import { useEffect, useState } from 'react';
const App = () => {
const [apps, setApps] = useState<AppDetail[]>([]);
const initApp = async () => {
const appsList = await InstalledApps.getApps({
includeVersion: true,
includeAccentColor: true,
});
setApps(appsList);
}
useEffect(() => {
InstalledApps.startListeningForAppInstallations((app) => {
setApps((prev) => [app, ...prev]);
});
return () => {
InstalledApps.stopListeningForAppInstallations();
};
}, []);
return (
// Your component rendering logic
);
};
Listens for app removals (uninstallations) and provides the package name when an app is removed.
import { InstalledApps } from 'react-native-launcher-kit';
import { useEffect, useState } from 'react';
const App = () => {
const [apps, setApps] = useState<AppDetail[]>([]);
const initApp = async () => {
const appsList = await InstalledApps.getApps({
includeVersion: true,
includeAccentColor: true,
});
setApps(appsList);
}
useEffect(() => {
InstalledApps.startListeningForAppRemovals((packageName) => {
setApps((prev) =>
prev.filter((item) => item.packageName !== packageName)
);
});
return () => {
InstalledApps.stopListeningForAppRemovals();
};
}, []);
return (
// Your component rendering logic
);
};
React-Native-Launcher-Kit has been utilized for testing purposes on a launcher known as NoPhoneLauncher. You can experience its functionality in real-time by accessing it on Google Play via the following link.
You can experience the functionality of the code by exploring the examples provided in our GitHub repository, which can be accessed from the following link.
MIT
FAQs
React Native Launcher Kit is a comprehensive package for building launchers in React Native. It provides features like launching an app, opening device settings, checking app installation, getting default launcher app's bundle ID, opening default alarm ap
The npm package react-native-launcher-kit receives a total of 181 weekly downloads. As such, react-native-launcher-kit popularity was classified as not popular.
We found that react-native-launcher-kit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.