voyage 0.0.3-canary.3 copy "voyage: ^0.0.3-canary.3" to clipboard
voyage: ^0.0.3-canary.3 copied to clipboard

Plugin to test the working of plugin already developed.

Voyage 🚗 #

A comprehensive Flutter plugin for the Kruzr 360 SDK, providing advanced driving analytics, trip monitoring, and user behavior analysis capabilities.

Version Flutter Dart

📋 Table of Contents #

🌟 Overview #

Voyage is a Flutter plugin that integrates with the Kruzr 360 SDK to provide comprehensive driving analytics and trip monitoring capabilities. It enables developers to build applications with advanced telematics features including real-time trip tracking, driving behavior analysis, user ranking systems, and detailed performance metrics.

✨ Features #

  • 🚀 SDK Integration - Easy initialization and platform version detection
  • 📱 Trip Monitoring - Automatic trip detection and real-time monitoring
  • 👤 User Management - Registration, authentication, and profile management
  • 📊 Analytics & Metrics - Comprehensive driving behavior analysis
  • 🏆 Leaderboards - User rankings and performance comparison
  • 🎖️ Achievements - Track progress across driving behavior categories
  • 🔐 OTP Authentication - [DEPRECATED] Secure phone number verification
  • 🌐 Data Synchronization - Automatic and manual data sync capabilities
  • 🎯 Trip Control - Manual trip start/stop functionality
  • 📤 Trip Sharing - Generate shareable trip URLs
  • 📶 Bluetooth Support - Device scanning and management

📦 Installation #

Add this to your pubspec.yaml file:

dependencies:
  voyage: ^0.0.3-canary.1

Then run:

flutter pub get

🚀 Getting Started #

1. Initialize the SDK #

import 'package:voyage/voyage.dart';

// Initialize the SDK with your license key
try {
  await Kruzr360Communicator.initializeSDK('your-license-key-here');
  print('SDK initialized successfully');
} catch (e) {
  print('Failed to initialize SDK: $e');
}

2. Create a Communicator Instance #

final communicator = Kruzr360Communicator(
  companyName: 'your-company-name',
  accountName: 'your-account-name',
);

3. Set Up Location Services #

communicator.setupLocationStuffs();

⚙️ Configuration #

Android Setup #

Add the following permissions to your android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

📱 Usage #

User Registration and Authentication #

// Register User
final userId = await communicator.registerUserToKruzr(
  driverId: 'unique_driver_123',
  name: 'John Doe',
  countryCode: '+1',
  phoneNumber: '1234567890',
  email: '[email protected]',
);

Trip Monitoring #

// Initiate trip monitoring
await communicator.initiateTripMonitoring();

// Start a trip manually
final started = await communicator.startTrip();

// Get current trip data
final currentTrip = await communicator.getCurrentTripData();

// Stop a trip
final stopped = await communicator.stopTrip();

Analytics and Metrics #

// Get driving summary
final summary = await communicator.getDrivingSummary(
  DateTime.now().subtract(Duration(days: 30)),
  DateTime.now(),
  KruzrPerioicType.weekly,
);

// Get user ranking
final userRank = await communicator.getCurrentUserRank();

// Get leaderboard
final topDrivers = await communicator.getLeaderboardTop10();

// Get user achievements
final achievements = await communicator.fetchMyAchievements();
if (achievements != null) {
  // Check overall achievement progress
  print('Current tier: ${achievements.overall?.currentTier?.value}');
  print('Progress: ${achievements.overall?.count}');
  
  // Check specific category achievements
  if (achievements.speeding != null) {
    print('Speeding tier: ${achievements.speeding!.currentTier?.value}');
    print('Trips to next tier: ${achievements.speeding!.remainingTrips}');
  }
}

📖 API Reference #

Core SDK Methods #

Method Description
initializeSDK(String licenseKey) Initialize the SDK with license key
getPlatformVersion() Get platform version information
setupLocationStuffs() Set up location services

Trip Monitoring #

Method Description
initiateTripMonitoring() Enable automatic trip detection
startTrip() Manually start a trip
stopTrip() Manually stop a trip
getCurrentTripData() Get real-time trip information

User Management #

Method Description
registerUserToKruzr() Register a new user
logout() Log out current user
isLoggedIn() Check login status
userDetails() Get user information

Analytics & Metrics #

Method Description
getUserStreak() Get driving streak information
getCurrentUserRank() Get user ranking
leaderboard() Get paginated leaderboard
getAggregatedDistanceTravelled() Get distance metrics
getDrivingSummary() Get comprehensive driving overview
getAggregatedDrivingScore() Get driving performance scores
fetchMyAchievements() Get user achievements across all categories

Authentication (OTP) [DEPRECATED] #

Method Description
generateOtp() Generate OTP for phone verification
generateOtpAlternate() Alternative OTP generation method
verifyOtp() Verify OTP code

Data Management #

Method Description
syncTripData() Manually sync trip data
fetchTripDetailsByAppTripId() Get historical trip details
fetchTripStatsByAppTripId() Get trip statistical analysis
getPendingFilesCount() Get count of pending uploads

Sharing & Bluetooth #

Method Description
generateShareableURL() Create shareable trip URLs
bluetoothScanEventStream() Get Bluetooth event stream
scanForNearbyDevices() Scan for nearby Bluetooth devices

🔐 Permissions #

This plugin requires the following permissions:

Android #

  • ACCESS_FINE_LOCATION - For accurate location tracking
  • ACCESS_COARSE_LOCATION - For general location services
  • ACCESS_BACKGROUND_LOCATION - For background trip monitoring
  • BLUETOOTH & BLUETOOTH_ADMIN - For Bluetooth device management

iOS #

  • Location permissions will be requested automatically
  • Bluetooth permissions for device scanning

💡 Examples #

See the example/ directory for a complete Flutter application demonstrating the usage of the Voyage plugin.

🐛 Issues and Support #

If you encounter any issues or have questions:

  1. Check the documentation
  2. Search existing issues
  3. Create a new issue with detailed information

📄 License #

This project is licensed under the terms specified in the LICENSE file.

🤝 Contributing #

Contributions are welcome! Please read the contributing guidelines before submitting pull requests.


Made with ❤️ by the Kruzr Team

0
likes
0
points
1.65k
downloads

Publisher

unverified uploader

Weekly Downloads

Plugin to test the working of plugin already developed.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, permission_handler, plugin_platform_interface

More

Packages that depend on voyage

Packages that implement voyage