Minggu, 17 Maret 2019

Vcard is not being properly received on an Android device Using Twilio api

Backgroud:

I am currently building an app for my company that would send vcards to users. I am using c# to send the messages. I have researched this a bit and found an article which made sense to me Generate VCard and Send Via Twilio I am currently using the vcard which the example gives Sample vcard to create a test code block.

Problem:

I have tested this functionality with my Iphone device and I receive the vcard with out an issue. However, with my other Android phone I do not get the vcard at all. I went ahead and made two examples of using the Twilio sdk and just making an http call. However, they both seem to be having issues with my Android device. Is this a known issue? I am new to the Twilio technology and would appreciate some help.

Code Snippet 1


TwilioClient.Init(account, token);

var mediaUrl = new List<Uri>() {
new Uri("http://www.w3.org/2002/12/cal/vcard-examples/john-doe.vcf")
};
var to = new PhoneNumber("+myNumber");
var message = MessageResource.Create(
to,
from: new PhoneNumber("+twilionumber"),
body: "Test1",
mediaUrl: mediaUrl);

Code Snippet 2


string targeturi = "https://api.twilio.com/2010-04-01/Accounts/" + account + "/Messages.json";
HttpClient hc = new HttpClient();
hc.DefaultRequestHeaders.Authorization = CreateBasicAuthenticationHeader(account,token);
StringContent content = new StringContent(string.Format("From=+twilionumber&To=mynumber&Body=http://www.w3.org/2002/12/cal/vcard-examples/john-doe.vcf&MmsOnly=True"));
content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
HttpResponseMessage hrm = await hc.PostAsync(string.Format(targeturi, account), content);
if (hrm.IsSuccessStatusCode)
{
var stop =0;
}



from Vcard is not being properly received on an Android device Using Twilio api

Vcard is not being properly received on an Android device Using Twilio api Rating: 4.5 Diposkan Oleh: Admin

0 komentar:

Posting Komentar

Popular Posts