{"id":25271977,"url":"https://github.com/louaysleman/react-native-launcher-kit","last_synced_at":"2025-04-07T07:03:49.269Z","repository":{"id":154073250,"uuid":"625164075","full_name":"louaySleman/react-native-launcher-kit","owner":"louaySleman","description":"React Native Launcher Kit is a comprehensive package for building launchers in React Native.","archived":false,"fork":false,"pushed_at":"2025-01-11T14:34:01.000Z","size":13994,"stargazers_count":44,"open_issues_count":5,"forks_count":10,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T06:08:06.847Z","etag":null,"topics":["android","launcher","reactnative"],"latest_commit_sha":null,"homepage":"https://nophonelauncher.canguru.au","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/louaySleman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-08T09:02:03.000Z","updated_at":"2025-03-23T20:38:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"91c82697-ce88-45c0-8ee7-d5e5f1a38a0f","html_url":"https://github.com/louaySleman/react-native-launcher-kit","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louaySleman%2Freact-native-launcher-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louaySleman%2Freact-native-launcher-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louaySleman%2Freact-native-launcher-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louaySleman%2Freact-native-launcher-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/louaySleman","download_url":"https://codeload.github.com/louaySleman/react-native-launcher-kit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247608150,"owners_count":20965952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","launcher","reactnative"],"created_at":"2025-02-12T12:38:54.477Z","updated_at":"2025-04-07T07:03:49.240Z","avatar_url":"https://github.com/louaySleman.png","language":"TypeScript","funding_links":["https://www.patreon.com/louaysleman"],"categories":[],"sub_categories":[],"readme":"# react-native-launcher-kit\n\nThis is a React Native package for Android that provides a set of helper functions for launching apps and interacting\nwith the launcher. It works with automatic linking on React Native versions 0.60 and higher. For older versions, manual\nlinking is required.\n\n\u003cp align=\"left\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/react-native-launcher-kit\"\u003e\u003cimg src=\"https://img.shields.io/badge/npm-v2.1.0-blue\"\u003e\u003c/a\u003e\n \u003ca href=\"https://github.com/prettier/prettier\"\u003e\u003cimg src=\"https://img.shields.io/badge/styled_with-prettier-ff69b4.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Installation\n\n```sh\nnpm install react-native-launcher-kit\n```\nor\n```sh\nyarn add react-native-launcher-kit\n```\n\nIf you're using React Native 0.60 or higher, the package will be automatically linked for you. For older versions, you\nneed to manually link the package.\n\n\u003cdetails\u003e\n  \u003csummary\u003eManual Linking\u003c/summary\u003e\n\n  \u003c!-- Content of the dropdown goes here --\u003e\n\n1. In your project directory, run the following command:\n\n```sh\nreact-native link react-native-launcher-kit\n```\n\n2. Open the `android/app/build.gradle` file in your project and add the following line to the `dependencies` section:\n\n```typescript\nimplementation\nproject(':react-native-launcher-kit')\n```\n\n3. Open the `MainApplication.java` file in your project and add the following import statement:\n\n```java\nimport com.launcherkit;\n```\n\n4. Add the package to the list of packages in the getPackages() method:\n\n```java\nprotected List\u003cReactPackage\u003e getPackages(){\n  return Arrays.asList(\n  new MainReactPackage(),\n  new LauncherKit() // \u003c-- Add this line\n  );\n  }\n```\n\n\u003c/details\u003e\n\n## Features\n\nThe features of the React Native Launcher Kit include:\n\n1. Get all installed apps (sorted and unsorted).\n2. Get the current default launcher.\n3. Get the current battery percentage and whether the phone is charging or not.\n4. Check if a package (bundle ID) is installed.\n5. Open system settings.\n6. Open \"Set as default launcher\" screen directly.\n7. Open an app using its bundle ID with custom params.\n8. Open the alarm app directly.\n9. Listen for app installations and removals.\n10. Get app version and color accent for each app on the installed app list.\n\n❤️ **Love this project? Consider supporting its development!**\n\u003cp align=\"left\"\u003e\n  \u003ca href=\"https://www.patreon.com/louaysleman\"\u003e\n    \u003cimg src=\"https://c5.patreon.com/external/logo/become_a_patron_button.png\" alt=\"Become a Patron\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Important Note\n\nStarting with Android 11 (API level 30), you need to add the following permission to your `AndroidManifest.xml` file to query package information:\n\n```xml\n\u003cuses-permission android:name=\"android.permission.QUERY_ALL_PACKAGES\"/\u003e\n ```\n**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.\n\nThis permission is required for the following features in this package:\n\n- Getting installed apps list\n- Checking if a specific package is installed\n- Listening for app installations and removals\n\n## Demo\n\u003cp\u003e\n   \u003cimg width=\"200\" src=\"https://raw.githubusercontent.com/louaySleman/react-native-launcher-kit/main/screenshots/1.gif\" /\u003e\n\u003c/p\u003e\n\n## Breaking History\n\n### [2.1.0](https://github.com/louaySleman/react-native-launcher-kit/releases/tag/2.1.0)\n**Enhanced Launch Parameters:**\n\n🚀 **Launch Parameter Support**\n- Added structured launch parameters for better app launching\n- Introduced [`IntentAction`](#intent-actions) and [`MimeType`](#mime-types) enums\n- Enhanced type safety with [`LaunchParams`](#launch-parameters-interface) interface\n\n### [2.0.0](https://github.com/louaySleman/react-native-launcher-kit/releases/tag/2.0.0)\n**Breaking Changes:**\n\n🚀 **Performance Optimization**\n- Changed getApps and getSortedApps to return Promises\n- Apps are now loaded on-demand when calling getInstalledApps instead of at app startup\n- This change dramatically improves initial app launch performance\n\n🔄 **API Changes**\n- Icon property now returns file path instead of base64 string\n- Added new GetAppsOptions interface for configurable app queries\n- Added support for custom parameters in launchApplication\n- Moved `QUERY_ALL_PACKAGES` permission requirement to user's AndroidManifest.xml\n  \u003e Previously this was included in the package's manifest, now users need to add it manually if their app requires querying all packages\n\n✨ **New Features**\n- App version and accent color support in getApps and getSortedApps\n- New app installation listener with startListeningForAppInstallations\n- New app removal listener with startListeningForAppRemovals\n\n### [1.0.0](https://github.com/louaySleman/react-native-launcher-kit/releases/tag/1.0.4)\nFirst release\n\n## Methods\n\n### 1. `getApps(options: GetAppsOptions): Promise\u003cAppDetail[]\u003e`\n\nReturns an array of all installed apps on the device with optional version and accent color.\n\n\n\n```typescript\nimport { InstalledApps } from 'react-native-launcher-kit';\n\nconst result = await InstalledApps.getApps({ includeVersion: true, includeAccentColor: true });\n```\n\n### 2. `getSortedApps(options: GetAppsOptions): Promise\u003cAppDetail[]\u003e`\n\nReturns an array of all installed apps on the device, sorted alphabetically by app label, with optional version and accent color.\n\n```typescript\nimport { InstalledApps } from 'react-native-launcher-kit';\n\nconst result = await InstalledApps.getSortedApps({ includeVersion: true, includeAccentColor: true });\n```\n\n#### `AppDetail Interface`\n\n```typescript\ninterface AppDetail {\n  label: string;\n  packageName: string;\n  icon: string;\n  version?: string;\n  accentColor?: string;\n}\n```\n#### `GetAppsOptions Interface`\n\n```typescript\ninterface GetAppsOptions {\n  includeVersion: boolean;\n  includeAccentColor: boolean;\n}\n```\n\n### Note:\n\n- The icon property will now return the file path of the icon image instead of the base64 encoded string as in previous versions.\n- The accentColor property provides the dominant color of the app's icon for easy UI theming.\n\n### 3. Enhanced App Launching `launchApplication`\n\n#### Basic App Launch\n```typescript\nimport { RNLauncherKitHelper } from 'react-native-launcher-kit';\n\n// Simple app launch\nRNLauncherKitHelper.launchApplication('com.example.app');\n```\n\n#### Launch with Parameters\n\nGoogle Maps Examples\n```typescript\nimport { RNLauncherKitHelper, IntentAction } from 'react-native-launcher-kit';\n// Open specific location\nRNLauncherKitHelper.launchApplication('com.google.android.apps.maps', {\n  action: IntentAction.VIEW,\n  data: `geo:40.7580,-73.9855?q=40.7580,-73.9855(Times Square)\u0026z=16`\n});\n\n// Start navigation\nRNLauncherKitHelper.launchApplication('com.google.android.apps.maps', {\n  action: IntentAction.VIEW,\n  data: `google.navigation:q=48.8584,2.2945\u0026mode=driving`\n});\n```\n\nBrowser Examples\n```typescript\nimport { RNLauncherKitHelper, IntentAction } from 'react-native-launcher-kit';\n// Open URL in Chrome\nRNLauncherKitHelper.launchApplication('com.android.chrome', {\n  action: IntentAction.VIEW,\n  data: 'https://www.youtube.com'\n});\n```\n\n#### Intent Actions\nAvailable intent actions for enhanced app launching:\n```typescript\nenum IntentAction {\n  MAIN = 'android.intent.action.MAIN',\n  VIEW = 'android.intent.action.VIEW',\n  SEND = 'android.intent.action.SEND'\n}\n```\n\n#### MIME Types\nCommon MIME types for content handling:\n```typescript\nenum MimeType {\n  ALL = '*/*',\n  GENESIS_ROM = 'application/x-genesis-rom',\n  PSX_ROM = 'application/x-playstation-rom',\n  PDF = 'application/pdf',\n  TEXT = 'text/plain',\n  HTML = 'text/html'\n}\n```\n\n### Launch Parameters Interface\n```typescript\ninterface LaunchParams {\n  action?: IntentAction | string;\n  data?: string;\n  type?: MimeType | string;\n  extras?: Record;\n}\n```\n\n### Important Notes\n- The enums (`IntentAction` and `MimeType`) are optional helpers\n- You can use any valid Android intent action string directly\n- You can use any valid MIME type string directly\n- The `extras` object accepts any key-value pairs needed by the target app\n- Always check if the target app is installed before launching\n\n### 4. `checkIfPackageInstalled: Promise\u003cboolean\u003e`\n\nChecks if an app with the given bundle ID is installed on the device.\n\n```typescript\nimport { RNLauncherKitHelper } from 'react-native-launcher-kit';\n\nconst result = await RNLauncherKitHelper.checkIfPackageInstalled(\n  'com.android.settings',\n);\nconsole.log(result); // true or false.\n```\n\n### 5. `getDefaultLauncherPackageName: Promise\u003cstring\u003e`\n\nChecks the default launcher app on the device.\n\n```typescript\nimport { RNLauncherKitHelper } from 'react-native-launcher-kit';\n\nconst result = await RNLauncherKitHelper.getDefaultLauncherPackageName();\nconsole.log(result);\n```\n\n### 6. `openSetDefaultLauncher: Promise\u003cboolean\u003e`\n\nOpens the \"Set Default Launcher\" screen on the device.\n\n```typescript\nimport { RNLauncherKitHelper } from 'react-native-launcher-kit';\n\nconst result = await RNLauncherKitHelper.openSetDefaultLauncher();\nconsole.log(result); // true or false.\n```\n\n### 7. `getBatteryStatus: Promise\u003cBatteryStatus\u003e`\n\nReturns the current battery status of the device and if the phone is currently charging or not.\n\n```typescript\nimport { RNLauncherKitHelper } from 'react-native-launcher-kit';\n\nconst result = await RNLauncherKitHelper.getBatteryStatus();\nconsole.log(result); // {\"isCharging\": false, \"level\": 100}\n```\n\n#### `BatteryStatus Interface`\n\n```typescript\ninterface AppDetail {\n  level: number;\n  isCharging: boolean;\n}\n```\n\n### 8. `openAlarmApp: boolean`\n\nOpens the default alarm app on the device.\n\n```typescript\nimport { RNLauncherKitHelper } from 'react-native-launcher-kit';\n\nconst result = await RNLauncherKitHelper.getBatteryStatus();\nconsole.log(result);\n```\n\n### 9. `goToSettings`\n\nOpens the settings screen of the device.\n\n```typescript\nimport { RNLauncherKitHelper } from 'react-native-launcher-kit';\n\nRNLauncherKitHelper.goToSettings();\n```\n\n### 10. Start listening for new App installations\n\nListens for app installations and provides app details when an app is installed.\n\n```jsx\nimport { InstalledApps } from 'react-native-launcher-kit';\nimport { useEffect, useState } from 'react';\n\nconst App = () =\u003e {\n  const [apps, setApps] = useState\u003cAppDetail[]\u003e([]);\n\n  const initApp = async () =\u003e {\n    const appsList = await InstalledApps.getApps({\n      includeVersion: true,\n      includeAccentColor: true,\n    });\n    setApps(appsList);\n  }\n  useEffect(() =\u003e {\n    InstalledApps.startListeningForAppInstallations((app) =\u003e {\n      setApps((prev) =\u003e [app, ...prev]);\n    });\n\n    return () =\u003e {\n      InstalledApps.stopListeningForAppInstallations();\n    };\n  }, []);\n\n  return (\n    // Your component rendering logic\n  );\n};\n```\n\n\n### 11. Start listening for an App removal\n\nListens for app removals (uninstallations) and provides the package name when an app is removed.\n\n```jsx\nimport { InstalledApps } from 'react-native-launcher-kit';\nimport { useEffect, useState } from 'react';\n\nconst App = () =\u003e {\n  const [apps, setApps] = useState\u003cAppDetail[]\u003e([]);\n\n  const initApp = async () =\u003e {\n    const appsList = await InstalledApps.getApps({\n      includeVersion: true,\n      includeAccentColor: true,\n    });\n    setApps(appsList);\n  }\n  useEffect(() =\u003e {\n    InstalledApps.startListeningForAppRemovals((packageName) =\u003e {\n      setApps((prev) =\u003e\n        prev.filter((item) =\u003e item.packageName !== packageName)\n      );\n    });\n\n    return () =\u003e {\n      InstalledApps.stopListeningForAppRemovals();\n    };\n  }, []);\n\n  return (\n    // Your component rendering logic\n  );\n};\n```\n\n## Demo App\n\nReact-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](https://nophonelauncher.canguru.au).\n\n## Example App\n\nYou can experience the functionality of the code by exploring the examples provided in our GitHub repository, which can be accessed from the following [link](https://github.com/louaySleman/react-native-launcher-kit/tree/main/example).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouaysleman%2Freact-native-launcher-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flouaysleman%2Freact-native-launcher-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouaysleman%2Freact-native-launcher-kit/lists"}