xamarin.android - Permission Denied using Xamarin.Mobile to access contact list xamarin.form -


hey day using xamarin.mobile got error on permission denied added read_contacts in androidmanifest , add permission @ runtime. how solve this?

method

    public async task<ienumerable<mobileusercontact>> getallcontacts()     {         if (_contacts != null) return _contacts;          var contacts = new list<mobileusercontact>();         await _book.requestpermission().continuewith(t =>         {             if (!t.result)             {                 log.debug("perm", "permission denied!");                 return;             }             foreach (var contact in _book.where(c => c.emails.any())) // filtering contact's has e-mail addresses             {                 var firstordefault = contact.emails.firstordefault();                 if (firstordefault != null)                 {                     contacts.add(new mobileusercontact()                     {                         contactfirstname = contact.firstname,                         contactlastname = contact.lastname,                         contactdisplayname = contact.displayname,                         contactemailid = firstordefault.address,                         contactnumber = contact.phones.tostring()                     });                 }             }         });          _contacts = (from c in contacts orderby c.contactfirstname select c).tolist();         return _contacts;     } 

looks you'r not asking user permission access contacts.

take in here: https://github.com/jamesmontemagno/permissionsplugin , advise use 1 too: https://github.com/jamesmontemagno/xamarin.plugins/tree/master/contacts


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -