Modify kernel.android.bundle to print contact before camera opened

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?

Hey @epios. I’m not clear on why you’re trying to modify the Home Activity. That’s only used in the main Expo app - it’s not used when you build a standalone app. I think it’s going to be pretty difficult to modify the bundle in that way. If you want to build the client from source you can follow the instructions here: GitHub - expo/expo: An open-source platform for making universal native apps with React. Expo runs on Android, iOS, and the web.

Hi @jesse
https://github.com/expo/expo#modifying-js-code has a mysterious “any changes made in the js directory will not show up without some extra work”.
The question is how to rebuild kernel.|.bundle
There is no instructions on how to do that. Just curious how to rebuild the kernel bundle?
What extra work is required?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.