I've been trying to add a google contact using the Google Contacts API, that has some custom field that can be modified only by the google application I'm creating while remaining read-only for the user.
The problem is that after use the method and update the contact
https://developers.google.com/gdata/javadoc/com/google/gdata/data/IEntry
void setCanEdit(boolean canEdit)
Sets whether the server allows this entry to be modified by the client.
The field can still be edited from the user that has the email.
Am I using the right method? Does anyone have a sample for similar thing because I couldn't find one on the Internet?
Is it possible to set some access restriction (for example to set contact read-only, or only editable)
Related
I am using Dropwizard 1.2.1 (I know a later version exists) for a project. What I have is a very common situation.
I have an app where a user signs up using his phone number. This creates an entry in my user table with just a phone number.
Now when the user logs in next, I want to retrieve the user details. This scenario is applicable for an existing user who has his/her other details (e.g first name) filled up already.
So my backend does a select * from user where phoneNumber= <phoneNumber> and the mapper tries to map the whole user object something like the following :
return new User(resultSet.getString("first_name"), resultSet.getString("middle_name"), resultSet.getString("last_name"), resultSet.getString("phone_number"), resultSet.getString("nationality"), resultSet.getString("mpin"));
Now the mapper naturally, in case of a fresh signup, would not find anything except the phoneNumber in the DB. So the rest of the getString() calls will fail. How do I avoid this and say get whatever field is not null and form the object and return it to me.
I see a documentation here for jdbi3 : http://jdbi.org/#_column_mappers but I am not sure if this will solve the problem. I haven't tried it yet as I am having some issues understanding it. So wanted a feedback if this is the right solution or is there another way of doing it.
Thanks in advance.
[EDIT]: I know there is a method resultSet.findColumn('first_name') that I can use to find if a column exists before trying to fetch it. But it will make this code pretty shitty looking if I start doing that for every field in the User mapper. Hence the effort to find a different solution.
I'm making a simple chat app for learning purposes. I want my app to pick out who among the contacts uses my app, so only they can be messaged to, just the way whatsapp does it. How do I go about doing this? I'm using Parse for backend.
WhatsApp records your phone number when you sign up, so it can add a phoneNumber column to its Users table. It also gains access to your contacts, which is really just a list of phone numbers. It then crosschecks those phone numbers with the phoneNumber column in its User table and can thus determine which of your contacts are current users.
There are many ways to do this. They save phone numbers and details when any body sign up to use their services.
Whats app store these details in their database maybe in their users table.
And when you signup to use their service it reads your contatcs by using android's content provider mechanism and then they compare your contacts with their users tables.
IF any match is found you could see it your list otherwise not.
This article might also be useful
I'm exploring restFB and wanna create a Java statement which will return a list of all valid Facebook IDs. Beside, I want also to check if a randomly generated chain of digits is a valid Facebook ID. How can I do that with Java using restFB API?
You can't just get a list of all valid Facebook IDs. They are non-incremental and different IDs map to different objects, so there is no way to get all IDs that resolve to a user.
You can always just fetch the ID and inspect the response (https://graph.facebook.com/<ID>). But, please be aware that scraping is against the policy and there are automated systems in place to detect such behaviour.
Also, there is a rate-limiting for making requests; so requesting all the IDs in series will definitely get you (temporarily) blocked.
Bottom line; you can't do this and if you could it's also not allowed by Facebook.
I have requirement to add new column in default contacts table provided by android so can I do that .I just want to add a new value in that column if it is added from my application.So please tell me if it is possible .
Edit:My aim is to add data in defaults contacts table programatically so that it will also be visible when user opens default phonebook.
No. This is not possible.
Though it technically is, the end result will not be desirable:
It would need root obviously. You can't modify the data of other apps without root.
You would need to find where the actual SQLite database file is located, open that, modify it.
Would the contacts app even work after this modification? Doubtful.
Would this modification persist? Doubtful.
Why not make the association some other way? Store whatever value you have with an identifuer from the contacts database.
I'm working on an application that retrieves the list of Facebook contacts to later perform different actions with it (for example, open a chat).
I have retrieved the list, but I have doubts about which is the best strategy to preserve and applying it to the changes that occur (eg chat be available for a new contact).
What is the best approach? As a first option I created a java class and serialized entire contact list (with their profile picture). After I have saved on the SD card and leave it available for later retrieval when needed. But I'm thinking maybe it is better to create a service in Android that instantiates a class that store a HashMap of contacts and leave it in memory for watching it constantly updating.
What do you think about this?
thanks