[TIMOB-9384] Android: Implementation of createPerson(), adding new contacts into database
GitHub Issue | n/a |
---|---|
Type | Sub-task |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-06-06T14:02:09.000+0000 |
Affected Version/s | Release 2.1.0 |
Fix Version/s | Release 2.1.0, Sprint 2012-12 API |
Components | Android |
Labels | api, parity |
Reporter | Hieu Pham |
Assignee | Hieu Pham |
Created | 2012-06-05T13:03:41.000+0000 |
Updated | 2017-03-06T22:27:50.000+0000 |
Description
Implement createPerson() function, with parity taking into consideration. Test Code:
var photo = Ti.UI.createImageView({
image: 'KS_nav_ui.png'
}).toBlob();
var person = Ti.Contacts.createPerson({
firstName: 'Paul',
lastName: 'Dowsett',
birthday: '2012-01-01T12:00:00.000+0000',
organization: 'Appcelerator',
phone:{
mobile: ['07900 000001', '07900 000002'],
work: ['+44 (0)118 925 6128', '+44 (0)118 000 0000']
},
address:{
work:[
{
Street: '200 Brook Drive\nGreen Park',
City: 'Reading',
County: 'Berkshire',
Country: 'England',
ZIP: 'RG2 6UB'
},
{
Street: '1 St Pauls Road\nClerkenwell',
City: 'City of London',
State: 'London',
Country: 'England',
ZIP: 'EC1 1AA'
}
],
home:[
{
CountryCode: 'gb', // determines how the address is displayed
Street: '2 Boleyn Court',
City: 'London',
State: 'Greenwich',
Country: 'England',
ZIP: 'SE10'
}
]
},
instantMessage:{
home:[
{
service: 'AIM',
username: 'leisureAIM'
},
{
service: 'MSN',
username: 'no_paul_here@msn.com'
}
],
work:[
{
service: 'Facebook',
username: 'seriousAIM'
}
]
},
url:{
homepage: ['www.google.com'],
work: ['www.appcelerator.com', 'www.example.com']
},
email:{
home: ['hi@google.com'],
work: ['three@google.com', 'hp@appcelerator.com']
},
note: 'Hello. The name is James. James Bond',
nickname: 'Superhero',
image: photo,
relatedNames:{
parent: ['dad', 'mom'],
assistant: ['assistant']
},
date: {
anniversary: ['2002-11-11T11:23:30.000+0000'],
other: ['2011-04-02T12:00:00.000+0000']
}
});
Ti.API.info("firstName: should be Paul => " + person.firstName);
Ti.API.info("lastName: should be Dowsett => " + person.lastName);
Ti.API.info("birthday: should be 2012-01-01T12:00:00.000+0000 => " + person.birthday);
Ti.API.info("organization: should be Appcelerator => " + person.organization);
Ti.API.info("mobile phone: should be '07900 000001', '07900 000002' => " + person.phone.mobile[0] + ", " + person.phone.mobile[1]);
Ti.API.info("home Street: should be 2 Boleyn Court => " + person.address.home[0].Street);
Ti.API.info("home instantMessage serviceName: should be AIM, MSN => " + person.instantMessage.home[0].service + ", " + person.instantMessage.home[1].service);
Ti.API.info("work instantMessage: should be [object Object] => " + person.instantMessage.work[0]);
Ti.API.info("homepage url: should be www.google.com => " + person.url.homepage[0]);
Ti.API.info("work url: should be www.appcelerator.com, www.example.com => " + person.url.work[0] + ", " + person.url.work[1]);
Ti.API.info("work email: should be three@google.com, hp@appcelerator.com => " + person.email.work[0] + ", " + person.email.work[1]);
Ti.API.info("note: " + person.note);
Ti.API.info("nickname: " + person.nickname);
Ti.API.info('image: ' + person.image);
Ti.API.info('dad: ' + person.relatedNames.parent[0]);
Ti.API.info('anniverary: ' + person.date.anniversary[0]);
1. Run the above code
2. Go to contacts book and check to see if this contact is created with specified fields
3. Verify correctness of log output.
Closing ticket due to time passed.