# Device Blocks

## Overview

Device blocks allow you to access device-specific capabilities, such as sensors, camera functionalities, or location services. By utilizing device blocks, you can create apps that leverage the unique features of the device, enhancing user experiences by incorporating functionalities tailored to the device's capabilities.

## Vibrate

This block causes the device to vibrate.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MUiCL8V8AI_-tuc3Oq0%2F-MUiCz3ysOQJDqbgj7r0%2Fvibrate.png?alt=media&#x26;token=98fa6993-30b3-4407-8fad-b03bdc0e2f33" alt="" width="188"></div>

## Current Time and Date

This block returns the current time or date in numerical format (e.g. January is returned as month = 1).&#x20;

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FoieX6KqO7TH7mZFY4RjG%2Fdevice%20block%20-%20current%20hour%20-%20menu%20expanded.png?alt=media&#x26;token=8b919a08-7df4-4122-af1b-44b41d49aabb" alt="" width="178"><figcaption></figcaption></figure></div>

If you want to convert the numbers into words, we suggest adding a [local table data source ](https://docs.thunkable.com/getting-started/data-sources/data-sources-3)and simple tables like the ones below.

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FZqV7rFgsUZMg8TaPxpO8%2Fdevice%20blocks%20-%20month%20and%20days%20local%20DA.png?alt=media&#x26;token=52c6881a-d4dd-49ec-af7d-5ffc85d785c9" alt="" width="375"><figcaption></figcaption></figure></div>

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FyujLQUH6wqfAkNpR6kQ3%2Fdevice-ex.png?alt=media\&token=85a2482c-7438-422e-9558-1b572714c4ff)

## Get Seconds since 1970

This block measures seconds since 00:00:00 UTC on 1 January 1970. This timestamp is also known as Unix time or Epoch time. You can learn more about its use in computer programming here: [Unix time Wikipedia page](https://en.wikipedia.org/wiki/Unix_time).

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MUiCL8V8AI_-tuc3Oq0%2F-MUiDjFq8zzFsnDbrgQo%2Funix.png?alt=media&#x26;token=ea0dd1f1-e012-47b0-a32c-cc9a6b2c6136" alt="" width="375"></div>

## Device is Online?

This block checks the device's online/offline status. This is helpful if you want to provide a different experience depending on whether the user is online or not. This block returns true or false.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2Fwg8SiiToPeYAAB8ldGgy%2Fdev-online.png?alt=media&#x26;token=d765c1ae-ec46-4cce-95d3-073ff5e8ef26" alt="" width="563"></div>

## Get Screen Height or Width

This block returns the height or width of the screen running the app in pixels.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MUiCL8V8AI_-tuc3Oq0%2F-MUiEaqZJzbm5C50j9Od%2Fsize.png?alt=media&#x26;token=23261fbd-ac5c-4535-9e16-f0db294cbbe7" alt="" width="375"></div>

## Platform is \[X]?

This block gets the device's mobile operating system. This is helpful if you want to modify the user experience depending on the user's mobile operating system. This block returns true or false.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MUiCL8V8AI_-tuc3Oq0%2F-MUiFEQPaJpnvK0hkxwf%2Fplatform.png?alt=media&#x26;token=81e5b24f-38be-430a-a787-44771202245a" alt="" width="375"></div>

## Dismiss Keyboard

This block allows you to dismiss the device keyboard for the user.&#x20;

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FKxvNjAqEJx2KXF3oKzqT%2Fdev-dismiss.png?alt=media&#x26;token=0a4ed288-f549-41de-a370-8b183799ce82" alt="" width="375"></div>

## Keep Screen Awake

Some devices automatically go to sleep if there is no user activity in an app for a certain period. The "set keep screen awake to" block keeps the screen awake even if the user is not actively interacting with the app. This block can be set to true or false.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MUiCL8V8AI_-tuc3Oq0%2F-MUiFn7as9ECKEa8lr7H%2Fawake.png?alt=media&#x26;token=55049d80-d7fa-4b2c-838c-43b1d7d5e74b" alt="" width="375"></div>

## Is Device Color Scheme?

Having dark and light modes available is a popular choice for apps and device operating systems. This block detects whether the user's device is set to a light or dark color theme. You can then use blocks to change the color scheme of components in your app to match the user's preferences. This block returns true or false.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MUiCL8V8AI_-tuc3Oq0%2F-MUiGW9TSrNdzC8IIf0B%2Ftheme.png?alt=media&#x26;token=7a268279-cf66-4fc2-8893-57f005442a0f" alt="" width="375"></div>
