Hello all, I would like to play around with the expo home activity of my application. When I start it, i get a list of my projects some profile stuff and also the qr-scanning option. When I click on it, the runtim-permission for accessing the camera will be executed. This seems to be this part here:
var a=r(s[0]);t.default=function(){var e,r;return regeneratorRuntime.async(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,regeneratorRuntime.awrap(a.Permissions.askAsync(a.Permissions.CAMERA));case 2:return e=n.sent,r=e.status,n.abrupt("return",'granted'===r);case 5:case"end":return n.stop()}},null,this)}},1174,[27]);
I ve also seen a contacts API over here:
regeneratorRuntime.awrap(s.NativeModules.ExponentContacts.getContactsAsync({pageSize:n,pageOffset:r,fields:o}));
If I understand it correclty, this is the core file and the execution looks like this:
async function showFirstContactAsync() {
// Ask for permission to query contacts.
const permission = await Expo.Permissions.askAsync(Expo.Permissions.CONTACTS);
if (permission.status !== 'granted') {
// Permission was denied...
return;
}
const contacts = await Expo.Contacts.getContactsAsync({
fields: [
Expo.Contacts.PHONE_NUMBERS,
Expo.Contacts.EMAILS,
],
pageSize: 10,
pageOffset: 0,
});
if (contacts.total > 0) {
Alert.alert(
'Your first contact is...',
`Name: ${contacts.data[0].name}\n` +
`Phone numbers: ${JSON.stringify(contacts.data[0].phoneNumbers)}\n` +
`Emails: ${JSON.stringify(contacts.data[0].emails)}`
);
}
}
Is there a possiblity to play around with this? For example before I open the camera, the first contact within my phone should be printed in form of an alert box?