Adressbook plugin not working

We made an app 2 years ago that used the Adressbook plugin so we could have the user add company and government phone numbers to their adress book. in the old build that is live on the app stores it still workes. In a new app we are making we are trying to implement the same feature but without any luck. When we call the native.showPopup function with the adressbook settings it shows nothing, does nothing. When I built the old app with a recent daily build it doesnt work either, something changed in corona versions.

For reference I followed the guide on the corona documentation website. 

Corona version: 2017.3103

How do we implement this feature in Corona?

Hi @OCG Studios,

We will need some details. Where doesn’t it work? Which devices and which specific versions of the OS on those devices?

Thanks,

Brent

Hi Brent,

De plugin only works on IOS so, it is on iPhone 6/7. This app shows you a list of emergency responders and you can store these to your local contact list. Devices are updated to the latest OS.

THe previous app we want to update still runs correctly on the device, a new build does not work correctly with the most recent Corona Build.

I hope this is sufficient.

Thanks

Hi @OCG Studios,

Is it possible for you to gather any debug errors/messages? Or create a very basic sample project which we could test with?

Thanks,

Brent

Hi,
 
This is the source that should work (but does not)

BUILD.SETTINGS

[lua]–
– For more information on build.settings, see the Project Build Settings guide at:
https://docs.coronalabs.com/guide/distribution/buildSettings

settings =
{
orientation =
{
– Supported values for orientation:
– portrait, portraitUpsideDown, landscapeLeft, landscapeRight
default = “portrait”,
supported = { “portrait”, },
},


– Android section

android =
{
usesPermissions =
{
“android.permission.INTERNET”,
},
},


– iOS section

iphone =
{
plist =
{
UIStatusBarHidden = false,
UILaunchStoryboardName = “LaunchScreen”,
CFBundleIconFiles =
{
“Icon-40.png”,
“Icon-58.png”,
“Icon-76.png”,
“Icon-80.png”,
“Icon-87.png”,
“Icon-120.png”,
“Icon-152.png”,
“Icon-167.png”,
“Icon-180.png”,
},
NSContactsUsageDescription = “This app would like to access your contacts.”,
},
},


– Plugins section

plugins =
{
[“CoronaProvider.native.popup.addressbook”] =
{
publisherId = “com.coronalabs”
},
},


– Project section

excludeFiles =
{
– Exclude unnecessary files for each platform
ios = { “Icon.png”, “Icon-*dpi.png”, },
android = { “Icon.png”, “Icon-??.png”, “Icon-???.png”, “LaunchScreen.storyboardc”, },
},
}
[/lua]

MAIN.LUA

[lua]-----------------------------------------------------------------------------------------

– main.lua


– Your code here
–require(“addressbook”)

native.showPopup( “addressbook”,
{
option = “newContact”, --“pickContact”, “viewContact”, “newContact”, or `“unknownContact”
–additional options (see below)
firstName = “Jack”,
lastName = “Sparrow”,
}
)[/lua]

Thanks

Hi @OCG Studios,

Thanks, I tested and I’m getting similar results. We’re looking into it further…

Brent

Hi again,

I found out what needs to be done. At some point since the (long) past, permission handling changed somewhat for the plugin. Now, you need to “get permission” before making the other call to “native.showPopup()”, so that the plugin can proceed. So basically, call this before you do other API calls:

[lua]

native.showPopup( “addressbook”, { option=“getPermission” } )

[/lua]

Brent

Hello,

I am a newbie in Corona, and I apologize in advance if jumping in this topic is considered inappropriate here.

My question is very simple:  It looks like accessing contacts is only possible on IOS; is there a possibility to do that on Android also, and if not, are there any plans to provide this?

Thanks,

Michel

The Corona address book plugin is iOS only. However the “Contacts” plugin by community developer Scott Harrison should work on Android and iOS both:

https://marketplace.coronalabs.com/plugin/contacts

Rob

Thanks Rob for the instant answer, and thanks Scott for this plugin that a newbie was able to *instantly* test!

Cheers,

Michel

Hi @OCG Studios,

We will need some details. Where doesn’t it work? Which devices and which specific versions of the OS on those devices?

Thanks,

Brent

Hi Brent,

De plugin only works on IOS so, it is on iPhone 6/7. This app shows you a list of emergency responders and you can store these to your local contact list. Devices are updated to the latest OS.

THe previous app we want to update still runs correctly on the device, a new build does not work correctly with the most recent Corona Build.

I hope this is sufficient.

Thanks

Hi @OCG Studios,

Is it possible for you to gather any debug errors/messages? Or create a very basic sample project which we could test with?

Thanks,

Brent

Hi,
 
This is the source that should work (but does not)

BUILD.SETTINGS

[lua]–
– For more information on build.settings, see the Project Build Settings guide at:
https://docs.coronalabs.com/guide/distribution/buildSettings

settings =
{
orientation =
{
– Supported values for orientation:
– portrait, portraitUpsideDown, landscapeLeft, landscapeRight
default = “portrait”,
supported = { “portrait”, },
},


– Android section

android =
{
usesPermissions =
{
“android.permission.INTERNET”,
},
},


– iOS section

iphone =
{
plist =
{
UIStatusBarHidden = false,
UILaunchStoryboardName = “LaunchScreen”,
CFBundleIconFiles =
{
“Icon-40.png”,
“Icon-58.png”,
“Icon-76.png”,
“Icon-80.png”,
“Icon-87.png”,
“Icon-120.png”,
“Icon-152.png”,
“Icon-167.png”,
“Icon-180.png”,
},
NSContactsUsageDescription = “This app would like to access your contacts.”,
},
},


– Plugins section

plugins =
{
[“CoronaProvider.native.popup.addressbook”] =
{
publisherId = “com.coronalabs”
},
},


– Project section

excludeFiles =
{
– Exclude unnecessary files for each platform
ios = { “Icon.png”, “Icon-*dpi.png”, },
android = { “Icon.png”, “Icon-??.png”, “Icon-???.png”, “LaunchScreen.storyboardc”, },
},
}
[/lua]

MAIN.LUA

[lua]-----------------------------------------------------------------------------------------

– main.lua


– Your code here
–require(“addressbook”)

native.showPopup( “addressbook”,
{
option = “newContact”, --“pickContact”, “viewContact”, “newContact”, or `“unknownContact”
–additional options (see below)
firstName = “Jack”,
lastName = “Sparrow”,
}
)[/lua]

Thanks

Hi @OCG Studios,

Thanks, I tested and I’m getting similar results. We’re looking into it further…

Brent

Hi again,

I found out what needs to be done. At some point since the (long) past, permission handling changed somewhat for the plugin. Now, you need to “get permission” before making the other call to “native.showPopup()”, so that the plugin can proceed. So basically, call this before you do other API calls:

[lua]

native.showPopup( “addressbook”, { option=“getPermission” } )

[/lua]

Brent

Hello,

I am a newbie in Corona, and I apologize in advance if jumping in this topic is considered inappropriate here.

My question is very simple:  It looks like accessing contacts is only possible on IOS; is there a possibility to do that on Android also, and if not, are there any plans to provide this?

Thanks,

Michel

The Corona address book plugin is iOS only. However the “Contacts” plugin by community developer Scott Harrison should work on Android and iOS both:

https://marketplace.coronalabs.com/plugin/contacts

Rob

Thanks Rob for the instant answer, and thanks Scott for this plugin that a newbie was able to *instantly* test!

Cheers,

Michel