Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Contacts plugin
Started by Scott Harrison Nov 24 2016 08:41 AM

46 replies to this topic
ios android
[TOPIC CONTROLS]
Page 1 of 2 1 2
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,820 posts
  • Enterprise

Contacts

 

View and activate on the Corona Store

This plugins allows you to get all contacts on iOS and Android.

Documentation


  • arashmobileboy likes this

[TOPIC: post.html]
#2

rodrigopalmeira

[GLOBAL: userInfoPane.html]
rodrigopalmeira
  • Enthusiast

  • 50 posts
  • Corona SDK

Hi Scott.

 

Are you sure "contacts.requestAccess(RequestAccessListener)" function are working on Android? It seems not calling the functions.

I've already checked everything, permissions, functions, listeners. It works very fine on iOS, but not on Android.

 

Regards



[TOPIC: post.html]
#3

rodrigopalmeira

[GLOBAL: userInfoPane.html]
rodrigopalmeira
  • Enthusiast

  • 50 posts
  • Corona SDK

It looks like neither of these two functions are working on Android: 

 

+ contacts.get(GetContactsListener)

+ contacts.requestAccess(RequestAccessListener)

local Response = contacts.canAccess()
if (Response == "access granted" or Response == "access granted already") then
    contacts.get(GetContactsListener)  
else 
    contacts.requestAccess(RequestAccessListener)  
end

Obs:. I'm testing sending the APK to device with AndroidDebugKey



[TOPIC: post.html]
#4

Netox

[GLOBAL: userInfoPane.html]
Netox
  • Enthusiast

  • 75 posts
  • Corona SDK

Is it possible to get contacts or phone numbers from call log?



[TOPIC: post.html]
#5

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,820 posts
  • Enterprise

It looks like neither of these two functions are working on Android: 

 

+ contacts.get(GetContactsListener)

+ contacts.requestAccess(RequestAccessListener)

local Response = contacts.canAccess()
if (Response == "access granted" or Response == "access granted already") then
    contacts.get(GetContactsListener)  
else 
    contacts.requestAccess(RequestAccessListener)  
end

Obs:. I'm testing sending the APK to device with AndroidDebugKey

I would check out the sample https://github.com/scottrules44/contacts-demo, by the way contacts.requestAccess only is supposed on android 6.0+

 

Also can you sent me some logs? What android version are you running?

 

https://www.dropbox.com/s/a8vb1i9km8nkn06/File%20Nov%2030%2C%204%2018%2003%20PM.mov?dl=0

 

 

Is it possible to get contacts or phone numbers from call log?

 

no, all or nothing



[TOPIC: post.html]
#6

rodrigopalmeira

[GLOBAL: userInfoPane.html]
rodrigopalmeira
  • Enthusiast

  • 50 posts
  • Corona SDK

The device I'm testing is: Moto X (First Generation) (5.1 Version)

 

Still not working. Neither with your example.

 

The Log keeps looping for a very long time and after some seconds it crashes the app. Look some screens:

 

2ac6073c_45f3_46bd_bdfa_e520a632bc11.jpg


  • howeyweb likes this

[TOPIC: post.html]
#7

rodrigopalmeira

[GLOBAL: userInfoPane.html]
rodrigopalmeira
  • Enthusiast

  • 50 posts
  • Corona SDK

Captura_de_Tela_2016_12_02_a%CC%80s_12_1Captura_de_Tela_2016_12_02_a%CC%80s_12_1Captura_de_Tela_2016_12_02_a%CC%80s_12_1



[TOPIC: post.html]
#8

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,820 posts
  • Enterprise

Thanks for reporting will look into this

[TOPIC: post.html]
#9

rodrigopalmeira

[GLOBAL: userInfoPane.html]
rodrigopalmeira
  • Enthusiast

  • 50 posts
  • Corona SDK

Thank you Scott. I'm really needing this.  ^_^



[TOPIC: post.html]
#10

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,820 posts
  • Enterprise

I believe the problem is your device is a little on the weaker( no offense) so it is unable to handle all the contact data. Also the problem is the contacts api get all gmail contacts, every person you sent an email to is considered a contact. I am going to try to weed out the contacts with emails for names by say if it has an @ as a title name it is going in the trash. Hope this does not affect to people, I know very few people who have @ in there contact name.



[TOPIC: post.html]
#11

rodrigopalmeira

[GLOBAL: userInfoPane.html]
rodrigopalmeira
  • Enthusiast

  • 50 posts
  • Corona SDK

Scott. Thank you for your quick response, but I ensure you its not because of the Moto X device. I've tested in another ones and occurs the same issue.

I cant deploy an app with the possibilitie of not working in most of them. 

Im very anxious to use this plugin on Android without any problems.  

I hope your next updates make it work nicely.

 

I really need this quickly. My neck is in price in the company I work haha. I've promissed to update the app with this this next week  :blink:



[TOPIC: post.html]
#12

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,820 posts
  • Enterprise

what version of corona are you running?



[TOPIC: post.html]
#13

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,820 posts
  • Enterprise

just tested this it looks like my contacts plugin does not like newest version corona sdk



[TOPIC: post.html]
#14

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,820 posts
  • Enterprise

please test with https://developer.coronalabs.com/release/2016/2987/



[TOPIC: post.html]
#15

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,820 posts
  • Enterprise

Also please post your build.setting and corona sdk version number.

[TOPIC: post.html]
#16

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,820 posts
  • Enterprise

Sorry to ask lots of questions do your any of contacts use any weird symbols? Can you use the corona terminal for logs? For all I know those logs could come from another app.

[TOPIC: post.html]
#17

howeyweb

[GLOBAL: userInfoPane.html]
howeyweb
  • Observer

  • 20 posts
  • Corona SDK

Not working for me. Switched back to version 2987 which stopped the RunTime. Then had to manually activate the contact persion in the settings. Now when I tap I get nothing. So disappointed



[TOPIC: post.html]
#18

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,820 posts
  • Enterprise

Not working for me. Switched back to version 2987 which stopped the RunTime. Then had to manually activate the contact persion in the settings. Now when I tap I get nothing. So disappointed

 

what are your logs saying? did you use the updated sample? what version of android are you running? I cannot reproduce the error or figure out what the error is I cannot fix it. I cannot guess these errors. 



[TOPIC: post.html]
#19

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,820 posts
  • Enterprise

For everyone who has had problems with android the version a new version should be avaible within about an hour an 30 minutes if everything goes smoothly, sorry for people having problems. I have fixed the following issues

 

  • requestAccess fixed see image bellow
  • faster loading due to removing unwanted contacts don't have real names and just emails for names

If you have an issue please include the following

 

*sample =https://github.com/scottrules44/contacts-demo

  • device logs that generated from *sample code or project used see https://docs.coronalabs.com/guide/basics/debugging/index.html#device-debugging-android
  • screen shot or video of error
  • version of android, device name, corona version
  • if you make a tiny change to the *sample or use your own project, please post the full project not just the main.lua i mean zip it up post via dropbox, corona forums file uploader, google drive, etc.
  • describe what you did, example "I touch the request access button and then i tried to get contacts"

Sorry for having to post this but saying there is an error is not very helpful. 

 

Screen%20Shot%202016-12-03%20at%2012.19.



[TOPIC: post.html]
#20

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,820 posts
  • Enterprise

Just tested android 7.0, 4.4, 5.1, and 6.0 everything seems to be working fine.



[TOPIC: post.html]
#21

howeyweb

[GLOBAL: userInfoPane.html]
howeyweb
  • Observer

  • 20 posts
  • Corona SDK

what are your logs saying? did you use the updated sample? what version of android are you running? I cannot reproduce the error or figure out what the error is I cannot fix it. I cannot guess these errors. 

 

I watched your video on DropBox. As a windows users I can't hook my phone to the simulator.

You may want to point out that nothing is going to happen when it is working. I was expecting at least a native pop when I tested on my phone. Nothing.

 

After watching your video I added this 

native.showAlert("Contacts", json.prettify(event) , { "OK" })

to 

local function Button1Event( event )

Nice pop showing my contact list.

 

Great Job Scott!

    local function Button1Event( event )
        if ( "ended" == event.phase ) then
            contacts.get(function(event)
            native.showAlert("Contacts", json.prettify(event) , { "OK" })
             --native.showAlert( "Status", tostring(event.status) , { "OK" })
                if event.status == "success" then
                   -- native.showAlert( "Contacts", tostring(event.contacts) , { "OK" })
                end
            end)
        end
    end

 



[TOPIC: post.html]
#22

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,820 posts
  • Enterprise

Sorry, some people have crazy amount of contacts. Putting them all in a native alert is not a smart idea. By the way you should be able to use adb on windows


https://docs.coronalabs.com/guide/basics/debugging/index.html

[TOPIC: post.html]
#23

rodrigopalmeira

[GLOBAL: userInfoPane.html]
rodrigopalmeira
  • Enthusiast

  • 50 posts
  • Corona SDK

Hi Scott. Its seems another error occured testing with your example. Check this out.

 

 

 

2d272cd3_dbd9_4fa4_b5ff_a9e7864a5603.jpg



[TOPIC: post.html]
#24

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,820 posts
  • Enterprise

Hi Scott. Its seems another error occured testing with your example. Check this out.



2d272cd3_dbd9_4fa4_b5ff_a9e7864a5603.jpg


Could I get your full logs?

[TOPIC: post.html]
#25

howeyweb

[GLOBAL: userInfoPane.html]
howeyweb
  • Observer

  • 20 posts
  • Corona SDK

 

I watched your video on DropBox. As a windows users I can't hook my phone to the simulator.

You may want to point out that nothing is going to happen when it is working. I was expecting at least a native pop when I tested on my phone. Nothing.

 

After watching your video I added this 

native.showAlert("Contacts", json.prettify(event) , { "OK" })

to 

local function Button1Event( event )

Nice pop showing my contact list.

 

Great Job Scott!

    local function Button1Event( event )
        if ( "ended" == event.phase ) then
            contacts.get(function(event)
            native.showAlert("Contacts", json.prettify(event) , { "OK" })
             --native.showAlert( "Status", tostring(event.status) , { "OK" })
                if event.status == "success" then
                   -- native.showAlert( "Contacts", tostring(event.contacts) , { "OK" })
                end
            end)
        end
    end

 

 

Scott, nope you can not run the simulator using your phone on Windows. Corona on windows is very limited I just hate using Mac.

 

I have well over 200 contact on my phone. The native pop is great for a single test. I not saying every single use or test. Without the pop a windows user has no idea if your contact plugin is working.

 

How about you supply an updated example showing the first 5 or so contacts. A simple for loop limit 5 or so should work. I think this would help with some of the question you're getting.




[topic_controls]
Page 1 of 2 1 2
 
[/topic_controls]

Also tagged with one or more of these keywords: ios, android