Here i am sharing an important android Github library that use for integrate Auto SMS detect for your android application .So let's start from beginning :-
Step 1:
Download via Gradle:
compile 'com.github.stfalcon:smsverifycatcher:0.3.2'
or Maven:
<dependency>
<groupId>com.github.stfalcon</groupId>
<artifactId>smsverifycatcher</artifactId>
<version>0.3.2</version>
<type>pom</type>
</dependency>
Step 2:
Add permissions to AndroidManifest.xml:
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
Step 3:
Step 1:
Download via Gradle:
<dependency>
<groupId>com.github.stfalcon</groupId>
<artifactId>smsverifycatcher</artifactId>
<version>0.3.2</version>
<type>pom</type>
</dependency>
Step 2:
Add permissions to AndroidManifest.xml:
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
Step 3:
smsVerifyCatcher = new SmsVerifyCatcher(this, new OnSmsCatchListener<String>() {
@Override
public void onSmsCatch(String message) {
String code = parseCode(message);//Parse verification code
otp.setText(code); //set code in edit text
//then you can send verification code to server
}
});
private String parseCode(String message) {
Pattern p = Pattern.compile("\\b\\d{6}\\b"); // for 6 digits number
Matcher m = p.matcher(message);
String code = "";
while (m.find()) {
code = m.group(0);
}
return code;
}
@Override
protected void onStart() {
super.onStart();
smsVerifyCatcher.onStart();
}
@Override
protected void onStop() {
super.onStop();
smsVerifyCatcher.onStop();
}
/**
* need for Android 6 real time permissions
*/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
smsVerifyCatcher.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
Additional :
You can set phone number filter:
smsVerifyCatcher.setPhoneNumberFilter("777");
or set message filter via regexp:
smsVerifyCatcher.setFilter("<regexp>");
That's all .For further details go to reference https://github.com/stfalcon-studio/SmsVerifyCatcher
Get ready SMS PHP API or Bulk SMS API PHP Gateway Integration Source Code/Script to Integrate into your website, software or web application. MsgClub PHP APIs helps to send verification code or OTP, Transactional & Promotional SMS from your PHP based application automatically.
ReplyDeletebulk SMS API