Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

ngCordova Contacts sometimes shows duplicates

$
0
0

I am using the contacts plugin and then showing a list of contacts from a user search form. On some devices it shows the same user twice if they have multiple phone #'s in the system. On other devices it only shows one. I would like it to only show one on all devices. (If this is not possible I at least want access to the second phone #. Right now the duplicates show the exact same phone #). Here is a snippet of my code to only show users with Al in the name.
`

$scope.getAllContacts = function(searchQuery) {    
try{
					var opts = {                                           //search options
					  filter : searchQuery,                                          // 'Bob'
					  multiple: true,                                      // Yes, return any contact that matches criteria
					  fields:  [ 'displayName', 'name' ]
					};
					if(ionic.Platform.isAndroid()){
						opts.hasPhoneNumber = true;         //hasPhoneNumber only works for android.
					};

				$scope.isLoadingShow=0;
				$ionicLoading.show();

				$cordovaContacts.find(opts).then(function (contactsFound) {
				  $scope.contacts = contactsFound;
				  $scope.isLoadingShow=1;
				  $ionicLoading.hide();
				});
			}catch(err){
				alert(err.message);
			}
		};

		$scope.getAllContacts("Al"); `

Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>