Phone Number Tools

The old extension works fine. I am using Two Letter Codes like PK, IN etc and it works fine

1 Like

Thanks , I’ve sent you a modified version.
P.S: this

Was a problem at my end while testing :sweat_smile:

1 Like

@heliocesar84
You can round photos using round image extension by deep host

Version 1.1

A small update that hopefully fixes all of the bugs reported :blush:

Bug Fixes

1- Fixed null pointer exception when using GetContactImageList and GetContactsImageListAsync block.Thanks to @bodymindpower and @sherif
2- Fixed that the FormatPhoneNumber block wasn’t working in apis older then 21, now it works with all versions.

Changes

1- Reorganized and removed many useless classes, however, extension size increased to 23 mb :sweat:
2- Now the extension ask for the READ_CONTACTS permission ( for all required blocks ) without needing to ask it manually.Thanks to @bodymindpower , BUT, the permission would be added to the manifest when you add the extension to your project even without using any of its blocks.
3- Now GetContactImage , GetContactUri, GetContactId and GetContactNames, would trigger an event instead of returning the value directly, as i can’t block the user interface thread until the user allows or denies the permission.
image
4- The extension now returns the phone numbers without any extra or unused spaces. thanks to @bodymindpower
5- Now it almost all blocks remove all extra spaces at the start or the end of the given numbers.
6- The extension validates the phone number before doing operations with it.Except with IsValidNumber, FormatPhoneNumber and NormalizeNumber blocks.
7- Some blocks were returning null values instead of empty values when something went wrong.
8- Fixed some blocks descriptions spelling errors :grimacing:

New Blocks

Some new events that would get fired when the GetContactImage , GetContactUri, GetContactId and GetContactNames gets the result:
image

Deprecated blocks

:warning: As some blocks are deprecated or changed, your project might got broken if you imported the new version, i would suggest you to have a backup for it :warning:
image
Those blocks are deprecated due to that they might not return the result at all, if the extension needed to ask a permission , use the Asynchronous version of them instead :slightly_smiling_face:

The first topic got updated
That’s all for now :grin: Thanks.

3 Likes

please add get dual sim card number…

Version 2

New Blocks

1- GetGroupsList
component_method - 2021-01-21T220757.641
Gets all of the groups stored on the device, or in any account registered on the device.
2- GetContactGroups
blocks - 2021-01-21T221207.376
Get the list of groups the contact is added to.
3- GetGroupContacts
blocks - 2021-01-21T221324.986
Get the list of contacts added to a group
4- GetContactEmail
blocks - 2021-01-21T221445.248
Gets the the contact email, the corresponding event isn’t called if there isn’t any email found for the contact.
5- New events for the added blocks, called when the result is found :
blocks - 2021-01-21T221746.050

Thanks! :smiley:

7 Likes

Version 2.1

Bugs Fixed

1- The extension wasn’t working in the compiled APK, since the extension wasn’t properly declaring the READ_CONTACTS permission in the app’s manifest, and therefore, the permission wasn’t requested. (Thanks to @Sirajul_Haque )

New Blocks

1- image
Strips separators from a phone number string.
2- image
Returns a list of all of the phone numbers in the string given.
3- component_event (30)
Called when an error occurs, with the error and its message, instead of showing an undefined runtime error. It’s also called when an empty or invalid input is given.
The updated AIX can be found in the first post :smiley:

5 Likes

How can I get Contact Uri from contacts app, using phone number.


Hello @Md_Sirajul_Haque,
Your blocks should be correct, are you experiencing any problems with it?

Many many thanks Tamer. I am facing a problem to get contactUri to open a contact directly to edit or delete that contact with contacts app. But there is a problem described below.

Using “ContactPicker” I got contactUri “content://com.android.contacts/contacts/lookup/3877i41d55ef28b7e8bb9/21**”

But when I got contactUri using “PhoneNumberTools” that returns"content://com.android.contacts/phone_lookup/01* 16422 **"![blocks (17)|690x154]

(upload://uVujAU6KSZUABjU1rqr3dZyBupl.png)

why difference?
When I use “ActivityStarter” then it works if I use ContactPicker contactUri but PhoneNumberTools contactUri not work.!

I want to get contactUri using phone number and which contactUri able to work in ActivityStarter to open that contact directly.
Please help.
Thanks again.

“GetContactId” block returns same ID for two different contacts.!

Will you tell the reason please?
Tested with MIT AI2 Companion

I have a favor to ask. Could you make the block GetContactName a function instead of a call? It would be so much easier to use the block when you don’t have to keep track of an event anymore.

Happy Birthday @sonumohammad333

Hello,
The reasoning behind it was made an event block, is because of the fact the block might need to ask for permissions first, that’s being said, it will not be a good idea to block other blocks from executing until getting the response from user.
Nevertheless, it’s possible you could switch to version 1, where blocks were returning values directly instead of using an event block, you will just need to ask for the permission READ_CONTACTS manually in that case.

Thank you.

Thank you for your reply. That really clarifies things. I’d like to ask further. How do I properly ask for permission.

Neither this one:


nor this one:

worked when I tried.

The problem is that when it is the first time I open my app, it doesn’t ask the READ_CONTACTS permission.

Now since I use my app to send SMS, I also need the SEND_SMS permission. My app asks for it automatically the first time I open my app although I did not explicitly ask for this permission. Why does it ask for the SEND_SMS permission but not the READ_CONTACTS permission when I even asked for it explicitly in my blocks? Is it a problem of the app asking for two permissions during screen initialization? Is this not supposed to be done? If so, how do I properly ask for the READ_CONTACTS permission so that I get it the first time I open my app?

Can you try this AIA please:
phonenumbertoolstest.aia (16.9 KB)
It asks for the permission properly for me, testing on the companion and APK.
You should make sure that:
1- The permission hasn’t been already granted before ( this can be done manually from the settings app )
2- You have added the extension to your screen ( so that the permission is declared in the apk’s manifest ), this is more specifically for building as apk as the companion declares it by default.

I suppose you are using the texting component, it would automatically ask for the SEND_SMS permission, so explicitly asking permissions isn’t needed in that case.
As said, the older version of this extension doesn’t automatically request permissions, and so it was needed to ask it manually.

Can we create phone verify login system to use this extension.
Please give also Aia file.

Welcome @Cash_Ads ,

If you mean to send a SMS verification code to a phone number, so this extension has nothing to do with it. You might want to search the community for methods to achieve this. You could possibly use Firebase Authentication.

I have already provided a test project ( AIA file ) in the first post:

1 Like

Official language is English. You are violating the policy. Either translate it or delete your post before it is marked as spam

1 Like

Why are there not some languages such as Arabic and French, which helps this community to facilitate communication and learning?

1 Like