Rearranging of contacts in chat application based on recent activity - android

I have built a chat application in android which is voice based. I am arranging my contact list alphabetically at present.
I want my application's contact list to be rearranged every time it receives a new voice message i.e I want the contact name on the top which receives the voice message lately. (Same as that of WhatsApp chat list).
Please suggest me the component or method I need to implement in my application to get it done. Will share my piece of code if needed. Please Help
Thank you

You can add a new attribute to your database that holds the timestamp of the last activity by users. Each time a message is received, sort your list according to the timestamp retrieved from your database.

watsapp store contact and recent activity in their own local sqlite db.
so create you own sqlite db to track user activities

Related

How to show list of phone contacts that are using same app as me?

I am creating a custom app for planning events. It has a SMS based authentication. Now I want to create a list of people who are already using the app (like the list of contacts in WhatsApp). Is there any way to do this in Android?
If I get you right, you can do this in 3 steps:
When a user registers on your app, save the user in say "ActiveNumbers" database on your server.
Ask contacts permission from users.
Do a join of the contacts and ActiveNumbers table, list the valid contacts in the people section of your app.
Does it solve your problem?

offline chat storage using sqlite

I have created a chat app using firebase, I want to store the chat data in the user device and show to the user if the internet is not available.
I am torn between how to implement it I wanted to use realm but it increases app size almost by 6mb(my app size is 4mb), so I switched back to SQLite.
Now I want to know what would be the best practice to do so
I have implemented few processes still unclear how to do.
I have created a master_chat table in which I have message_id, to ,from and thread_id and secondary chat_data table where I used message_id as a reference to master_chat table and inserted messageBody, toEmail, fromEmail, time, messageType,fileSize ,downloadLink
now the question is should I follow this method so that everytime user enter the message it will be added to chat_data or directly store the arrayList and update it every time a message is sent or received.
any guidance will be great!

Delete data corresponding to a particular user in other tables in Parse data browser for Android app

I'm using parse as a backend for an android app.What I'm trying to do is to automatically delete data corresponding to a particular user from other tables when that user is deleted from main User table.I am using pointer of user in other tables as a column to identify user.But it isn't working as per what I want to do.Please let me know if anyone here is having knowledge to accomplish this thing.
Thanks :)

android app to build dynamic user input forms with sms delivery

I am new to Android programming . I have just gone through the basic tutorials present in the samples folder when i downloaded the sdk
My task is to now build an app that does the following :
Create a form with 3 fields
namely name , address and phone
number
Values of these fields will be
present in local mysql lite
database of android and will be
displayed as a drop down list when i
click the respective fields
after doing so , when i click the
submit button , the app should send
an sms to a particular contact ,
here again the list of contacts must
be displayed as per what i have
provided in the mysql lite database
as a drop down list giving me the
option to send a to a particular
contact
I would appreciate any suggestions for the same
Thanks
I would start off just making an activity which takes text input from the user, then puts that into a sms and sends it. You can find a tutorial for sending sms here.
Once you have that working i would suggest that you then change it from text imput to your drop down menus(spinner widget) from your SQLite database, you can find a tutorial for spinners here, but rather than using a xml list to populate the spinner (as done in the tutorial) you would get your data from SQLite and put that into an array to use in your spinner.
Hope this helps get you started.

Possibility of a custom Contacts field with a set list of values and Contacts lookup performance

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.

Categories

Resources