Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

VGS Collect Android SDK

License

NotificationsYou must be signed in to change notification settings

verygoodsecurity/vgs-collect-android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UTlicense

VGS Collect SDK

VGS Collect - is a product suite that allows customers to collect information securely without possession of it. VGS Collect Android SDK allows you to securely collect data from your users via forms without having to have that data pass through your systems. The form fields behave like traditional input fields while securing access to the unsecured data.

Table of contents

VGS Collect Android SDK StatesVGS Collect Android SDK Response

Structure

  • VGSCollect SDK - provides an API for interacting with the VGS Vault
  • Card Scanner - This module is for adaptingblinkcard-android SDK with VGS Collect Android SDK.
  • app - sample application to act as the host app for testing the SDK during development

Integration

For integration you need to install theAndroid Studio and aJDK on your machine.

Integrate the VGS Collect SDK to your project.
If you are using Maven, add the following to yourbuild.gradle file.
dependencies {    implementation"androidx.appcompat:appcompat:<version>"    implementation"com.google.android.material:material:<version>"    implementation"com.verygoodsecurity:vgscollect:<latest-version>"}
Add input fields toR.layout.activity_main layout file.
<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:app="http://schemas.android.com/apk/res-auto"xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical">    <com.verygoodsecurity.vgscollect.widget.VGSTextInputLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"app:hint="Card number"app:boxCornerRadius="8dp"app:boxBackgroundModes="outline">        <com.verygoodsecurity.vgscollect.widget.VGSCardNumberEditTextandroid:id="@+id/cardNumberField"android:layout_width="match_parent"android:layout_height="match_parent"android:padding="8dp"app:fieldName="cardNumber"app:numberDivider="-"app:cardBrandIconGravity="end"/>    </com.verygoodsecurity.vgscollect.widget.VGSTextInputLayout>//Other fields..</LinearLayout>
To initialize VGSCollect you have to set yourvault id andEnvironment type.
You can find more information at the followingsection.
importcom.verygoodsecurity.vgscollect.core.Environmentimportcom.verygoodsecurity.vgscollect.core.VGSCollectclassMainActivity :AppCompatActivity() {privatelateinitvar vgsForm:VGSCollectoverridefunonCreate(savedInstanceState:Bundle?) {super.onCreate(savedInstanceState)     setContentView(R.layout.activity_main)     vgsForm=VGSCollect(this,"<vauilt_id>",Environment.SANDBOX)val view= findViewById<VGSCardNumberEditText>(R.id.cardNumberField)     vgsForm.bindView(view)// Bind other fields  }overridefunonDestroy() {      vgsForm.onDestroy()super.onDestroy()  }}
Fields state tracking.
When an object of this type is attached to a VGS secure field, its methods will be called when the text or focus is changed.
importcom.verygoodsecurity.vgscollect.core.Environmentimportcom.verygoodsecurity.vgscollect.core.VGSCollectclassMainActivity :AppCompatActivity() {privatelateinitvar vgsForm:VGSCollectoverridefunonCreate(savedInstanceState:Bundle?) {super.onCreate(savedInstanceState)     setContentView(R.layout.activity_main)     vgsForm=VGSCollect(this,"<vauilt_id>",Environment.SANDBOX)     vgsForm.addOnFieldStateChangeListener(object:OnFieldStateChangeListener {overridefunonStateChange(state:FieldState) {// Handle input fields states         }     })val view= findViewById<VGSCardNumberEditText>(R.id.cardNumberField)     view?.setOnFieldStateChangeListener(object:OnFieldStateChangeListener {overridefunonStateChange(state:FieldState) {// Handle single field states         }     })     vgsForm.bindView(cardNumberField)// Bind other fields  }overridefunonDestroy() {     vgsForm.onDestroy()super.onDestroy()  }}
Send a simple request. Receive responses.
CallasyncSubmit to execute and send data on VGS Server.
To retrieve response you need to implementVgsCollectResponseListener.
overridefunonCreate(savedInstanceState:Bundle?) {super.onCreate(savedInstanceState)    setContentView(R.layout.activity_main)    vgsForm=VGSCollect(this,"<vauilt_id>",Environment.SANDBOX)val submitBtn= findViewById<Button>(R.id.submitBtn)    submitBtn?.setOnClickListener {        submitData()    }val view= findViewById<VGSCardNumberEditText>(R.id.cardNumberField)    view.bindView(cardNumberField)// Bind other fieldsval submitBtn= findViewById<Button>(R.id.submitBtn)    submitBtn?.setOnClickListener {        vgsForm.asyncSubmit("/post",HTTPMethod.POST)    }    vgsForm.addOnResponseListeners(object:VgsCollectResponseListener {overridefunonResponse(response:VGSResponse?) {when(response) {isVGSResponse.SuccessResponse-> {val successCode= response.successCodeval rawResponse= response.rawResponse                }isVGSResponse.ErrorResponse-> {val errorCode= response.errorCodeval localizeMessage= response.localizeMessage                }            }        }    })}

Next steps

Check out documentation guides:

For a quick start, try ourDemo application.

License

VGSCollect Android SDK is released under the MIT license.See LICENSE for details.


[8]ページ先頭

©2009-2025 Movatter.jp