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.
Maven
<dependency>
<groupId>com.bluecrunch</groupId>
<artifactId>bluecrunchverification</artifactId>
<version>1.0.5</version>
</dependency>
Gradle
implementation 'com.bluecrunch:bluecrunchverification:1.0.5'
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()
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. |
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. |
@sherifMohammed95 , and to all Bluecrunch team specially the mobile team 💪🏻.
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