isAndroid
isAndroid is a utility function that detects whether the current device is running Android. Notes: - All Android browsers include the token "Android" in the user agent.
Interface
ts
function isAndroid(userAgent: string): boolean;Parameters
- userAgentstring
Optional user agent string to check. Defaults to
navigator.userAgent.
Return Value
- boolean
if the device is running Android,
falseotherwise. Returnsfalseon server
Example
tsx
if (isAndroid()) {
// Android-specific code
enableAndroidOptimizations();
}