Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

Commit 4b640da

Browse files
committed
Add CONTRIBUTING and align README intro/footer
Add CONTRIBUTING.md tailored for Android module with quick start, dev setup, testing, code style, naming conventions, PR and commit guidelines, and maintainer release notes. Update README to OpenIAP Android intro linking to https://www.openiap.dev and add community footer.
1 parent 637594c commit 4b640da

File tree

2 files changed

+154
-14
lines changed

2 files changed

+154
-14
lines changed

CONTRIBUTING.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Contributing to OpenIAP Android
2+
3+
Thank you for your interest in contributing! We love your input and appreciate your efforts to make OpenIAP better.
4+
5+
## Quick Start
6+
7+
1. Fork the repository
8+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
9+
3. Make your changes
10+
4. Run tests (`./gradlew :openiap:test`)
11+
5. Commit your changes (`git commit -m 'Add amazing feature'`)
12+
6. Push to your branch (`git push origin feature/amazing-feature`)
13+
7. Open a Pull Request
14+
15+
## Development Setup
16+
17+
```bash
18+
# Clone your fork
19+
git clone https://github.com/YOUR_USERNAME/openiap-google.git
20+
cd openiap-google
21+
22+
# Open in Android Studio (recommended)
23+
./scripts/open-android-studio.sh
24+
25+
# Or build from CLI
26+
./gradlew :openiap:assemble
27+
28+
# Run unit tests for the library module
29+
./gradlew :openiap:test
30+
31+
# (Optional) Install and run the Example app
32+
./gradlew :Example:installDebug
33+
adb shell am start -n dev.hyo.martie/.MainActivity
34+
```
35+
36+
## Code Style
37+
38+
- Follow the official Kotlin Coding Conventions
39+
- Use meaningful, descriptive names for types, functions, and variables
40+
- Keep functions small and focused
41+
- Add comments when they clarify intent (avoid redundant comments)
42+
43+
### Naming Conventions
44+
45+
- **OpenIap prefix for public models (Android)**
46+
- Prefix all public model types with `OpenIap`.
47+
- Examples: `OpenIapProduct`, `OpenIapPurchase`, `OpenIapActiveSubscription`, `OpenIapRequestPurchaseProps`, `OpenIapProductRequest`, `OpenIapReceiptValidationProps`, `OpenIapReceiptValidationResult`.
48+
- Private/internal helper types do not need the prefix.
49+
- When renaming existing types, provide a public typealias from the old name to the new name to preserve source compatibility and migrate usages incrementally when feasible.
50+
51+
## Testing
52+
53+
All new features must include unit tests (JUnit + coroutines test):
54+
55+
```kotlin
56+
@Test
57+
fun yourFeature_isCorrect() = kotlinx.coroutines.test.runTest {
58+
// Arrange
59+
// val module = FakeOpenIapModule()
60+
61+
// Act
62+
// val result = store.yourMethod()
63+
64+
// Assert
65+
// assertEquals(expected, result)
66+
}
67+
```
68+
69+
Run tests locally with:
70+
71+
```bash
72+
./gradlew :openiap:test
73+
```
74+
75+
## Pull Request Guidelines
76+
77+
### ✅ Do
78+
79+
- Write clear PR titles and descriptions
80+
- Include tests for new features
81+
- Update documentation when needed
82+
- Keep changes focused and small
83+
84+
### ❌ Don't
85+
86+
- Mix unrelated changes in one PR
87+
- Break existing tests
88+
- Change code style without discussion
89+
- Include commented-out or dead code
90+
91+
## Commit Messages
92+
93+
Keep them clear and concise:
94+
95+
- `Add purchase error recovery`
96+
- `Fix subscription status check`
97+
- `Update Google Play Billing integration`
98+
- `Refactor transaction handling`
99+
100+
## Release Process (Maintainers Only)
101+
102+
When a PR is merged, maintainers handle releases using semantic versioning (major.minor.patch):
103+
104+
1. Bump version (e.g., `OPENIAP_VERSION` in `gradle.properties` or release property)
105+
2. Update changelog (if applicable)
106+
3. Tag and create a GitHub Release
107+
4. Publish to Maven Central via CI (or `./gradlew publish` if configured)
108+
109+
Availability: artifacts appear on Maven Central shortly after the release propagates.
110+
111+
## Questions?
112+
113+
Feel free to:
114+
115+
- Open an issue for bugs or features
116+
- Start a discussion for questions
117+
- Tag @hyodotdev for urgent matters
118+
119+
## License
120+
121+
By contributing, you agree that your contributions will be licensed under the MIT License.
122+

README.md

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
# OpenIAP GMS
1+
# OpenIAP Android
2+
3+
<div align="center">
4+
<img src="https://openiap.dev/logo.png" alt="OpenIAP Logo" width="120" height="120">
5+
6+
<p><strong>Android implementation of the <a href="https://www.openiap.dev/">OpenIAP</a> specification using Google Play Billing.</strong></p>
7+
</div>
8+
9+
<br />
210

