B4A Library [class] ContactsUtils - Provides read / write access to the stored contacts

Status
Not open for further replies.

JOTHA

Well-Known Member
Licensed User
Longtime User
Is it possible to get really every information out of my contacts (f.e: spouse, etc.)?
 

JOTHA

Well-Known Member
Licensed User
Longtime User
Thank you Erel ...
 

JOTHA

Well-Known Member
Licensed User
Longtime User
... another problem:
I want to get the first 4 phone numbers from a contact to write them in 4 fields.
The code to get these 4 phone numbers ...
B4X:
For Each phone As cuPhone In ContactsUtils1.GetPhones(Kontakt.Id)
        Dim Kontakte_Telefon_1,  Kontakte_Telefon_2, Kontakte_Telefon_3, Kontakte_Telefon_4 As String
        Kontakte_Telefon_1 = ContactsUtils1.GetPhones(Kontakt.Id).Get(0)
        Kontakte_Telefon_2 = ContactsUtils1.GetPhones(Kontakt.Id).Get(1)
        Kontakte_Telefon_3 = ContactsUtils1.GetPhones(Kontakt.Id).Get(2)
        Kontakte_Telefon_4 = ContactsUtils1.GetPhones(Kontakt.Id).Get(3)
            Log(""&phone.Number&"")
    Next
The result is not the solution which I'm looking for ...
Only in the Log I can get the telephone numbers, but how can I get a result that looks like this:

Kontakte_Telefon_1 = PhoneNumber_1
Kontakte_Telefon_2 = PhoneNumber_2
Kontakte_Telefon_3 = PhoneNumber_3
Kontakte_Telefon_4 = PhoneNumber_4

Any idea?
 

desof

Well-Known Member
Licensed User
Longtime User
ES: Y como es posible agregar un nuevo contacto ?
EN: And how is it possible to add a new contact?
 

beacon

Member
Licensed User
Longtime User
B4A: I can add a new contact to the phone's contacts list successfully with ContactUtils and ContentResolver Ver 1.50.

Is there please a method to add a photograph to a contact?

Thank you.
 

Dogbonesix

Active Member
Licensed User
Longtime User
Is there a way to edit the display name? Especially helpful for typing error. It is reasonably easy to change everything else except the display name.
 

stanks

Active Member
Licensed User
Longtime User
hm i have a permission problem. yesterday my app worked fine but i have upgraded my s7 with official oreo (v8) now i get error msg
B4X:
java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{...} (pid=21476, uid=10403) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
and i have that 2 permission in manifest
B4X:
AddPermission(android.permission.READ_CONTACTS)
AddPermission(android.permission.WRITE_CONTACTS) 'if write access is required

i treid with uninstall "old" version of my app from device then new install but failure too

any idea?

thanks
 

Zlgo

Member
I try this example and in compiling (debug mode) receive this message!
B4X:
B4A Version: 9.80
Java Version: 8
Parsing code.    (0.04s)
Building folders structure.    (0.02s)
Compiling code.    (0.09s)
Compiling layouts code.    (0.00s)
Organizing libraries.    (0.00s)
    (AndroidX SDK)
Generating R file.    (0.01s)
Compiling debugger engine code.    (0.00s)
Compiling generated Java code.    (0.01s)
Convert byte code - optimized dex.    (2.07s)
Packaging files.    (0.60s)
Copying libraries resources    (0.00s)
Signing package file (debug key).    (0.97s)
ZipAlign file.    (0.05s)
Installing file to device.    Error
Performing Push Install
ContactsUtils_RAPID_DEBUG.apk: 1 file pushed, 0 skipped. 2.3 MB/s (1052341 bytes in 0.434s)
    pkg: /data/local/tmp/ContactsUtils_RAPID_DEBUG.apk
Failure [INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE]
 

Zlgo

Member
I have try again this example(ContactuUtils) with B4A 10. and after installation receive same error like member Stanks
B4X:
java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2ForLG from ProcessRecord{2a1aff1 9437:b4a.example/u0a139} (pid=9437, uid=10139) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
In manifest is already this two permissions and Sdk = 28
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…