I am trying to do a direct calling from my application. The labelfield contains a phone number, how do I do a direct call from there? When the user selects the phone number in the labelfield and clicks the green button, it will automatically call the number. Please explain step by step if you don't mind. I'm still learning.
Take a look at Phone class description. It is easy to understand how to use it.
Use the following code:
String phoneNumber = "555234324"; //the number that you wanna call
PhoneArguments call = new PhoneArguments(PhoneArguments.ARG_CALL, phoneNumber);
Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, call);
Related
I have code to fetch and display User data from Contacts (various Name properties plus the array of Phone numbers). By making a CNMutableContact, I can update any of the Name properties. But I can only display Phone numbers (from CNLabeledValue via ".digits"). Is it possible to also update Phone numbers? I can't change "digits" in the CNMutableContact because it is 'read-only'. I have seen and understand cautions on accessing CNLabeledValue "digits", but would still like to proceed.
Suggestions?
Maybe is a little late to answer this question. However, on the given exemple, you can only add phone numbers. So, to update phone you would, at best, replace removing phone numbers and add new ones.
Replacing a phonenumber entry in this approach would result in changing the phonenumber's identifier.
This should be not the behaviour you are expecting, since you are changing a phone number of an existing entry. And we want to keep the phone identifier intact.
You should use settingValue from CNLabeledValue see: Apple Documentation
// Clone to a mutable contact
let mutableContact = contact.mutableCopy() as! CNMutableContact
// Here's the catch
let updatedPhone = mutableContact.phoneNumbers[0].settingValue(CNPhoneNumber(stringValue: "newPhone"))
// Be aware that in this example, I only have on phone number. For multiple phones, would need to handle multiple phones properly in the array.
mutableContact.phoneNumbers = [updatedPhone]
What would be the best way to uniquely identify an MSConversation when developing an iMessages application?
In my case I want to give to a game object an ID of the conversation where it belongs to.
Take the localParticipant ID, add to it the remoteParticipants ID ;)
Something like that :
var conversationID = yourConversation.localParticipantIdentifier
for participant in yourConversation.remoteParticipantIdentifiers {
conversationID += participant
}
EDIT:
As noticed in comments, by doing so, you could end up with a very long ID. So the idea is to apply an hash to it, to have a constant size (MD5 is suffisant, we don't need something secure here). If it is still too long, you could crop that hash, but be aware that in that case there is a small probability for two conversations to have the same ID (depending on how much your crop).
The current top answer has a corruption issue in that if a new person is added to a group chat (or if someone is removed) your hashed ID will change.
A more elegant solution in my opinion is to just create your own serial number at the time of the first message being created and add it as meta-data to your message itself. (Using NSURLComponents of course). Then just grab that anytime a message is opened (thus launching your message app) and use that ID. Just keep it in the header of any message sent/received.
But, it depends on what you are trying to do really. The solution I've provided is great for turn-based multi-player games. It might not be good for other scenarios.
I am having some trouble with this.. I see that we are supposed to be using the property:
predicateForSelectionOfProperty
for determining which properties get 'selected', and I'm actually kind of bummed for there not being a
predicateForEnablingProperty
because I only want phone numbers, for my use case.
That said, nothing I use for predicateForSelectionOfProperty seems to do what I want. What I want is, when I select a contact's phone number, it should call the delegate callback.. but instead, right now, it is calling them!
Maybe I'm just completely missing something, because I would actually rather just have a list of my contacts, with phone numbers, and only show the phone numbers.. maybe I'm not even heading in the right direction with this.
Thanks for any help you can offer!
If you don't want it to call the number, you should:
specify the peoplePickerDelegate; and
implement peoplePickerNavigationController:didSelectPerson:property:identifier:
don't specify a predicateForSelectionOfProperty (or if you do, make sure it returns true, e.g. NSPredicate(value: true))
Obviously, if you don't even want it to show you unrelated information about contacts, specify the displayedProperties array, e.g.
controller.displayedProperties = [NSNumber(int: kABPersonPhoneProperty)]
Alternatively, if you wanted to customize this UI further, you could just use the AddressBook.framework to extract the phone numbers from the address book and present whatever UI you want.
I am new to Parse cloudcode and spinning my wheels to understand JS and write cloudCode to remove user from PFRelation. Can anyone please assist me with parse cloudcode snippet to remove user from PFRelation. I am trying to implement unfriend functionality in the iOS app and I can remove the friend from current users PFRelation and would like to remove current user from the friend PFRelation. I am completely blanked out and don't know how to do that.
I appreciate the help.
Thanks!
The javascript info (that's what you need to do this function on the server) is here: https://parse.com/docs/js_guide#objects-pointers
Specifically, the code on that page that you need is:
var relation = request.user.relation("friends");
relation.remove(other);
request.user.save();
Then you need to get a handle to the other user object and do the same thing there. Are you storing Parse.User objects, or IDs? If it's User objects, the whole code could be this:
var relation = request.user.relation("friends");
var other = relation[0]; // I'm not sure about array indexing though.
var otherRelation = other.relation("friends");
otherRelation.remove(user);
relation.remove(other);
other.save();
request.user.save();
Note that this code isn't really kosher from the perspective of "when the function returns, the logic is done". It's not, since the save is asynchronous. It's faster this way. You could make it both fast and kosher by running both together and waiting for both to finish, but it's been a long time since I've written JavaScript so I can't provide the exact code for that.
Edit: Don't forget to use Parse.Cloud.useMasterKey() to get the right permissions before you try modifying another user.
I'm working with BlackBerry API 7.0 and I'm trying to display a list of countries, each row must display, in the following order, a country flag, the name of the country and a RadioButtonField to indicate the state of selection, something like this:
| -icon- -text- -radio button- |
I've been looking for an example of this kind of control, but haven't found a similar approach.
A RadioButtonGroup only hold RadioButtonFields so, as far as I understand, it isn't what I need.
I know there's the ListField but I haven't found an example of a Manager that implements the look & feel I'm trying to achieve, specially since I have to handle the selection of the RadioButtonField I'm not sure if adding a RadioButtonGroup with a single RadioButtonField to each row is the correct approach (specially since a RadioButtonGroup is not allowed on the Manager class) and if so, how can I handle the state of selection for a radio button on each row?.
What is the best way to implement the design I need? Can this be done with a RadioButtonGroup? Or is it possible to use a custom Manager class for this?
I know that Blackberry has their own API's for various things - and I have absolutely no experience with any of those.
But the standard List class offers a way to use images in your list.
You just have to create two arrays first. One with the string-elements and one with the image-elements.
String[] theStrings = {"1st item", "2nd item", "3rd item"};
try {
image1 = Image.createImage("1stimage.png");
image2 = Image.createImage("2ndimage.png");
image3 = Image.createImage("3rdimage.png");
} catch (Exception e) {}
Image[] theImages = {image1, image2, image3};
int listType = List.IMPLICIT;
List myList = List("List title", listType, theStrings, theImages);
http://docs.oracle.com/javame/config/cldc/ref-impl/midp2.0/jsr118/javax/microedition/lcdui/List.html
(If this answer is completely wrong in relation to BlackBerry API 7.0, then the "java-me" tag should probably be removed from the question).