We don't want to save it (in case it's outdated by the time we have to use it).
So instead we'll retrieve it on app creation.
Basically, we also want to do this in the Beam class
Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_VCARD_URI, lookupKey);
try
{
AssetFileDescriptor fd = getContentResolver().openAssetFileDescriptor(uri, "r"); // TODO: is context. needed?
FileInputStream fis = fd.createInputStream();
byte[] b = new byte[(int) fd.getDeclaredLength()];
fis.read(b);
Beam.VCARD = new String(b);
Log.d(TAG, vCard);
}
catch (FileNotFoundException e) { e.printStackTrace(); }
catch (IOException e) { e.printStackTrace(); }
We'll need to save the vcard info in a string belonging to the Beam class. That way when we retrieve the vcard info from ContactInfo (in the case that no contact was set yet on app startup), we can pass it to Beam's vcard string so it has it prior to the push. Another option is to save the vcard data in SharedPreferences, and update it on app startup. I'll just use a public static field, I don't think we should save vcard info permanently.
We don't want to save it (in case it's outdated by the time we have to use it). So instead we'll retrieve it on app creation.
Basically, we also want to do this in the Beam class
We'll need to save the vcard info in a string belonging to the Beam class. That way when we retrieve the vcard info from ContactInfo (in the case that no contact was set yet on app startup), we can pass it to Beam's vcard string so it has it prior to the push.
Another option is to save the vcard data in SharedPreferences, and update it on app startup.I'll just use a public static field, I don't think we should save vcard info permanently.