/verification

An android verification module implemented in kotlin that uses Firebase or Server APIs for SMS send & verification in your android app.

Primary LanguageKotlin

Verification Module

You can now chill out on sending/verifying SMS using Firebase or even your server APIs on your android application.

It is normal for your Android application to have SMS verification screen (Register secnario , reset password , ... etc). And it is very annoying that you do a lot of work every time.

So , we made verification module✌🏽to help you in that silly work.

Features

  • Send SMS using firebase.
  • Verify SMS using firebase.
  • Send SMS using server APIs (Get or post).
  • Verify SMS using server APIs (Get or post).
  • Control number of SMS verification digits (4,5 or 6).
  • Control box background (i.e. custom bg like rounded box or line ,...).
  • Control digit box size & spaces.
  • Control digit box height & text color.
  • Add custom bg for each box when focused.
  • Sceenshots

    Download

    Maven

    
    <dependency>
      <groupId>com.bluecrunch</groupId>
      <artifactId>bluecrunchverification</artifactId>
      <version>1.0.5</version>
    </dependency>
    
    

    Gradle

    
    implementation 'com.bluecrunch:bluecrunchverification:1.0.5'
    
    

    Usage

    You need to use the widget first in the XML layout of your verification layout.

    
      <com.bluecrunch.bluecrunchverification.VerificationView
                android:id="@+id/verification_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="50dp"
                android:layout_marginTop="20dp"
                android:layout_marginEnd="50dp"
                app:box_count="6"
                app:box_background_focused="@drawable/verification_box_focused_bg"
                app:box_height="50dp"
                app:box_background="@drawable/line_shape"
                app:box_text_color="@color/colorAccent"
                app:box_space="7dp"
                app:layout_constraintTop_toTopOf="parent" />
    
    

    In your activity/fragment, just make a lateinit var from class called VerificationIntegration like this :

    private lateinit var integration : VerificationIntegration

    after that you need to build your integration object using builder pattern 🤠 like this:

    if you are using Firebase :

    
    integration =
          VerificationIntegration
              .Builder(this)
              .setIsFirebase(true)
              .setCountryCode("country code here")
              .setFCMCallBack(this)
              .setMobileNumber("mobile number here")
              .build()
    
    

    and if you are using Server APIs :

    
    integration =
          VerificationIntegration
              .Builder(this)
              .setIsFirebase(false)
              .setIsSendMethodGet(false)
              .setSendRequestBody("request body as JsonObject") // if it is a @POST method .
               // Sample for @POST request
               // val mRequest = TreeMap<String, Any>()
               // mRequest["to"] = "0000000000"
               // mRequest["message"] = "Welcome :D"
              .setWebserviceCallBack(this)
              .setSendRequestURL("web server url with end point here") // https://IP/sendSMS/ {params} . if using @GET
              // Sample for @GET request in the url 
              // https://IP/sendSMS/mobile=0000000000
              .build()
    
    

    Finally 🥳, you just need to call send SMS or verify SMS methods :

    
     integration.sendFCMSms() 
     // Or
     integration.sendSMSPOST()
    
    

    Key Usage for the Verification Widget

    Attribute Usage
    box_count 4,5 or 6 to define number of boxs in the widget.
    box_height Define single box height in dp.
    box_background Define background shape for each box (i.e. custom drawable like oval , rectanngle , line ,...).
    box_text_color Define text color in each box.
    box_space Define spaces between each box in the widget.
    box_background_focused Add custom bg for each box when focused.

    Key Usage for the Verification Integration

    Method Usage
    sendFCMSms This method is used to send SMS using firebase.
    reSendFCMSms This method is used to re-send SMS using firebase.
    verifyFCMPhoneNumberWithCode This method is used to verify mobile number with verification code using firebase.
    sendSMSGET This method is used to send SMS using API Webservice @GET Method.
    sendSMSPOST This method is used to send SMS using API Webservice @POST Method.
    verifySMSGET(verifyURL: String) This method is used to verify SMS using API Webservice @GET Method
    verifySMSPOST(verifyURL: String, request: TreeMap<String, Any>) This method is used to verify SMS using API Webservice @POST Method
    FCMCallBack This interface is used to implement firebase send & verify callback methods.
    WebServiceCallBack This interface is used to implement Webservice APIs send & verify callback methods.

    Special thanks

    @sherifMohammed95 , and to all Bluecrunch team specially the mobile team 💪🏻.

    Licence

    Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of at: https://opensource.org/licenses/apache2.0.php

    Thank you ❤️