![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
react-native-lock-detection
Advanced tools
Let know your app when the phone is locked or not. (iOS & Android)
This is not published in NPM yet, so, if you want to use it you need to download it from GitHub or clone it and follow this:
Go to the folder where you have the library and run:
$ yarn link
After, go to your project folder and run:
$ yarn link react-native-lock-detection
Like this is native, you need to link the library, run:
$ react-native link react-native-lock-detection
In case the previous command doesn't do it's job, follow the next steps:
Libraries
➜ Add Files to [your project's name]
node_modules
➜ react-native-lock-detection
and add RNLockDetection.xcodeproj
libRNLockDetection.a
to your project's Build Phases
➜ Link Binary With Libraries
Cmd+R
)<android/app/src/main/java/[...]/MainActivity.java
import com.talosdigital.reactnative.RNLockDetectionPackage;
to the imports at the top of the filenew RNLockDetectionPackage()
to the list returned by the getPackages()
methodandroid/settings.gradle
:
include ':react-native-lock-detection'
project(':react-native-lock-detection').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-lock-detection/android')
android/app/build.gradle
:
compile project(':react-native-lock-detection')
The usage is differs for each platform:
In iOS is a little harder to use because of the configuration that React Native has for sending events trough the bridge.
import { NativeModules, NativeEventEmitter } from 'react-native'
...
const { LockDetection } = NativeModules
LockDetection.registerforDeviceLockNotif() // Register the library to listen the events for Darwin notifications
const LockDetectionEmitter = new NativeEventEmitter(LockDetection) // Create instance of EventEmitter
this.lockDetectionSuscription = LockDetectionEmitter.addListener( // and add the listener
'LockStatusChange',
newStatus => {
this.setState({ lockStatus: [...this.state.lockStatus, newStatus] }) // Do whatever you need with the information
}
)
...
componentWillUnmount() {
this.lockDetectionSuscription.remove() // Always remove the listener to avoid memory leaks
}
For iOS, once the event has been fired, it sends an object with the following structure
{
"newStatus": "LOCKED"
}
With the value being one of "LOCKED"
or "NOT_LOCKED"
. Note that it sends NOT_LOCKED
instead of UNLOCKED
meaning that it doesn't detect if the phone is unlocked or not. (This is because of the Darwin Notifications)
TODO: write Android documentation
FAQs
Library to detect when the phone is locked or not
The npm package react-native-lock-detection receives a total of 2 weekly downloads. As such, react-native-lock-detection popularity was classified as not popular.
We found that react-native-lock-detection 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
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.