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.
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.
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 want to add one field(column) to contact fields,that i can set value for that field in code and mobile user can not see that field in contact properties.In this way i can use contact information without create another database to copy contact database.
Is this possible?
please help me
I don't think you can modify the contacts database directly (or at least not without rooting the device first).
If you want to add additional information to a stored contact, I think your best option would be to actually create a new database. Just create a new table with columns [CONTACT_ID, YOUR_NEW_FIELD] and store that extra piece of information on the contact there. Also, that way you won't be polluting the contact's database with your app's proprietary information, which would have no meaning if the user removed your app.
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.
I'm pretty sure it's not viable to do what I'd like to based on some initial research, but I figured it couldn't hurt to ask the community of experts here in case someone knows a way.
I'd like to create a custom field for contacts that the user is able to edit from the main Contacts app; however, the user should only be allowed to select from a list of four specific values. A short list of string values would be ideal, but an int with a min/max range would suffice.
I'm interested in knowing if it's possible either way, but also wondering if it make sense to go this route performance wise. More specifically, would it be better to look up a contact (based on a phone number) each time a call or SMS message is received or better to store my own set of data (consisting of name, numbers, and the custom field) and just syncing contact info in a thread every so often? Or syncing contacts the first time the app is run and then registering for changes using ContentObserver?
Here is a similar question with an answer that explains how to add a custom field to a contact.
Thanks in advance.
I don't see the purpose to have your own set of data against contacts stored in your separate database, as you obviously will run into sync issues. You can use the mimetype and store whatever you want against the contact, in the manner you linked.
Whenever you want to looup contacts you can do that by using your custom mimetype. You get the contact id (from ContactsContract.Data.CONTENT_URI), and then you run another query to get the contact details (from ContactsContract.Contacts.CONTENT_URI). Please note these are different tables.
I'd like to create a custom field for contacts that the user is able to edit from the main Contacts app
I don't see that possible, editable from the main app, when you use your custom mimetypes, and you don't have much options here. The main contact app will display only the fields that are in SDK. You can store details against contacts but they won't show up in the inbuilt edit contact screen.