Phantom Contact Account Appearing - Android - android

I am writing an app that allows the user to select from a list of names and then add one of the names (with phone number, etc) to their contacts. When I retrieve my phone's list of Contact Accounts, I am getting 3 results: "Phone", "a000000229aa3e....", "Gmail".
The center result, "a000000229aa3e...." is not an account that I have setup or appears anywhere else on my phone. This also does not appear in the emulator.
My coworker ran it on hit Droid (original Droid) and did not get the odd account. I am running it on a Droid X.
Does anyone know where this Contact Group is coming from? Is there something I need to do to filter this out?
I was able to get the name and type for the odd contact account:
Account Name: a00000229aa3e5-8877431712057062230#random.svcmot.com
Account Type: com.motorola.blur.service.bsutils.MOTHER_USER_CREDS_TYPE

From what I could gather, MOTHER_USER_CREDS_TYPE indicates some sort of Motorola/Provider created account... I ended up filtering this out with !(mAccounts.get(i).getType().toString().contains("MOTHER_USER_CREDS_TYPE")) - I don't know if this will hold up across all devices but it fixed my problem, for the moment.

I don't know all that much about Android apps, but is your phone made by Motorola? or was your previous phone made by Motorola and you copied settings across?
If so it could be a default account, can you see this account when not using your application?

Related

Android phone not displaying SMS sender ID

My Android phone does not show SMS sender ID, for example if one of the friends from my contact list, texts me, my phone will not show the name of the sender (which is saved in my contact list), it just shows the phone number of the sender. But when they call me, my phone shows the caller ID name (as saved in my contact list). Any help fixing this issue will be appreciated.
See if your App has necessary permission
Or
Delete the App data/ reinstall it
Or
Try some other messaging app
Or
Reset your phone
I fixed it. In settings, search for Sync (google contact sync), enable it. That will fix the problem.

How does "Phone" app show information of contacts that are not on the address book?

Background
In the "Phone" app of Google, there is an option "Caller ID & spam" :
So, if you get a call from someone or some organization that isn't on the address book, yet it is identified somehow, you get a name for it, as such (called "+972-035283487") :
Ever since Android M (6.0 - API 23) , apps can replace the default phone app, and then also providing alternative UI when you call someone or get a phone call, by extending InCallService class, as demonstrated here which is based on here.
The problem
I want to try to show the same information as on the Phone app, meaning the name of the person/company in case it identified it (and it's not on the address book).
What I've tried
I tried to dig over the various things that I get via the API of the dialer, but failed:
Various fields and functions of: android.telecom.Call class
There is getDetails inside of the Call class, so I tried to get what's inside there, and there is also statusHints and "label" inside the "statusHints" . None of those had any information (returned null). The reason I tried to look at "statusHints" is because that's what I see on the docs :
Contains status label and icon displayed in the in-call UI.
On the "Phone" app, pressing "Learn more" goes to a website (here) full of links that I think might be sources of the data, but I don't think the app itself uses this. Instead I think it uses something of Google.
The questions
Is it possible to get this CallerId information? If so, how?
How does the Phone app do it? It's supposed to be open sourced, so there has to be something that gives it this information, right? Would cloning it somehow get this information? Maybe Google has its own service for CallerID?
What are the "callDetails" and "statusHints" used for? What do they provide?
I believe Android's native phone app is using Google's place search API. As you can easily search for a place by its phone number and get place details like name, place id, formatted_address and many other fields that you can find in the documentation
Request URL:
https://maps.googleapis.com/maps/api/place/findplacefromtext/json
Request method: GET
Request query parameters:
key: Your application's API key.
input: The text input specifying which place to search for (for example a name or phone number).
inputtype: The type of input. This can be
one of either textquery or phonenumber. Phone numbers must be in
international format (prefixed by a plus sign ("+"), followed by the
country code, then the phone number itself).
Example request:
https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=%2B972035283487&inputtype=phonenumber&fields=place_id,name&key=API_KEY_HERE
Example response:
{
"candidates" : [
{
"name" : "מלך העופות",
"place_id" : "ChIJ78ko1zBKHRURpwbgUdWc4nU"
},
{
"name" : "Of Yaakov",
"place_id" : "ChIJv3myn4FMHRURUGffcXgxKuw"
}
],
"status" : "OK"
}
Note:
Such an API is not available at the current moment in Google places SDK for Android, but you can use the HTTP API directly in your app or you can make an API in the backend as a proxy to the places API. I prefer the later version as in the first solution the API key is deployed in the application code and hackers could decompile the APK and use it for malicious reasons. For security reasons you have to restrict the usage of the API key to the IP address of the server in case you are using the backend solution!
I tried to decompile the Dialer app, couldn't find the specific info about how the app is doing it.
But this info could be useful. Please check it.
In Dialer app, there are classes SpamCallDatabase_Impl.smali SpamCallDatabase.smali
and there is service running in package com.google.android.gms app, which provides spam lists
com.google.android.gms/.telephonyspam.sync.SpamListSyncTaskService
and for caller id check this commit
https://gitlab.e.foundation/e/os/android_packages_apps_Dialer/commit/420eb901ed1d64fdaf055cde4cc46d7a5c0b42fc
This looks dialer app of lineage os
and it uses different services for phone num lookup like
https://auskunft.at/
https://www.dastelefonbuch.de/
I believe Google has its own database of spam callers, and the Phone app sends the number to its server, and if there is a match, it shows the name.
Maybe, if your app can read notifications, there is a possibility to retrieve that name. Try this example out and modify it according to your needs
You could check the working of apps like Truecaller for this. Truecaller acts on a give and take scenario... You want those unknown numbers then you have to part with your phone book contacts.. Now apparently everyone who has installed the app has surrendered his phone book. The data is crowd-sourced from the millions of users who have downloaded the truecaller app on their smart phones. As part of the end user agreement, the truecaller app asks the user to allow access to the user's address book/contacts on the smart phone. This data is then uploaded by the app to the company's servers. After going through several data matching/refining algorithms, this data is made available to all truecaller users to search upon.
Google Phone app is provided a feature of Use caller ID & spam protection by default. Some of these steps work only on Android 6.0 and up.
When you make or get a call with caller ID and spam protection on, you can see information about callers or businesses not in your contacts or warnings about potential spam callers.
To use caller ID and spam protection, your phone may need to send information about your calls to Google.
Turn caller ID & spam protection off or back on
Caller ID and spam protection is on by default. You can choose to turn it off.
To use caller ID and spam protection, your phone may need to send information about your calls to Google. It doesn’t control whether your number shows when you make calls.
Caller ID by Google shows the names of companies and services with a Google My Business listing. It also looks for matches in any directory that shows caller information for work or school accounts.
As per your solution, Google does not provide this kind of support as you want. you need to create your own function and save spam and other contact detail at your side.

FIxing google contacts display fields

I use gsuite and android. Ever since using an international LG phone, they have save names a bit weird.
If I make a contact called
F:Mat
L:Johnson
Then it looks fine on android. When I open https://www.google.com/contacts/ the user would be displayed as JohnsonMat. If I click the ... it will still have the F:Mat
L:Johnson
It's just somehow the display name is backwards and no space.
Now I have about 500 contacts saved from my phone over time and I can't use gmail because it can't find users by F:Mat. The only way to get a name to pop up is to start to type JohnsonM. Firstly I can't remember last names, secondly if I have 20 Johnsons I can't skip them.
Is there some way to fix these via some script?

FQL retrieves empty data set but API explorer does not

There are some similar questions but I believe this is a problem on its own.
I'm using Facebook SDK for Android to get my friends photos listed on the device, and when I use Graph Explorer I actually get the data I wanted but inside my app I get only ONE result.
I first tried to use this FQL
SELECT pid FROM photo WHERE owner = me();
But then I found that table photo is not indexable (this link), so I tried with table album
I even tried with my own photos using this FQL
SELECT pid FROM photo WHERE owner = me() AND aid IN (SELECT aid FROM album WHERE owner = me())
I have all necessary permissions (user_photos,friends_photos,user_friends)
Also I have tried to add some limit, like 2 or 25 to check if that could be the problem.
But still nothing! :(
Any of you Facebook gurus have any idea what is my problem?
Thanks in advance
Answer // edited
Oh well... It seems that 5 hours of waiting is not enough for Facebook servers to propagate the changes and that by adding those permissions I wrote above I managed to get what I needed.
So answer would be (just for test phase, for the real thing you need to wait for Facebook servers to propagate):
Go to Graph API explorer
Open FQL tab (or if you are using Graph API stay where you are)
Click the drop down menu in the right top corner where it says Applications
Choose your app (it should be Graph API explorer by default)
Click Get Access Token button
You will see that you are missing some privileges indeed
Select what you need
Approve it
Test your app again in you development environment
Voila

Reading contacts from phone book in Android

I 'm trying to read and display contacts from phone book in android. My Device is synced up with gmail and funambol which togehter have more than 600 records. Now by default my application reads gmail contacts. On selecting any contact from the displayed list, it throws an exception as the list is displaying a gmail contact which just has email and no phone no.
I need phone no to use in my application.
thanks
Take a look at this answer here. It provides all the detail you need to get the contacts right.
The reason for the crash might be because you are trying to read the phone number when there is none, causing a NullPointerException. Maybe check if it's null before you try and use it, and if it is null then ask the user to pick again.
If this isn't right, feel free to provide more detail like code and logcat logs.

Categories

Resources