311
[![Maven Central](https://img.shields.io/maven-central/v/dev.hyo.openiap/openiap-google)](https://central.sonatype.com/artifact/dev.hyo.openiap/openiap-google)
412
[![API](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=21)
513
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
614

15+
OpenIAP Android module: https://www.openiap.dev/
16+
717
Modern Android Kotlin library for in-app purchases using Google Play Billing Library v8.
818

19+
## 🌐 Learn More
20+
21+
Visit [**openiap.dev**](https://openiap.dev) for complete documentation, guides, and the full OpenIAP specification.
22+
923
## 🎯 Overview
1024

1125
OpenIAP GMS is a modern, type-safe Kotlin library that simplifies Google Play in-app billing integration. It provides a clean, coroutine-based API that handles all the complexity of Google Play Billing while offering robust error handling and real-time purchase tracking.
@@ -16,7 +30,7 @@ OpenIAP GMS is a modern, type-safe Kotlin library that simplifies Google Play in
1630
-**Kotlin Coroutines** - Modern async/await API
1731
- 🎯 **Type Safe** - Full Kotlin type safety with sealed classes
1832
- 🔄 **Real-time Events** - Purchase update and error listeners
19-
- 🧵 **Thread Safe** - Concurrent operations with proper synchronization
33+
- 🧵 **Thread Safe** - Concurrent operations with proper synchronization
2034
- 📱 **Easy Integration** - Simple singleton pattern with context management
2135
- 🛡️ **Robust Error Handling** - Comprehensive error types with detailed messages
2236
- 🚀 **Production Ready** - Used in production apps
@@ -67,18 +81,18 @@ class MainActivity : AppCompatActivity() {
6781

6882
override fun onCreate(savedInstanceState: Bundle?) {
6983
super.onCreate(savedInstanceState)
70-
84+
7185
openIAP = OpenIAP.getInstance()
72-
86+
7387
// Set up listeners
7488
openIAP.addPurchaseUpdateListener { purchase ->
7589
handlePurchaseUpdate(purchase)
7690
}
77-
91+
7892
openIAP.addPurchaseErrorListener { error ->
7993
handlePurchaseError(error)
8094
}
81-
95+
8296
// Initialize connection
8397
lifecycleScope.launch {
8498
try {
@@ -175,9 +189,7 @@ suspend fun requestPurchase(
175189
)
176190

177191
suspend fun requestPurchase(params: Map<String, Any?>, activity: Activity)
178-
179192
suspend fun finishTransaction(purchase: OpenIapPurchase, isConsumable: Boolean? = null)
180-
181193
suspend fun getAvailablePurchases(): List<OpenIapPurchase>
182194
suspend fun getAvailablePurchases(options: Map<String, Any?>?): List<OpenIapPurchase> // options ignored on Android
183195
suspend fun getAvailableItemsByType(type: String): List<OpenIapPurchase>
@@ -273,7 +285,7 @@ sealed class OpenIapError : Exception {
273285

274286
## 🔄 Purchase Flow
275287

276-
1. **Initialize**: Call `initConnection()`
288+
1. **Initialize**: Call `initConnection()`
277289
2. **Fetch Products**: Use `fetchProducts()` to load available items
278290
3. **Request Purchase**: Call `requestPurchase()` with the product SKU
279291
4. **Handle Events**: Listen for purchase updates via listeners
@@ -301,15 +313,17 @@ cd openiap-google
301313
### Test Products
302314

303315
For development, use Google Play's test SKUs:
316+
304317
- `android.test.purchased` - Always succeeds
305-
- `android.test.canceled` - Always cancels
318+
- `android.test.canceled` - Always cancels
306319
- `android.test.item_unavailable` - Always fails
307320

308321
For production testing, configure products in Google Play Console and use internal testing.
309322

310323
## 📱 Sample App
311324

312325
The included sample app demonstrates:
326+
313327
- ✅ Connection management with retry logic
314328
- ✅ Product listing and purchase flow
315329
- ✅ Real-time purchase event handling
@@ -374,11 +388,13 @@ openIAP.requestPurchase(
374388
### Common Issues
375389

376390
1. **Product not found**
391+
377392
- Ensure products are configured in Google Play Console
378393
- App must be uploaded to Google Play Console (even as draft)
379394
- Wait up to 24 hours for products to become available
380395

381396
2. **Billing unavailable**
397+
382398
- Verify Google Play Services are installed and updated
383399
- Check that app is signed with release key for testing
384400
- Ensure billing permissions are in AndroidManifest.xml
@@ -404,7 +420,7 @@ if (BuildConfig.DEBUG) {
404420
```
405421
MIT License
406422
407-
Copyright (c) 2024 hyodo.dev
423+
Copyright (c) 2024 hyo.dev
408424
409425
Permission is hereby granted, free of charge, to any person obtaining a copy
410426
of this software and associated documentation files (the "Software"), to deal
@@ -432,9 +448,11 @@ Contributions are welcome! Please read our contributing guidelines and submit pu
432448
## 📞 Support
433449

434450
- **Issues**: [GitHub Issues](https://github.com/hyodotdev/openiap-google/issues)
435-
- **Documentation**: [Wiki](https://github.com/hyodotdev/openiap-google/wiki)
436-
- **Discussions**: [GitHub Discussions](https://github.com/hyodotdev/openiap-google/discussions)
451+
- **Discussions**: [GitHub Discussions](https://github.com/hyodotdev/openiap.dev/discussions)
437452

438453
---
439454

440-
Made with ❤️ by [hyodo.dev](https://hyodo.dev)
455+
<div align="center">
456+
<strong>Built with ❤️ for the OpenIAP community</strong>
457+
458+
</div>

0 commit comments

Comments
 (0)