Page 1 of 1

General Question about accessing Android Hardware

Posted: Mon Jan 01, 2018 9:36 pm
by DolphinTech
Hello, and a happy new everybody!
Since I managed it to set up the android development environment, a couple of questions came up concerning the control of the Android hardware and general about LiveCode apps.
I decided to list this questions all in one single post, not to spam the forum.

1.Is it possible, and if yes, how, to switch the camera flash of the phone on and off?

2.How exactly do the Requirements and Restrictions and Application Permissions in the Standalone Application settings work? What are these items exactly?

3.I have an app that says it uses a light sensor (it measures Light in Lux). Is it possible to access this sensor with LC or is this a workaround with the camera?

4.I also have an app that seems to use the Rotation sensor of my device. However, mobileSensorAvailable("rotation rate") returns false. I don't really even know if my mobile has got such a sensor. I could also think of a workaround that takes the acceleration sensor and performs some triangulation to get the angle relative to gravity

5.I have the fullscreenmode set to "exactFit", which works pretty well for me. Except for circular and square shapes, such as the analogue clock widget.
How can I make it circular again? (I tried "set the width of me to the height of me", but that doesn't work)

Thank you band have a happy new year!

Re: General Question about accessing Android Hardware

Posted: Tue Jan 02, 2018 5:26 pm
by MaxV
DolphinTech wrote:
Mon Jan 01, 2018 9:36 pm

1.Is it possible, and if yes, how, to switch the camera flash of the phone on and off?
Probably the the commercial versions, Indy or business. They have advanced camera support. Unfortunately these advaced features are not public, so you have to ask directly to livecode company. ( support@livecode.com )
DolphinTech wrote:
Mon Jan 01, 2018 9:36 pm
2.How exactly do the Requirements and Restrictions and Application Permissions in the Standalone Application settings work? What are these items exactly?
For example, if you click that your app REQUIRES accelarators, devices without accelarators will not install the app. If you click NEED, phones without accelerators will warn users that the app could not work with the device.
DolphinTech wrote:
Mon Jan 01, 2018 9:36 pm
3.I have an app that says it uses a light sensor (it measures Light in Lux). Is it possible to access this sensor with LC or is this a workaround with the camera?
Ask to support@livecode.com , I don't know any public function that talk with the phone light sensor
DolphinTech wrote:
Mon Jan 01, 2018 9:36 pm
4.I also have an app that seems to use the Rotation sensor of my device. However, mobileSensorAvailable("rotation rate") returns false. I don't really even know if my mobile has got such a sensor. I could also think of a workaround that takes the acceleration sensor and performs some triangulation to get the angle relative to gravity
Phones have accelerators, one per axis (x, y, z). The accelerators give you the idea of phone position in your hands. No phones have "rotation" sensor. See rotationRatechanged
DolphinTech wrote:
Mon Jan 01, 2018 9:36 pm
5.I have the fullscreenmode set to "exactFit", which works pretty well for me. Except for circular and square shapes, such as the analogue clock widget.
How can I make it circular again? (I tried "set the width of me to the height of me", but that doesn't work)
The simplest way is set to fullscreenmode to letterbox or showall. See: fullScreenMode

Re: General Question about accessing Android Hardware

Posted: Tue Jan 02, 2018 9:18 pm
by jacque
Just to add to what MaxV said: if you indicate the app requires a sensor, it won't appear in the Play Store for a user if their device does not have that sensor. As Max said, if you say the sensor is needed, the user will get a warning. However if you do not specify any option (leave the N/A option selected in standalone settings) then the app will appear in the Play Store regardless of the device and the user can download it. The app will still work with devices that have the sensor. It will fail (silently, I believe) if the device does not have the sensor and a script tries to use it.

The "exactFit" fullscreenMode stretches the card contents to fit the current screen. You will get significant distortion on devices that have different screen ratios from the one you developed for. Since the content is stretched, circles become ovals, etc. Choose a fullscreenMode that retains the original card ratio. For mobile, this is most often either showAll or noBorder.

ShowAll will fit the height of the card to the device height and adjust the width to retain the ratio. This can result in side clipping or side borders but is usually what I choose. It works fine as long as you keep all the card content in the center area of the screen and allow for a variable side border.

NoBorder does a similar thing, but it fits the sides to the width of the screen and adjusts the height.