Reputation: 1923
We are creating a TimelineItem with a Voice Call MenuItem. We create a new Contact object and dynamically set the phone number and set the Contact object onto the created TimelineItem. The action fires off as expected, but Glass dials out to a completely different and invalid phone number.
List<MenuItem> menuItemList = new ArrayList<MenuItem>();
menuItemList.add(new MenuItem().setAction("VOICE_CALL"));
// set phone number to call
TimelineItem callTimeline = new TimelineItem();
callTimeline.setCreator(new Contact().setPhoneNumber(property.getMainPhoneNumber()));
callTimeline.setMenuItems(menuItemList);
Is this the appropriate way to set a phone number to a TimelineItem?
Upvotes: 1
Views: 185
Reputation: 2287
It works fine for me, I did it on C#.Net but hope it helps you too.
Create the contact
Contact Amalan = new Contact();
Amalan.PhoneNumber = "+940713429751";
create the time line and set creator as the the contact object we created
TimelineItem contactNumber = new TimelineItem()
{
Text = "Call Amalan",
BundleId = "8081",
Creator = Amalan,
MenuItems = new List<MenuItem>() {
new MenuItem() {Action = "VOICE_CALL"},
new MenuItem() {Action = "DELETE"}},
Notification = new NotificationConfig() { Level = "DEFAULT" },
};
Now insert the card into time line
controller.Service.Timeline.Insert(contactNumber).Fetch();
That's it, It worked fine for me. Don't forget your phone must be paired with your glass
Upvotes: 1