【问题标题】:Android: Not able to add jobTitle field in Contacts using titaniumAndroid:无法使用钛在联系人中添加 jobTitle 字段
【发布时间】:2025-12-01 00:20:10
【问题描述】:

我无法在 Android 联系人中添加 JobTitle 字段。它在 IOS 中运行良好。 这是测试代码。

Ti.Contacts.createPerson({ 
firstName:'ABC', lastName:'DEF', organization :'Appcelerator', jobTitle : 'Developer', 
});
$.index.open();

任何人都知道,还有其他方法可以添加 jobTitle 字段吗?或者我上面的代码有什么问题。? 提前致谢。

【问题讨论】:

    标签: titanium titanium-mobile titanium-android


    【解决方案1】:

    我们可以通过intent在android中添加联系人,下面的代码可能对你有帮助

    if (Titanium.Platform.name == 'android') 
            {
                var intent = Ti.Android.createIntent
                ({
                    action: 'com.android.contacts.action.SHOW_OR_CREATE_CONTACT',
                    data: 'mailto:'+firstName+' '+lastName
                });
                    intent.putExtra('email', email);
                    intent.putExtra('email_type', 'Work');
                    intent.putExtra('phone', mobileno);
                    intent.putExtra('phone_type', 'mobile');
                    intent.putExtra('name', firstName+' '+lastName);
    
                Ti.Android.currentActivity.startActivity(intent);
            }
    

    以下是意图的网址

    http://www.appcelerator.com/blog/2011/10/forging-titanium-episode-9-android-intent-cookbook/

    【讨论】: