I am working on a contact list project and so far i can add,modify delete and search for a contact.and when i click on a contact i cand call him send email or sms.I have one table named contacts in my database with folowing fields id,name,phone number and email.
What i need to do next is create groups and add contacts to this groups.
Can you give me some ideas how to do this.I think i should do one more table in my database named groups for example which would have fields: group id ,group name ,contacts id.And i need to make a join to show contacts for a group.
Is this posible to create 2 tables in android database ?can you give me any example(tutorial on how to do this?
I think the best way to implement is to imitate Android Contacts database.Look at the Android contacts database itself.Its a bit complex but exactly what you can refer as to what tables and columns you might need in your app.
You can access that database by pulling out the file data/data/com.android.providers.contacts/databases/contacts.db from Eclipse File Explorer view in DDMS perspective when your Android emulator is running. The file name can also be contact2.db.
Then you can view the DB tables using "Sqlite DB Browser" which can be downloaded here.
Related
I have a team of three people with IDs 1-2-3
They report to me the number of articles they produced daily via an app with a database they upload on google drive or dropbox
so the table has three columns : DATE ID and Number
For example when person with ID=1 opens the app on his device only his inputs should be accessible (to view and edit)
But on my device i can see all the data
You can pass as parameter the user id in api Rest Call and make Sql request filtered by this ID, like that you get only result for this id
It would depend on how you write both the android code and the sql code.
From the sql perspective, in the editors side select all as usual and display in text view for those that he has to view and in editview the ones that he has to edit.
After insert the information into the database.
At the viewers side select as usual and display info in textview or any other widget of your choice.
I cannot actually say much because its really broad. Contact me if you need more specific solutions to your peculiar problem.
Android contacts Display Name and Phone Number(s) in single database query?
The above link gives the details to get the phone number and name in the contacts database.
I also want the group to which the contact belongs to ? How to get this from contacts uri?
you need a rooted phone
install the Root Explorer app
go to /data/data/android.providers.contacts/databases, and you can see all the data tables there.
then it is all about sql
I'm building a small app for messaging (in some way a bit similar to 'WhatsApp' or 'Viber'). WhatsApp and Viber show you contacts that are from your contact list and have an account with them. so my question is how to sync?
For now, I have database which stores all users using the application and their phone number.
Do I need to run a query for each contact in my phone in order to find it in the database?
It looks a lot of queries for every sync request.
What is the efficient way in order to do this?
If you have both sets of data as database tables, then can't you just join on some attribute like 'Full Name' and the resulting table will be all people in your contacts list with the app installed?
You can display contacts in your app that are just pulled from the contact list on the phone. Using LoadManager you can get a contact list that is synced with the phone list.
Check out these links for more info
http://developer.android.com/training/contacts-provider/retrieve-names.html
https://developer.android.com/training/load-data-background/setup-loader.html
I'm currently working on a little program which should give me some statistics about my whatsapp usage.
So my question is:
Is there any way to get the names of whatsapp contacts whose chats are in the msgstore.db which i got from /data/data/com.whatsapp/databases?
So e.g if i have any Chat with anon, it only shows up in the table as "#s.whatsapp.net"
Is there any other database by WhatsApp which holds all the different chatnames or am i forced to export the contacts in my phone book and then associate the entry in the database with the phone numbers of the specific contact?
I hope i explained it understandable enough.
Thanks in advance
You can look into the display names from wa.db , table name is wa_contacts.Watsapp has two main databases. msgstore.db and wa.db. As you already know the messages reside in messages table and the corresponding contacts are in phonenumber#watsapp.net format and groups are adminphonenumber#watsapp.g.us. These ids are mapped with the names in wa_contacts table.
No its not possible android does not allow to read any other application database. As every application Runs in its own sand box.
I want to know how to manipulate phone contacts in group form i.e. create, edit, delete groups, add, delete, edit contacts from a particular group.
You should use ContentProvider and ContactsContract, also checkout the tutorial regarding working with contacts.