For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
HUMAN DashboardHUMAN WebsiteRequest a Demo
Product GuidesEnforcer GuidesMobile SDKAPI ReferenceCustomer support
Product GuidesEnforcer GuidesMobile SDKAPI ReferenceCustomer support
    • Overview
  • Mobile SDK (for Android, iOS, and visionOS)
    • Android changelog
    • iOS, iPadOs, & visionOS changelog
    • Expo changelog
    • React Native Wrapper changelog
  • iOS SDK
    • What's New
    • How to test your app with the SDK
  • Android SDK
    • What's New
      • How to integrate the SDK in your application
      • How to verify the integration in your app with the SDK
      • Manual integration
      • Handle block responses from the server
      • How to retry requests that were blocked
      • Multiple AppIDs support
      • Hybrid App support
      • Enable support for Account Defender
      • Integration with React Native
      • Integration with Flutter
      • Integration with Ionic
      • Integration with gRPC
      • Migrating SDK from v2 to v3
    • How to test your app with the SDK
LogoLogo
Login
Login
HUMAN DashboardHUMAN WebsiteRequest a Demo
On this page
  • Start the SDK
  • Adding SDK’s HTTP headers to your gRPC requests
  • Handle block responses from your server
Android SDKv3

Integration with gRPC

Was this page helpful?
Previous

Migrating SDK from v2 to v3

Next
Built with

The SDK can be integrated into gRPC projects.

Start the SDK

The automatic interceptor is not supported in gRPC, so you should disable requests interception by setting the PXPolicy/urlRequestInterceptionType to PXPolicyUrlRequestInterceptionType/none.

1policy.urlRequestInterceptionType = PXPolicyUrlRequestInterceptionType.NONE
Read about manual integration

You should read how to work with manual integration in your app.

Adding SDK’s HTTP headers to your gRPC requests

In order to include the SDK’s HTTP headers in your gRPC requests, you should add them to your request’s metadata.

1val headers = PerimeterX.headersForURLRequest()!!
2val metadata = Metadata()
3for ((key, value) in headers!!) {
4 metadata.put(Metadata.Key.of(key, Metadata.ASCII_STRING_MARSHALLER), value)
5}
6
7// send you gRPC request with `metadata`...

Now, use the call option instance when you call your send your gRPC request.

Handle block responses from your server

After receiving an error in the server’s response, the gRPC library will throw an exception. pass the information to SDK with the PerimeterX/handleResponse(response:data:forAppId:callback:) function.

1try {
2 // send your gRPC request...
3} catch (statusException: StatusException) {
4 PerimeterX.handleResponse(statusException.status.description!!, null) { result ->
5 println("challenge result = $result")
6 }
7}