So wasn't sure how to title this one but I'm hoping someone with Android experience can answer this for me.
I'm trying to turn Android code into App Inventor 2 code. I need to start a new activity and have the relevant Action, ActivityPackage, ActivityClass, DataType, ExtraKey, ExtraValue (whether all of these are needed for this specific situation I'm not sure) to input into an ActivityStarter that views the locally stored phone contacts.
I am sure there is a way, there is in just Android app making with Java but I need help translating that code across. I'm pretty sure I want an android.intent.action.VIEW
and contactsContract.CommonDataKindsPhone
I'm just not sure in which parts in should go and what else I need to than be able to add that information to a list.
This is what I have so far:
I'm sure others would appreciate this information, as well as how to get other related data to contacts into App Inventor 2.
Also I know about ContactPicker.PhoneNumberList
and PhoneNumberPicker.PhoneNumberList
neither of which are able to find any contacts on my phone which is why I'm trying to work out a work-around.
Anyway any help is appreciated,
Thanks.
Unfortunately it's not possible to get a list of locally stored phone contacts with App Inventor. See also issue 734 in the Issues List. I suggest you to star this issue, so probably one day we get this feature into App Inventor.
The ContactPicker.PhoneNumberList
or PhoneNumberPicker.PhoneNumberList
only give you all phone numbers of a contact after picking a contact.
App Inventor has its limitations and unfortunately you can't do something like this as described in this Stackoverflow answer. The only thing you can do is to access the Google Contacts API with the web
component to get a list of contacts, but precondition is, your contacts are synchronized with Google, but this is not what you want. An example to do that you can find here.