Non-visible component that can detect shaking and measure acceleration approximately in three dimensions using SI units (m/s2). The components are:
AccelerationChanged(number xAccel, number yAccel, number zAccel)
Component for using the Barcode Scanner to read a barcode
Non-visible component that provides the instant in time using the internal clock on the phone. It can fire a timer at regularly set intervals and perform time calculations, manipulations, and conversions.
Instants are assumed to be in the device's local time zone. When they are converted to or from milliseconds, the milliseconds for a given Instance are calculated from January 1, 1970 in UTC (Greenwich Mean Time).
Methods to convert an Instant to text are also available. Acceptable patterns are empty string, MM/dd/YYYY HH:mm:ss a, or MMM d, yyyy HH:mm. The empty string will provide the default format, which is "MMM d, yyyy HH:mm:ss a" for FormatDateTime, "MMM d, yyyy" for FormatDate. To see all possible format, please see here.
A note on combining date and time: In order to combine the date from one Instant and the time from another, for example from a DatePicker and TimePicker, extract the parts as text and use the text to create a new Instant.
InstantInTime AddDays(InstantInTime instant, number days)
InstantInTime AddDuration(InstantInTime instant, Duration duration)
InstantInTime AddHours(InstantInTime instant, number hours)
InstantInTime AddMinutes(InstantInTime instant, number minutes)
InstantInTime AddMonths(InstantInTime instant, number months)
InstantInTime AddSeconds(InstantInTime instant, number seconds)
InstantInTime AddWeeks(InstantInTime instant, number weeks)
InstantInTime AddYears(InstantInTime instant, number years)
number DayOfMonth(InstantInTime instant)
Duration Duration(InstantInTime start, InstantInTime end)
number DurationToSeconds(Duration duration)
number DurationToMinutes(Duration duration)
number DurationToHours(Duration duration)
number DurationToDays(Duration duration)
number DurationToWeeks(Duration duration)
text FormatDate(InstantInTime instant, text pattern)
text FormatDateTime(InstantInTime instant, text pattern)
text FormatTime(InstantInTime instant)
number GetMillis(InstantInTime instant)
number Hour(InstantInTime instant)
InstantInTime MakeInstant(text from)
InstantInTime MakeDate(number year, number month, number day)
InstantInTime MakeTime(number hour, number minute, number second)
InstantInTime MakeInstantFromParts(number year, number month, number day, number hour, number minute, number second)
InstantInTime MakeInstantFromMillis(number millis)
number Minute(InstantInTime instant)
number Month(InstantInTime instant)
text MonthName(InstantInTime instant)
number Second(InstantInTime instant)
number Weekday(InstantInTime instant)
text WeekdayName(InstantInTime instant)
number Year(InstantInTime instant)
Non-visible component that can measure angular velocity in three dimensions in units of degrees per second.
In order to function, the component must have its
Enabled property set to True, and the device must have a gyroscope sensor.
ZAngularVelocityproperties will have meaningful values.
GyroscopeChanged(number xAngularVelocity, number yAngularVelocity, number zAngularVelocity, number timestamp)
timestampparameter is the time in nanoseconds at which the event occurred.
Non-visible component providing location information, including longitude, latitude, altitude (if supported by the device), speed (if supported by the device), and address. This can also perform "geocoding", converting a given address (not necessarily the current one) to a latitude (with the
LatitudeFromAddress method) and a longitude (with the
In order to function, the component must have its
Enabled property set to True, and the device must have location sensing enabled through wireless networks or GPS satellites (if outdoors).
Location information might not be immediately available when an app starts. You'll have to wait a short time for a location provider to be found and used, or wait for the OnLocationChanged event
The emulator does not emulate sensors on all devices. Code should be tested on a physical device.
The LocationSensor will be able to locate the device with a varying degree of confidence, based on the quality of satellite, cell towers, and other data used to estimate location. The Accuracy value is the radius in meters around the sensor's detected location. The device has a 68% chance to be located within this radius. More precise location detection will result in a smaller accuracy number, which allows the app to have more confidence where the device is actually located.
If the accuracy is not known, the return value is 0.0
Altitude of the Android device in meters, if available.
Altitude is measured from the World Geodetic System 84 reference ellipsoid, not sea level.
Note that it is difficult for devices to accurately sense altitude. Altitude reported on a phone/tablet can easily be off by 30 meters or more.
Physical street address of the Android device from Google's map database.
The address might not always be available from the provider, and the address reported may not always be of the building where the device is located.
If Google has no address information available for a particular location, this will return No address available.
Determines the minimum distance interval, in meters, that the sensor will try to use for sending out location updates. For example, if this is set to 50, then the sensor will fire a LocationChanged event only after 50 meters have been traversed. However, the sensor does not guarantee that an update will be received at exactly the distance interval. It may take more than 5 meters to fire an event, for instance.
It is also useful to check against Accuracy when using this property. When your device is moving, the accuracy of the detected location is constantly changing.
The device will not change the service provider.
It is possible for a device to switch service providers when the current provider is unable to provide adequate location information. ProviderLocked is a Boolean value: true/false. Set to true to prevent providers from changing. Set to false to allow for automatic switching when necessary.
Determines the minimum time interval, in milliseconds, that the sensor will try to use for sending out location updates. However, location updates will only be received when the location of the phone actually changes, and use of the specified time interval is not guaranteed. For example, if 30000 is used as the time interval, location updates will never be fired sooner than 30000ms, but they may be fired anytime after.
Values smaller than 30000ms (30 seconds) are not practical for most devices. Small values may drain battery and overwork the GPS.
LocationChanged(number latitude, number longitude, number altitude, number speed)
StatusChanged(text provider, text status)
number LatitudeFromAddress(text locationName)
number LongitudeFromAddress(text locationName)
Non-visible component to provide NFC capabilities. For now this component supports the reading and writing of text tags only (if supported by the device)
In order to read and write text tags, the component must
ReadMode property set to True or False
Note: This component will only work on Screen1 of any App Inventor app.
Use an orientation sensor component to determine the phone's spatial orientation.
An orientation sensor is a non-visible component that reports the following three values, in degrees:
OrientationChanged(number azimuth, number pitch, number roll)
A Component that acts like a Pedometer. It senses motion via the Accerleromter and attempts to determine if a step has been taken. Using a configurable stride length, it can estimate the distance traveled as well.
SimpleStep(number simpleSteps, number distance)
WalkStep(number walkSteps, number distance)
A sensor component that can measure the proximity of an object (in cm) relative to the view screen of a device. This sensor is typically used to determine whether a handset is being held up to a persons ear; i.e. lets you determine how far away an object is from a device. Many devices return the absolute distance, in cm, but some return only near and far values. In this case, the sensor usually reports its maximum range value in the far state and a lesser value in the near state. It reports the following value: