[Lazarus] lazdeviceapis

Kjow antispammoni at gmail.com
Tue Aug 6 13:52:35 CEST 2013


2013/8/6 Felipe Monteiro de Carvalho <felipemonteiro.carvalho at gmail.com>

> On Tue, Aug 6, 2013 at 12:38 PM, Kjow <antispammoni at gmail.com> wrote:
> > I would use android sensors (vibration, accelerometer, etc) without
> LCLBase,
> > is it possible?.
>
> No. But you can just copy the code from the android implementation of
> lazdeviceapis to your project and adapt it.
>

Hi Felipe,

can you help me to make it working? I made this unit (in attachment) that
compiles and works until I call something (e.g. device.vibrate(100) ).


In MyProjectActivity.java I added, after "onCreate":

public native int LCLOnSensorChanged(int ASensorKind, double[] AValues);

and then almost all "SensorEventListener overrides"

  @Override public void onSensorChanged(SensorEvent event)

...
...
...
  // for LazDeviceAPIs
  public String lcldestination;
  public int lclkind;

I can't find/understand where are used LCLOnSensorChanged, lcldestination,
etc in andriodlcl demo.

Of course, in AndroidManifest.xml I have:

    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
/>
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


I'm hoping my explanation is clear enough.

Thank you,
Kjow
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130806/6c0daf4e/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sensorapi.zip
Type: application/zip
Size: 2669 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130806/6c0daf4e/attachment-0003.zip>


More information about the Lazarus mailing list