We have moved to a new Sailfish OS Forum. Please start new discussions there.
4

How to grant permission and read contacts on Sailfish OS

asked 2019-10-21 06:33:56 +0200

vanho gravatar image

updated 2019-10-21 11:46:52 +0200

We are developing an application to send message on Sailfish OS and we don't know how to grant permission for our app can access to contact service and read contact list to can get some information Phone, Name,...

Question 1: Can we access to contacts app from our app?

Question 2: If Yes, Can you guide or share link document for us? Is there an example?

Note: For Android OS, we can easy to implement it (https://developer.android.com/training/contacts-provider/retrieve-names)

Thank you very much.

edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted
2

answered 2019-10-21 13:46:58 +0200

zuyev gravatar image

Good day!

Look here but in Russian https://habr.com/ru/post/329692/

edit flag offensive delete publish link more

Comments

Many thanks for your information! It works well :)

Thanks again.

vanho ( 2019-10-21 15:04:14 +0200 )edit

Hello Mr. Zuyev,

Today, when I was building the project, I encountered some errors.

ERROR [/usr/share/harbour-app-name/qml/pages/ContactModel.qml] Import 'org.nemomobile.contacts 1.0' is not allowed
INFO [harbour-app-name] Please see our FAQ here: https://harbour.jolla.com/faq#QML_API
FAILED

Requires
========
ERROR [nemo-qml-plugin-contacts-qt5] Dependency not allowed
INFO [harbour--app-name] Please see our FAQ here: https://harbour.jolla.com/faq#2.6.0 how to use '__provides_exclude_from' and '__requires_exclude' .spec file to avoid that
FAILED

I tried modifying the .spec file but still got the same error. Do you know the reason?

# >> macros
%define __provides_exclude_from ^%{_datadir}/.*$
# list here all the libraries your RPM installs
%define __requires_exclude ^nemo-qml-plugin-contacts-qt5.*$
# << macros

I appreciate your help and look forward to your response.

Thank in advance!

vanho ( 2019-10-24 08:17:04 +0200 )edit

Good day!

Remove the line from the yaml-file from Requires: - nemo-qml-plugin-contacts-qt5

In the editor in line 'import org.nemomobile.contacts 1.0' an error will be displayed QML module not found ...At the same time the application is functional and can be placed on https://harbour.jolla.com

It all worked because nemo-qml-plugin-contacts-qt5 (nemo-qml-plugins-calendar-qt5) was pre-installed on the device. If the application is installed on the device for the first time, it does not work.

zuyev ( 2019-10-24 21:50:26 +0200 )edit
Login/Signup to Answer

Question tools

Follow
5 followers

Stats

Asked: 2019-10-21 06:33:56 +0200

Seen: 523 times

Last updated: Oct 21 '19