A universal module that gets native application information such as its ID, app name, and build version at runtime
Overall
score
98%
Build a device analytics utility that captures and stores device-specific information for app analytics purposes on Android devices.
Create a module that provides device identification functionality:
Device ID Retrieval: Implement a function getDeviceIdentifier() that:
null on non-Android platformsnull if the identifier cannot be retrievedAnalytics Event Logging: Implement a function logAnalyticsEvent(eventName, eventData) that:
deviceId: The device identifier (or null if unavailable)eventName: The name of the eventeventData: Additional event datatimestamp: ISO 8601 timestamp of when the event was loggedPlatform Detection: Implement a function isAndroidDevice() that:
true if running on Androidfalse otherwisegetDeviceIdentifier() function successfully retrieves a device identifier on Android @testgetDeviceIdentifier() function returns null when device identification fails @testlogAnalyticsEvent() function creates event objects with all required fields @testisAndroidDevice() function correctly identifies the platform @test@generates
/**
* Retrieves the unique device identifier for Android devices.
* Returns null on non-Android platforms or if retrieval fails.
*
* @returns {string | null} The device identifier or null
*/
function getDeviceIdentifier() {
// IMPLEMENTATION HERE
}
/**
* Creates an analytics event object with device information.
*
* @param {string} eventName - The name of the event
* @param {object} eventData - Additional event data
* @returns {object} Analytics event with deviceId, eventName, eventData, and timestamp
*/
function logAnalyticsEvent(eventName, eventData) {
// IMPLEMENTATION HERE
}
/**
* Checks if the current platform is Android.
*
* @returns {boolean} True if running on Android, false otherwise
*/
function isAndroidDevice() {
// IMPLEMENTATION HERE
}
module.exports = {
getDeviceIdentifier,
logAnalyticsEvent,
isAndroidDevice
};Provides native application information and device identification.
Install with Tessl CLI
npx tessl i tessl/npm-expo-application