Site icon Android Tutorial Online

Debug tool SDK for network calls

debuggy-sdk-android

Debug tool SDK for network calls

Introduction

There are some third-party libraries that we can use to display a screen with all the API calls within the application. But the problem occurs with security. Some libraries are redirecting API calls to their web servers and then to our backend which we are not fully comfortable with.

Usage

You can simply add interceptor in your client and shake your device to see screen with all the API calls.

Example: Add in your Retrofit client

val client = OkHttpClient.Builder()
    client.addInterceptor(DebugInterceptor.create())
        .build()

To use shake device feature add this line in your activity/fragment

DebugInterceptor.start(WeakReference(this))

If you do not want to use shake device feature and would like to open screen manually then:

val myIntent = Intent(this, LogsActivity::class.java)
myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
startActivity(myIntent)

Download

Gradle: Step 1. Add the JitPack repository to your build file. Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency

dependencies {
    implementation 'com.github.GetEliq:debuggy-sdk-android:0.0.1'
}

Maven: Step 1. Add the JitPack repository to your build file

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

Step 2. Add the dependency

<dependency>
    <groupId>com.github.GetEliq</groupId>
    <artifactId>debuggy-sdk-android</artifactId>
    <version>0.0.1</version>
</dependency>

Contributing

If you would like to contribute code you can do so by forking the repository and create a Pull request. You can also create an Issue to report bugs or features that you want to see.

License

Copyright 2023 Eliq AB

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

GitHub

View Github

Exit mobile version