Hall Sensor Intent API Guide
Hall Sensor Intent API Guide
Summary
The Hall Sensor Intent API allows applications to receive broadcast intents and handle hall sensor state
change transitions.
This API is available on Honeywell Android handheld computers that support the hall sensor feature.
Applications may receive the hall sensor state change intents using an Android broadcast receiver without
a Honeywell SDK.
To see if your Android computer supports the hall sensor state change feature, you may plug and unplug
the device from doc or use magnet attach to the hall sensor.
Interface Details
Hall Sensor State Change Intent
This intent is broadcasted immediately when the dock hall sensor(bottom hall sensor) or scan trigger hall
sensor(back hall sensor) changes it’s state.
Action: "com.honeywell.intent.action.HALL_SENSOR_STATE_CHANGE"
Extras
2."hallSensorState"(int):Indicates hall sensor state whether it is Enabled or not. This value sets to
“1” when hall sensor state is enabled otherwise”0”.
using Android.App;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Content.Res;
using Android.Content;
namespace DeviceManagerSample.Droid
{
[Activity(Label = "DeviceManagerSample", Icon = "@drawable/icon", Theme = "@style/MainTheme",
MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize |
ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
public const string HallSensorStateChange =
"com.honeywell.intent.action.HALL_SENSOR_STATE_CHANGE";
private HallSensorStateChangeReciever mHallSensorStateChangeReciever = null;
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
// Register a receiver for HALL sensor state change intent broadcasts.
mHallSensorStateChangeReciever = new HallSensorStateChangeReciever();
IntentFilter intentFilter = new IntentFilter();
intentFilter.AddAction(HallSensorStateChange);
RegisterReceiver(mHallSensorStateChangeReciever, intentFilter);
}
protected override async void OnResume()
{
base.OnResume();
{
DeviceExtrasPage.CurrentDeviceExtrasPage.DisplayStatus("HALL Sensor Status
Changed.");
}
}
public class HallSensorStateChangeReciever : BroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{
if (intent.Action == MainActivity.HallSensorStateChange)
{
string sensorId = intent.GetStringExtra("hallSensorId");
int sensorState = intent.GetIntExtra("hallSensorState", 0);
if (DeviceExtrasPage.CurrentDeviceExtrasPage != null)
{
DeviceExtrasPage.CurrentDeviceExtrasPage.DisplayStatus("HallSensorId = "
+ sensorId);
DeviceExtrasPage.CurrentDeviceExtrasPage.DisplayStatus("HallSensorState =
" + sensorState);
}
}
}
}
}
}