android-retrofit

Implement type-safe HTTP networking in Android with Retrofit and Kotlin coroutines.

10.4k|519|Updated Apr 15, 2023
One-click install
npx skills add https://github.com/maxrave-dev/SimpMusic --skill android-retrofit-maxrave-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-retrofit
Source: https://github.com/maxrave-dev/SimpMusic/tree/main/.claude/skills/android-retrofit
Command: npx skills add https://github.com/maxrave-dev/SimpMusic --skill android-retrofit-maxrave-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill simplifies and standardizes the process of making network requests in Android applications, ensuring type-safe, efficient, and maintainable HTTP communication.

Core Features & Use Cases

  • Type-Safe Networking: Define API endpoints using Kotlin interfaces and annotations.
  • Flexible Request Handling: Supports dynamic URLs, request bodies, form data, multipart uploads, and custom headers.
  • Coroutines Integration: Seamlessly integrates with Kotlin coroutines for asynchronous operations.
  • Dependency Injection: Provides guidance on configuring Retrofit with Hilt for robust dependency management.
  • Use Case: Quickly set up a service to fetch user data from a REST API, handle different response codes, and integrate it into your Android app using best practices.

Quick Start

Use the android-retrofit skill to create a Retrofit service for fetching user data from 'https://api.example.com/users'.

Frequently Asked Questions about android-retrofit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up type-safe HTTP networking in Android using Retrofit?

Type-safe HTTP networking in Android is set up by defining API endpoints using Kotlin interfaces and annotations. This approach standardizes network requests, ensuring efficient and maintainable HTTP communication within your application.

How do I integrate Kotlin coroutines with Retrofit for asynchronous operations?

Kotlin coroutines integration with Retrofit enables asynchronous network operations by leveraging suspending functions in your service interface definitions. This allows you to perform network requests without blocking the main thread.

What's the best way to configure Retrofit with Hilt for dependency injection?

Configuring Retrofit with Hilt involves setting up dependency injection modules to provide your Retrofit instance and API clients. This ensures robust dependency management and consistent access to your API services throughout the Android app.

Can I handle dynamic URLs, multipart uploads, and custom headers in Retrofit?

Retrofit supports flexible request handling including dynamic URL manipulation, multipart uploads, form data, and custom header management. These features are configured directly through annotations within your Kotlin service interface definitions.

How do I configure the OkHttp client when building a Retrofit instance?

OkHttp client configuration for Retrofit involves customizing the underlying HTTP client to manage interceptors, timeouts, and network behaviors. This setup is essential for fine-tuning request execution and handling complex HTTP networking scenarios.