GoogleDriver
A lightweight Node.js wrapper for Google APIs, specifically designed for legacy Android device integration.
Overview
GoogleDriver provides a simplified interface to interact with Google's suite of APIs, with a focus on compatibility with older Android versions (API level 16+). This package abstracts the complexity of direct API calls and provides a clean, promise-based interface.
Features
- Google Drive API - File management and operations
- Google Calendar API - Event handling and scheduling
- Google Maps API - Geocoding and location services
- OAuth 2.0 Support - Built-in authentication helpers
- Legacy Android Compatible - Designed for Android 4.1+ integration
- Zero Dependencies - Uses only Node.js built-in modules
Installation
npm install googledriver
Quick Start
const GoogleDriver = require('googledriver');
const client = new GoogleDriver({
apiKey: 'YOUR_API_KEY',
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET'
});
API Reference
Google Drive
// List files
const files = await client.drive.list();
// Get file by ID
const file = await client.drive.get('file_id');
// Create a new file
const newFile = await client.drive.create({
name: 'My Document',
mimeType: 'text/plain'
});
Google Calendar
// List events
const events = await client.calendar.list('primary');
// Get specific event
const event = await client.calendar.get('primary', 'event_id');
Google Maps
// Geocode an address
const result = await client.maps.geocode('1600 Amphitheatre Parkway, Mountain View, CA');
// Reverse geocode coordinates
const address = await client.maps.reverseGeocode(37.4220, -122.0841);
Configuration
| Option |
Type |
Description |
apiKey |
String |
Your Google API key |
clientId |
String |
OAuth 2.0 client ID |
clientSecret |
String |
OAuth 2.0 client secret |
baseUrl |
String |
Custom base URL (optional) |
Legacy Android Integration
This package is optimized for use with legacy Android applications:
- Minimum Android Version: Android 4.1 (Jelly Bean, API level 16)
- HTTP Compatibility: Uses HTTP/1.1 for maximum compatibility
- Response Handling: Simplified JSON parsing for older runtimes
- Error Handling: Graceful degradation for limited network conditions
Requirements
- Node.js >= 14.0.0
- Google Cloud API credentials
Getting API Credentials
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the APIs you need (Drive, Calendar, Maps)
- Create credentials (API Key and/or OAuth 2.0 Client ID)
- Restrict your API key to specific APIs and domains
License
MIT License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Disclaimer
This is an unofficial wrapper and is not affiliated with Google Inc. Use at your own discretion and ensure compliance with Google's Terms of Service.