-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inserting to SIM card fails with NAME_EXCEEDED_MAX_CHAR_LIMIT #326
Comments
I'll try to reproduce this issue with my physical devices tomorrow. I'm the meantime, could you provide me some more details? I want to know the following;
val contactsApi = Contacts(context)
val nameMaxLength = contactsApi.sim().cardInfo.maxCharacterLimits().nameMaxLength()
val numberMaxLength = contactsApi.sim().cardInfo.maxCharacterLimits().numberMaxLength() I want to know the values of Thanks for raising this issue! I'm hoping to get to the bottom of this with your help 😁 |
I will wait with labeling this as a bug until I get more details 😃 |
Here is the detailed information. What is the device you are testing on? What is the Android OS version of that device? Can you put more than one SIM card into that device (does it support multiple SIM cards)? What SIM card are you using? Are you able to insert new contacts into the SIM card using different software such as https://play.google.com/store/apps/details?id=com.midi.siminfo ? Are you able to query the SIM card and get contacts? Are you able to delete contacts from the SIM card? Log the values of the character limits: P.S. I've also run my code at Samsung Galaxy M31s/Android 12/Dual SIM Card. The result is the same. |
I've also hardcoded two lines in java/contacts/core/sim/SimCardMaxCharacterLimits.kt:
But after I restarted my SIM card again I got:
It worked! |
I have another question for you as an expert in Android contacts. Do you know if is it possible when me to add a contact to my SIM card to specify the exact position of the contact in the SIM card's phone book? Does it add contacts sequentially? Thanks. |
Thanks so much for all the detailed information!
It seems like there might not be any issue with the API! The other apps you used for testing also failed but then started working after restarting your SIM card. Same with this library.
I believe I can make an internal fix for this.
EDIT: It seems like there might be an issue with the max length calculation. I'm already checking for 0 every time I try to use the max length stored in cache and recalculating if it is 0. I will need to take a deeper look into this. @Aroxed, are you sure that the insert only works after restarting SIM with the the following hardcoded changes you made?
Without the above changes, after restarting SIM, the insert still fails? Could you try again without any hard code changes to the API? Also, since you are able to reproduce the issue and you are able to make code changes and run the sample app, do you mind trying to figure out what's wrong? Maybe you can even come up with a fix (fork this repo and create a PR)? I don't mind how you fix it, I can always clean it up later and add/update documentation if necessary. Let me know. Thanks! 😁 |
This is a tricky one to answer because internally the SIM card stores contacts based on an integer ID. However, applications that show the contacts in a UI can choose to order contacts in however way they want (typically by name). Feel free to read all of my developer notes on this that I wrote while writing the APIs. Specifically this section; https://vestrel00.github.io/contacts-android/sim/about-sim-contacts/#figuring-out-how-to-perform-crud-operations |
I'll try to reproduce this issue on my numerous physical devices next week or the following week. Work and life are extremely busy! @Aroxed, could you please re-confirm. Without making any code changes to the library, after restarting SIM, the library insert still fails? Also, as I've mentioned, please feel free to tackle this issue yourself and create a PR 🙏 |
Hi!
I'm trying to insert a contact into my SIM card. I've used such an approach as in the sample:
The result is:
Also I ran the code according to the documentation:
And the result is the same.
Could you tell me what I did wrong regarding NAME_EXCEEDED_MAX_CHAR_LIMIT?
I really appreciate any help you can provide.
Andrii.
The text was updated successfully, but these errors were encountered: