
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
Made changes from SkyzohKey. API to install, uninstall, get version, check presence of a package, or fetch installed packages on Android.
Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag on Android 8.0 +A react-native library to get various informations about an Android app.
$ yarn add rn-apk
$ react-native link rn-apk
android/app/src/main/java/[...]/MainActivity.javaimport be.skyzohlabs.rnapk.ReactNativeAPKPackage; to the imports at the top of the filenew ReactNativeAPKPackage() to the list returned by the getPackages() methodandroid/settings.gradle:
include ':rn-apk'
project(':rn-apk').projectDir = new File(rootProject.projectDir, '../node_modules/rn-apk/android')
android/app/build.gradle:
compile project(':rn-apk')
As of SDK version 24 (7.0) Android requires you to set up a Fileprovider for installing apks. To do so add the following to your AndroidManifest.xml file:
<application>
...
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
</application>
In android/app/src/main/res/xml folder (create it if it does not exist) add a file named filepaths.xml and paste the following contents:
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Select one of the following based on your apk location -->
<cache-path name="cache" path="/"/>
<!-- <files-path name="name" path="/" /> -->
<!-- <external-path name="name" path="/" /> -->
<!-- <external-files-path name="name" path="path" /> -->
<!-- <external-cache-path name="name" path="path" /> -->
<!-- <external-media-path name="name" path="path" /> -->
</paths>
In the above make sure your path is set correctly according to where your apk is on the device.
The example above shows a fileprovider for an app local cache directory i.e something like:
/data/user/0/com.your.packagename/cache
For more info read the android documentation: (https://developer.android.com/reference/kotlin/androidx/core/content/FileProvider)
If the file you are trying to install is on external storage you will need the read and write external storage permissions in your AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
For Android SDK version 26 (8.0.0) and higher you may also be required to add the install packages permission:
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
import ReactNativeAPK from "rn-apk";
// Install an app:
ReactNativeAPK.installApp("path/to/apk-release.apk");
// Uninstall an app:
ReactNativeAPK.uninstallApp("org.package.name");
// Fetch if an app is installed on the device:
ReactNativeAPK.isAppInstalled("org.mozilla.klar", installed => {
console.log("Is app installed?", installed);
});
// Get version of an installed app:
ReactNativeAPK.getAppVersion("org.mozilla.klar", version => {
console.log("App version", version);
});
// Get ALL the apps installed on the device:
ReactNativeAPK.getApps(apps => {
console.log(apps);
});
// Get apps the user has EXPLICITLY installed on the device:
ReactNativeAPK.getNonSystemApps(apps => {
console.log(apps);
});
// Run an application:
ReactNativeAPK.runApp("org.mozilla.klar");
FAQs
Made changes from SkyzohKey. API to install, uninstall, get version, check presence of a package, or fetch installed packages on Android.
The npm package rn-apk receives a total of 13 weekly downloads. As such, rn-apk popularity was classified as not popular.
We found that rn-apk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.