import { useCallback , useEffect , useState } from 'react' ; import { getLastUpdateTimeAsync } from 'expo-application' ; see https example export function useApplicationAndroidLastUpdateTime ( options = { } ) { const [ applicationLastUpdateTime , setApplicationLastUpdateTime ] = useState < Date > ( ) ; const { get = true } = options ; const getApplicationLastUpdateTime = useCallback ( ( ) => ( getLastUpdateTimeAsync ( ) . then ( setApplicationLastUpdateTime ) ) , [ ] ) ; useEffect ( ( ) => { if ( get ) { getApplicationLastUpdateTime ( ) ; } } , [ get , getApplicationLastUpdateTime ] ) ; return [ applicationLastUpdateTime , getApplicationLastUpdateTime ] ; } export interface ApplicationAndroidLastUpdateTimeOptions { /** If it should fetch the application last update time when mounted, defaults to `true` */ get ? : boolean ; }