This library will return all applications with in Android device
$ yarn add rn-installed-apps
Adding in AndroidManifest.xml
<queries>
<intent>
<action android:name="android.intent.action.MAIN" />
</intent>
</queries>
IOS Not Have Supported
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import br.com.ms.rn_installed_apps.RNInstalledAppsPackage;
to the imports at the top of the file - Add
new RNInstalledAppsPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':rn-installed-apps' project(':rn-installed-apps').projectDir = new File(rootProject.projectDir, '../node_modules/rn-installed-apps/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:implementation project(':rn-installed-apps')
import RNInstalledApps from "rn-installed-apps";
RNInstalledApps.getAllApps().then((data) => {
console.log(data);
});
- I advise using a thread lib react-native-bg-thread