General Question about accessing Android Hardware

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
DolphinTech
Posts: 10
Joined: Thu Dec 28, 2017 1:33 pm

General Question about accessing Android Hardware

Post by DolphinTech » Mon Jan 01, 2018 9:36 pm

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!

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: General Question about accessing Android Hardware

Post by MaxV » Tue Jan 02, 2018 5:26 pm

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
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: General Question about accessing Android Hardware

Post by jacque » Tue Jan 02, 2018 9:18 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Android Deployment”