Proximity sensor


#1

Hi,
Two weeks ago I decided to develop an app using NativeScript, and I’m still new to it and still examining it.

I couldn’t find any reference or plug-ins for the built-in for reading the proximity sensors in iPhone or modern Android devices, and this is crucial for my project.

  1. Is there a plugin for nativescript that I can use in urder to read the proximity sensor (for detecting when the phone is close to the ear)?
  2. If there isn’t, can you please refer me to a starter guide for writing platform-specific native-code for such a plugin? (How to write plugins by yourself)

Thanks!!


#2

Kinvey has similar options.


#3

By ‘proximity’ I meant to check if the phone is close to your ear, and not to check nearby places. So Kinvey project is not a good choice unfortunately.


#4

In that case you may try the SensorEventListener.


#5

Thank you.
This is a native Android hardware interface. How can I access it through NativeScript?
Where can I learn how to write plugins for NativeScript?


#6

Refer:
https://docs.nativescript.org/core-concepts/android-runtime/marshalling/java-to-js
https://docs.nativescript.org/plugins/building-plugins