event.communication

Type Event
Revision Release 2025.3721
Keywords communication, parental approval, contact permissions, communicationEvent
See also plugin.ageRange.requestCommunicationPermission()
plugin.ageRange.*

Overview

Communication permission event dispatched in response to plugin.ageRange.requestCommunicationPermission() and background responses.

Properties

event.name

String. The string "communicationEvent".


event.isError

Boolean. true if an error occurred, false otherwise.


event.handle

String. The contact handle (phone, email, or custom ID) from the request.


event.handleKind

String. Type of handle: "phone", "email", or "custom". Android only in responses.


event.questionSent

Boolean. true if the permission request was successfully sent to the parent/guardian. iOS only.


event.isBackgroundResponse

Boolean. true if this is an asynchronous response from a parent/guardian. iOS only.


event.approved

Boolean. true if the parent/guardian approved communication, false if denied.

iOS: Present when isBackgroundResponse is true


event.isSupervised

Boolean. true if user is under supervision (Family Link). Android only.


event.requiresParentalApproval

Boolean. true if communication requires parental approval. Android only.


event.userStatus

String. Supervision status. Android only.

Values: - "supervised" - User is supervised - "approvalPending" - Approval pending - "approvalDenied" - Approval denied


event.platform

String. Platform identifier: "android" or "ios".


event.store

String. App store identifier. Currently only "google" for Android.


event.message

String. Platform-specific informational message.

Android: Explains that Android doesn’t have direct communication approval equivalent.


event.errorMessage

String. Error description if isError is true.


Example

local function ageRangeListener(event)
    if event.name == "communicationEvent" then
        print("Handle:", event.handle)
        
        if event.platform == "android" then
            print("Platform:", event.platform)
            print("Message:", event.message)
            
            if event.isSupervised then
                print("User is supervised")
                print("Requires approval:", event.requiresParentalApproval)
                print("Status:", event.userStatus)
            else
                print("User not supervised")
            end
            
        else
            -- iOS
            if event.questionSent then
                print("Request sent to parent")
                
            elseif event.isBackgroundResponse then
                if event.approved then
                    print("Communication approved")
                else
                    print("Communication denied")
                end
            end
        end
        
        if event.isError then
            print("Error:", event.errorMessage)
        end
    end
end