Forum Xamarin Xamarin.Android

Set name of incoming caller

MJoehlMJoehl USMember ✭✭

Hi community

I want to sync some contact-informations from our backend to the phone with an app.
We are not allowed to save these contacts on the phone (due to privacy). We can save the data inside our app. But the problem here is, when someone calls me, I see the number but not the name of my contact.

Is there a way I can tell the system that I know the number "1234" relies to the name "Michael" (for example).
If we save these data to the phone or provide it via a ContentProvider, other apps can get the data and save/send them everywhere...

I created a test app which includes a BroadcastReceiver which listens to the Phone-State event/action.
When the phone rings, I am able to get the number, check my internal database and show the name in a toast/activity/notification.
I also know about the option to create a full "calling-screen" by myself, but thats not what I want.

It would be more handy if the name appears on the default native caller-screen, instead of the unknown number.

Is there a way to achive this?

Answers

  • jezhjezh Member, Xamarin Team Xamurai
    edited April 2019

    ContentProvider is a common way to access data from other processes or applications.

    To ensure data security, you can add android:readPermission and android:writePermissionto your ContentProvider.
    For example:

            <provider android:name="MyProvider"
                  android:authorities="cn.com.myapp"
                  android:readPermission="cn.com.myapp.permission.READ"
                  android:writePermission="cn.com.myapp.permission.WRITE"
                    />
    

    When other apps want to use ContentProvider , they must get the permission.

  • MJoehlMJoehl USMember ✭✭
    edited April 2019

    @jezh Thanks for your reply.

    As you said:

    When other apps want to use ContentProvider , they must get the permission.

    That sounds exactly what we were looking for.
    What about the call/contact app of the system? Can the system access the contacts/data, altough the permission is set?

    The user should be able to access our "private-contacts" through the default contact-app, but ohter apps should not have access to it.

Sign In or Register to comment.