npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bare-navigation-android

v0.1.0

Published

Android back gesture/button handler for the Bare runtime

Readme

bare-navigation-android

Android back gesture/button handler for the Bare runtime.

Intercepts the Android system back gesture/button, prevents the OS default behaviour, and emits a JS back event. Once a back listener is registered the OS default is fully suppressed. Use close() to explicitly finish the Activity.

Requires minSdk 33 and android:enableOnBackInvokedCallback="true" in your manifest.

Installation

npm install bare-navigation-android

No manual Java setup required — the companion DEX is compiled and included in the prebuilds, and bare-link picks it up automatically when packaging with bare-build.

Android manifest

Add enableOnBackInvokedCallback to your <application> tag. Without it, edge-swipe gestures are not intercepted (button presses still work):

<uses-sdk android:minSdkVersion="33" android:targetSdkVersion="36" />
<application
    android:enableOnBackInvokedCallback="true"
    ...>

Usage

const BackHandler = require('bare-navigation-android')

BackHandler.on('back', () => {
  if (myRouter.canGoBack()) {
    myRouter.goBack()
  } else {
    BackHandler.close()
  }
})

// Remove a listener
BackHandler.off('back', listener)

// Explicitly close the app (required once a back listener is active)
BackHandler.close()

API

BackHandler.on('back', listener) / BackHandler.addListener('back', listener)

Register a listener for the Android back gesture/button. The first call suppresses the OS default behaviour for the lifetime of the process.

BackHandler.off('back', listener) / BackHandler.removeListener('back', listener)

Unregister a listener.

BackHandler.close()

Finish the Android Activity. This is the only way to close the app once a back listener is active, since the OS default is suppressed.

Building

Uses bare-make for compiling the native bindings. The prebuilds also include a companion DEX for the BackHandlerBridge Java helper.

Native binding

bare-make generate --platform android --arch arm64 -D ANDROID_PLATFORM=android-34 -D ANDROID_STL=c++_shared
bare-make build
bare-make install

Companion DEX

After building, compile BackHandlerBridge.java to DEX and place it in the prebuild companion directory:

javac -source 11 -target 11 \
  -cp $ANDROID_HOME/platforms/android-34/android.jar \
  android/BackHandlerBridge.java -d /tmp/bnh-classes

d8 --release \
  --lib $ANDROID_HOME/platforms/android-34/android.jar \
  --output prebuilds/android-arm64/bare-navigation-android \
  /tmp/bnh-classes/bare/navigation/android/BackHandlerBridge.class \
  "/tmp/bnh-classes/bare/navigation/android/BackHandlerBridge\$1.class"

License

Apache-2.0