B4A Library Library PhoneNumberValid

Hi all.

This is simple library to check if PhoneNumber is Valid. Comeback is valid number, country, is mobile or no, etc.
I used this free service: Phone Validate
You have with Free account limit: 50 request / day.
If you want illimited request or another documentation you can see HERE

Is very simple:

PhoneValidate
Author:
Devil-App
Version: 1
  • PhoneValidate
    Methods:
    • IsInitialized As Boolean
      Tests whether the object has been initialized.
    • initialize (numberphone As String, yourkey As String, Module As Object, EventName As String) As String

      For get key you go HERE

      B4X:
      Sub Globals
          'These global variables will be redeclared each time the activity is created.
          'These variables can only be accessed from this module.
      
          Private Label1 As Label
          Private Label2 As Label
          Private Label3 As Label
          Private Label4 As Label
          Private Label5 As Label
          Private Label6 As Label
      End Sub
      
      Sub Activity_Create(FirstTime As Boolean)
          'Do not forget to load the layout file created with the visual designer. For example:
          Activity.LoadLayout("1")
          Dim checkphone As PhoneValidate
          checkphone.Initialize("1-888-322-1122","Fe5pwHzYKdmshHMC2Kq7NUIN0X3Ap1J54u4jsn62nFgdNmBJX9", Me, "check_valid")
          checkphone.
      
      End Sub
      
      Sub check_valid(valore As typeLevel)
      
      Log("Error: " & valore.error)
      Label1.Text = "Error: " & valore.error
      Log("Valid: " & valore.valid )
      Label2.Text = "Valid: " & valore.valid
      Log("Location: " & valore.location)
      Label3.Text = "Location: " & valore.location
      Log("Country Code: " & valore.country_code)
      Label4.Text = "Country Code: " & valore.country_code
      Log("Is mobile: " & valore.Is_Mobile)
      Label5.Text = "Is mobile: " & valore.Is_Mobile
      Log("Local Number: " & valore.local_number )
      Label6.Text = "Local Number: " & valore.local_number
      Log("Type Phone: " & valore.TypePhone )
      
      End Sub

      Is important that you have this library:
      httputils2
      json
      okhttp

      Installation instructions:
      You have 2 way:

      1 LIBRARY
      - Unzip the attached file ( PhoneValidate-Lib.zip ) and copy PhoneValidate.jar and PhoneValidate.xml to the libraries folder
      - ValidatePhone-Example.zip is simple B4A

      2 CLASS
      - Available also Class. Unzip the attachment PhoneValidate.zip

      Thank you also Erel & DonManfred for support


      Screenshot 2015-07-19 17.06.38.png
 

Attachments

  • ValidatePhone-Example.zip
    8.9 KB · Views: 502
  • PhoneValidate.zip
    1.2 KB · Views: 548
  • Lib-ValidatePhone-Library.zip
    9.8 KB · Views: 276
Top