Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9589] Android: Support modify contact

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-08-06T17:38:13.000+0000
Affected Version/sRelease 2.0.0, Release 2.1.0
Fix Version/sSprint 2012-16 API, Release 3.0.0
ComponentsAndroid
Labelsapi, module_media, parity, qe-testadded
ReporterVishal Duggal
AssigneeHieu Pham
Created2012-06-15T21:52:06.000+0000
Updated2013-12-10T06:08:37.000+0000

Description

Support for modify contact

Comments

  1. Hieu Pham 2012-07-19

    Testing code:
       var photo = Ti.UI.createImageView({
           image: 'KS_nav_views.png'
       }).toBlob();
       
       var person = Ti.Contacts.createPerson({
         firstName: 'Aaron',
         lastName: 'Smith',
         date: {
           anniversary: ['2002-11-11T11:23:30.000+0000'],
           other: ['2011-04-02T12:00:00.000+0000']
         }
       }); 
       
       
       person.organization = "google";
       person.phone = {
           mobile: ['9999999991', '1234556677'],
           work: ['9999998888', '1234567789']
         };
       person.address = {
           work:[
             {
               Street: '900 West Drive',
               City: 'New York',
               County: 'Berkshire',
               Country: 'U.S.A',
               ZIP: '99999'
             },
             {
               Street: '456 New Ave.',
               City: 'San Jose',
               State: 'California',
               Country: 'U.S.A',
               ZIP: '94082'
             }
           ],
           home:[
             {
               Street: '2 East Drive',
               City: 'Las Vegas',
               State: 'Nevada',
               Country: 'U.S.A',
               ZIP: '55555'
             }
           ]};
       person.instantMessage = {
           home:[
             {
               service: 'AIM',
               username: 'Dominator'
             },
             {
               service: 'MSN',
               username: 'dominator@msn.com'
             }
           ],
           work:[
             {
               service: 'Facebook',
               username: 'Dominator2'
             }
           ]
       };
       person.url = {
           homepage: ['www.myspace.com'],
           work: ['www.apple.com', 'www.yahoo.com']
       };
       person.email = {
           home: ['hieu@google.com'],
           work: ['pham@google.com', 'hp007@appcelerator.com']
       };
       person.relatedNames = {
           parent: ['daddy', 'mommy'],
           assistant: ['mayhem']
       };
       person.date = {
           anniversary: ['2022-11-11T11:23:30.000+0000'],
           other: ['2003-04-02T12:00:00.000+0000']
       };
       person.firstName = "Ade";
       person.lastName = "Crude";
       person.birthday = "1999-01-01T12:00:00.000+0000";
       person.organization = "GOOGLE";
       person.note = "NOTE: MASS EFFECT";
       person.nickname = "NICKNAME: THOR";
       person.image = photo;
       Ti.Contacts.save([person]);
       
    1. Run this code 2. Look at contact and see if fields are populated correctly
  2. Michael Gangolf 2012-07-21

    [ERROR][V8Exception( 581)] Exception occurred at app.js:85: Uncaught TypeError: Object # has no method 'save' using Titanium 2.2.0 (2012/07/20 17:01 c08a3ae)
  3. Michael Gangolf 2012-08-13

    example is working with 2.2.0 b20120810194112! But when I try to read person.fullName I always get an empty string now!
  4. Hieu Pham 2012-08-21

  5. Michael Gangolf 2012-09-18

    strange behavior: inside my emulator I can download photos from facebook and save them to the person. Using the same program on my phone will save the wrong photo to a person Emulator: [INFO] Titanium SDK version: 3.0.0 (09/17/12 23:41 5486a27) Android 4.0.4 Phone: SGS2 Android 4.1.1 Download function
       function downloadImage(_p,_id){
       // p = ti.contact.person
       // id = facebook id
       
       	var fbUserIcon = "http://graph.facebook.com/"+_id+"/picture?type=normal"
       	var xhr = Titanium.Network.createHTTPClient();
               xhr.open('GET', fbUserIcon, false);
               xhr.send();
           
           
           xhr.onload = function() {
       	    if (xhr.readyState == 4) {
       	    	_currentUser = _p;
                   	var f = Ti.Filesystem.getFile(_dir,_p.fullName +".jpg");
                   	f.write(xhr.responseData);
                   	_photoURL = f;
                   	var photo = Ti.UI.createImageView({ image: f,width:100,height:100 });
                   	_lbl.text = _p.fullName+"\n"+f.nativePath;
                   	_win_main.add(photo);
       	    }
       	}	
       }
       
    Saving:
       var photo = Ti.UI.createImageView({ image: _photoURL,width:100,height:100 });
       _currentUser.image = photo.toBlob();
       Ti.Contacts.save([_currentUser]);
       
    It displays the correct name and image on the screen but when I have a look at my contacts afterwards (on the phone) they are all mixed up
  6. Tamila Smolich 2012-11-13

    Closing issue. All fields are populated correctly. Tested and verified on: Titanium Studio, build: 3.0.0.201211121907 Titanium SDK, build: 3.0.0.v20121113111657 Device: Samsung Galaxy SIII (4.0.4)
  7. Shameer Jan 2013-12-10

    Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/5021

JSON Source