@Dono,
Here’s how I do it. I added a function to get the Permission Status and then proceed accrodingly.
[lua]
local function loadAddressBook()
local PermissionStatus = native.showPopup(“addressbook”, {option = “getPermission”})
local function checkAuthorization()
print(“checkAuthorization is called”)
--alert is displayed if Permission is Denied or Restricted
local function removePermissionAlert(event)
if “clicked” == event.action then
i = event.index
if 1 == i then
--dismiss the alert
– audio.play(EnterButtonSound)
elseif 2 == i then
else
end
end
return true
end
if PermissionStatus == “authorized” then
print("*****Contact Book Permission authorized")
– use your existing params and callback function
native.showPopup( “addressbook”, pickContactOptions )
elseif PermissionStatus == “denied” then
native.showAlert(“Authorization Denied!”, “To allow Authorization, Go to Settings > Privacy > Contacts > Select YourAppName”, {“OK”}, removePermissionAlert)
--do something
elseif PermissionStatus == “requestPermission” then
--if permission is asked for, call the function again to see the requested result
checkAuthorization()
elseif PermissionStatus == “restricted” then
native.showAlert(“Authorization Restricted!”, “Access to the users Contacts is restricted due to parental settings”, {“OK”}, removePermissionAlert)
– do something since permission restricted
else print(“PermissionStatus ==”, PermissionStatus)
end
end
print(“Flag1 PermissionStatus ==”,PermissionStatus)
checkAuthorization()
end
[/lua]
Hope this helps.
Nail