0

When I run sample code "sensorInfo" from RAD Studio, I got zero in Lux Value, then I google for Light Sensor and find out another code but got same value ZERO. What should I do for this situation? Thanks. My phone is Asus Zenfone6 with android 11.

Sample Code form http://www.devsuperpage.com/search/Articles.aspx?G=2&ArtID=90357

type

  TForm1 = class(TForm)
    Label1: TLabel;
    Timer1: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    FHumanProximity: TCustomBiometricSensor; // Declare it
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.FormCreate(Sender: TObject);
var
  LSensorArray : TSensorArray;
  LSensor : TCustomSensor;
begin // Get the sensor list and find that we want
  TSensorManager.Current.Activate();
  LSensorArray := TSensorManager.Current.GetSensorsByCategory(TSensorCategory.Biometric);
  for LSensor in LSensorArray do
    if TCustomBiometricSensor(LSensor).SensorType = TBiometricSensorType.HumanProximity then
      FHumanProximity := TCustomBiometricSensor(LSensor);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin // just poll it
  if FHumanProximity <> nil then
    Label1.Text := FHumanProximity.HumanProximity.ToString;
end;

end.

Light Sensor works good when I run other apk. What should I have to do?

0 Answers0