패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.1.0

phone_info

디바이스 아키텍처(CPU, ABI), 네트워크 상태(IP, 연결 유형) 및 기타 핵심 메트릭을 포함하여 상세한 전화 하드웨어 및 네트워크 정보를 가져오는 강력한 Flutter 플러그인입니다. 디버깅, 분석 및 동적 기능 처리에 이상적입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
14
좋아요
4
Pub 점수
140

패키지 설치

flutter pub add phone_info

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Phone_Info는 모바일 및 데스크톱 디바이스의 CPU 아키텍처, ABI, IP 주소 및 연결 유형을 포함한 포괄적인 하드웨어 및 네트워크 정보를 제공하는 Flutter 플러그인입니다. 개발자가 Android, iOS, Web, macOS, Windows, Linux 플랫폼에서 디버깅, 분석 및 적응형 기능 제공을 위한 중요한 장치 메트릭을 수집할 수 있도록 합니다. 일관된 API를 통해 저수준 시스템 정보에 접근하는 것을 간소화하여 런타임 진단 및 성능 모니터링에 이상적입니다.

사용 사례

  • 기기별 문제 디버깅
  • 분석 데이터 수집
  • 동적 기능 전환 활성화
  • 네트워크 연결 모니터링
  • 기기 유형에 따라 앱 동작 최적화
  • 다중 플랫폼 간 앱 호환성 테스트

주요 기능

  • 여러 플랫폼(안드로이드, iOS, 웹, macOS, Windows, 리눅스)을 지원합니다
  • CPU 아키텍처 및 ABI 세부 정보를 검색합니다
  • 실시간 네트워크 상태 및 IP 주소를 제공합니다
  • 장치 정보를 위한 간단하고 통합된 API
  • 경량이며 통합이 쉬움
  • 다양한 OS 환경에서 신뢰할 수 있는 데이터를 제공합니다

적합한 대상

  • 크로스 플랫폼 앱을 개발하는 개발자
  • 세부 장치 분석이 필요한 팀
  • 적응형 UI 또는 기능 로직이 필요한 앱
  • 디버깅 도구 및 진단 유틸리티
  • 네트워크 의존 기능을 처리하는 애플리케이션

고려 사항

  • Android 및 iOS에서 적절한 플랫폼 권한이 필요합니다
  • 사용 가능한 시스템 수준 데이터에 제한됨
  • 민감한 장치 정보를 노출할 수 있습니다
  • 사용자에게 노출되는 개인정보 민감 디스플레이에는 적합하지 않음
  • 자주 호출될 때 성능에 미치는 영향은 미미하지만 존재합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Phone Info

A Flutter plugin for retrieving detailed phone information on Android devices, including network status, device details, battery information, sensors, and comprehensive system specifications. This plugin provides a flexible API to fetch all information at once or individual pieces as needed, making it ideal for apps requiring device or network insights.

Pub Version License: MIT

Features

  • Network Information:
    • Check if the device is connected to a network (isConnected).
    • Get the connection type (Wi-Fi, Mobile Data, or None).
    • Retrieve the network operator name (e.g., "Robi").
    • Get Wi-Fi signal strength in RSSI (dBm).
    • Access detailed network data (local IP, DNS, network type).
  • Device Information:
    • Device name (e.g., "realme C61").
    • Manufacturer (e.g., "realme").
    • Model (e.g., "RMX3930").
    • Operating system version (e.g., "14").
    • Architecture (e.g., "aarch64").
    • Unique device ID.
    • Total memory (RAM) in MB.
    • Available storage in MB.
  • Battery Information:
    • Battery level percentage.
    • Charging status.
    • Battery health.
    • Temperature.
    • Real-time battery status updates via event streams.
  • Hardware Information:
    • CPU details (core count, frequency, load average).
    • Screen specifications (resolution, density, refresh rate, HDR support).
    • Sensor list with detailed information.
    • Storage details (internal and external).
    • Camera specifications.
    • Biometric capabilities.
  • System Information:
    • SIM card details.
    • System health metrics.
    • Accessibility services.
    • Security information (root detection, encryption status).
    • App usage statistics.
  • Flexible API: Fetch all information in a single call or retrieve individual pieces as needed.
  • Error Handling: Gracefully handles permission denials and unavailable data.

Platform Support

Platform Supported Notes
Android ✅ Fully supported (API 21+).
iOS ❌ iOS support not yet implemented (contributions welcome!).

Installation

Add the phone_info to your pubspec.yaml:

dependencies:
  phone_info: ^0.1.0

Run the following command to install the plugin:

flutter pub get
Android Setup
  1. Permissions: Add the following permissions to your app's android/app/src/main/AndroidManifest.xml:

    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    
  2. Runtime Permissions: For certain features, request permissions at runtime using a package like permission_handler:

  • READ_PHONE_STATE for network operator information
  • PACKAGE_USAGE_STATS for app usage statistics (requires special approval from user)

Usage

Basic Example

Below is a simple Flutter app demonstrating how to use the plugin to fetch phone information:

import 'package:flutter/material.dart';
import 'package:phone_info/phone_info.dart';
import 'package:permission_handler/permission_handler.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: const PhoneInfoScreen(),
    );
  }
}

class PhoneInfoScreen extends StatefulWidget {
  const PhoneInfoScreen({super.key});

  @override
  _PhoneInfoScreenState createState() => _PhoneInfoScreenState();
}

class _PhoneInfoScreenState extends State<PhoneInfoScreen> {
  String _output = 'Press a button to fetch info';

  Future<void> _requestPermissions() async {
    await Permission.phone.request();
  }

  @override
  void initState() {
    super.initState();
    _requestPermissions();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Phone Info Plugin')),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            Text(_output, style: const TextStyle(fontSize: 16)),
            const SizedBox(height: 16),
            ElevatedButton(
              onPressed: () async {
                try {
                  final info = await PhoneInfoPlugin.getPhoneInfo();
                  setState(() {
                    _output = 'All Info: $info';
                  });
                } catch (e) {
                  setState(() {
                    _output = 'Error: $e';
                  });
                }
              },
              child: const Text('Get All Phone Info'),
            ),
            ElevatedButton(
              onPressed: () async {
                try {
                  final deviceName = await PhoneInfoPlugin.getDeviceName();
                  setState(() {
                    _output = 'Device Name: $deviceName';
                  });
                } catch (e) {
                  setState(() {
                    _output = 'Error: $e';
                  });
                }
              },
              child: const Text('Get Device Name'),
            ),
            ElevatedButton(
              onPressed: () async {
                try {
                  final batteryInfo = await PhoneInfoPlugin.getBatteryInfo();
                  setState(() {
                    _output = 'Battery Info: $batteryInfo';
                  });
                } catch (e) {
                  setState(() {
                    _output = 'Error: $e';
                  });
                }
              },
              child: const Text('Get Battery Info'),
            ),
          ],
        ),
      ),
    );
  }
}
Streaming Battery Updates

The plugin also supports streaming real-time battery updates:

import 'package:flutter/material.dart';
import 'package:phone_info/phone_info.dart';

class BatteryMonitorScreen extends StatefulWidget {
  const BatteryMonitorScreen({super.key});

  @override
  _BatteryMonitorScreenState createState() => _BatteryMonitorScreenState();
}

class _BatteryMonitorScreenState extends State<BatteryMonitorScreen> {
  Map<String, dynamic>? _batteryInfo;
  late Stream<Map<String, dynamic>> _batteryStream;

  @override
  void initState() {
    super.initState();
    _batteryStream = PhoneInfoPlugin.batteryInfoStream();
    _batteryStream.listen((batteryInfo) {
      setState(() {
        _batteryInfo = batteryInfo;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Battery Monitor')),
      body: Center(
        child: _batteryInfo == null
            ? const CircularProgressIndicator()
            : Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text('Battery Level: ${_batteryInfo!['batteryLevel']}%'),
                  Text('Status: ${_batteryInfo!['isCharging'] ? 'Charging' : 'Not Charging'}'),
                  Text('Health: ${_batteryInfo!['health']}'),
                  Text('Temperature: ${_batteryInfo!['temperature']}°C'),
                ],
              ),
      ),
    );
  }
}

Complete Example

For a complete working example, see the example app.

Example Output

When you press the buttons, you'll see output like:

All Info: {isConnected: true, connectionType: Wi-Fi, networkOperator: Robi, signalStrength: -32, deviceName: realme C61, manufacturer: realme, model: RMX3930, osVersion: 14, architecture: aarch64, deviceId: d55d784905cd7b6e, totalMemory: 26, availableStorage: 86325, batteryInfo: {batteryLevel: 85, isCharging: true, health: Good, temperature: 30.2}, cpuInfo: {coreCount: 8, maxFrequency: 2400, loadAverage: 1.2}, ...}

Battery Info: {batteryLevel: 85, isCharging: true, health: Good, temperature: 30.2}

API Reference

The PhoneInfoPlugin class provides the following methods:

Basic Information
Method Return Type Description
getPhoneInfo() Future<Map<String, dynamic>?> Retrieves all phone information in a single call.
getPlatformVersion() Future<String?> Gets the Android OS version (e.g., "Android 14").
getIsConnected() Future<bool?> Checks if the device is connected to a network.
getConnectionType() Future<String?> Gets the connection type (Wi-Fi, Mobile Data, None).
getNetworkOperator() Future<String?> Gets the network operator name (requires READ_PHONE_STATE).
getSignalStrength() Future<int?> Gets the Wi-Fi signal strength in RSSI (dBm).
getDeviceName() Future<String?> Gets the device name (e.g., "realme C61").
getManufacturer() Future<String?> Gets the manufacturer (e.g., "realme").
getModel() Future<String?> Gets the device model (e.g., "RMX3930").
getOsVersion() Future<String?> Gets the OS version (e.g., "14").
getArchitecture() Future<String?> Gets the device architecture (e.g., "aarch64").
getDeviceId() Future<String?> Gets the unique device ID.
getTotalMemory() Future<int?> Gets the total memory in MB.
getAvailableStorage() Future<int?> Gets the available storage in MB.
Advanced Information
Method Return Type Description
getBatteryInfo() Future<Map<String, dynamic>?> Gets detailed battery information.
getCpuInfo() Future<Map<String, dynamic>?> Gets CPU details (cores, frequency, load).
getNetworkInfo() Future<Map<String, dynamic>?> Gets detailed network information (IP, DNS, etc.).
getScreenInfo() Future<Map<String, dynamic>?> Gets screen specifications.
getSensorInfo() Future<List<Map<String, dynamic>>?> Gets list of device sensors with details.
getStorageInfo() Future<Map<String, dynamic>?> Gets detailed storage information.
getCameraInfo() Future<List<Map<String, dynamic>>?> Gets camera specifications.
getBiometricInfo() Future<Map<String, dynamic>?> Gets biometric capabilities.
getSimInfo() Future<Map<String, dynamic>?> Gets SIM card details.
getSystemHealth() Future<Map<String, dynamic>?> Gets system health metrics.
getAccessibilityInfo() Future<List<String>?> Gets installed accessibility services.
getSecurityInfo() Future<Map<String, dynamic>?> Gets security information (root detection, etc.).
getAppUsageStats() Future<List<Map<String, dynamic>>?> Gets app usage statistics (requires special permission).
Event Streams
Method Return Type Description
batteryInfoStream() Stream<Map<String, dynamic>> Streams real-time battery updates.
Notes
  • All methods are asynchronous and return Futures. Use await to get the result ( e.g., await PhoneInfoPlugin.getDeviceName()).
  • Methods that may fail due to permissions (e.g., getNetworkOperator) return null if the data is unavailable.
  • Wrap method calls in try-catch blocks to handle potential platform exceptions.

Permissions

The plugin requires the following Android permissions:

Permission Purpose Runtime Permission Required?
ACCESS_WIFI_STATE Access Wi-Fi signal strength No
ACCESS_NETWORK_STATE Check network connection status No
READ_PHONE_STATE Get network operator name Yes (Android 6.0+)
PACKAGE_USAGE_STATS Get app usage statistics Yes (special approval)
Requesting Runtime Permissions

Use the permission_handler package to request permissions at runtime:

import 'package:permission_handler/permission_handler.dart';

Future<void> requestPermissions() async {
  if (await Permission.phone.request().isGranted) {
    // Permission granted
  } else {
    // Handle permission denial
  }
  
  // For app usage stats (special permission)
  if (await Permission.systemAppInfo.request().isGranted) {
    // Permission granted
  } else {
    // Direct user to settings
    await openAppSettings();
  }
}

Troubleshooting

  • MissingPluginException: If you see No implementation found for method ..., ensure the plugin is properly built:
    • Run flutter clean and flutter pub get in both the plugin and app directories.
    • Rebuild the app with flutter run.
  • Instance of 'Future<String?>': Ensure you use await when calling asynchronous methods ( e.g., await PhoneInfoPlugin.getDeviceName()).
  • Null Values: If methods like getNetworkOperator return null, check that the required permissions are granted.
  • Build Failures: Ensure your android/build.gradle includes androidx.core:core-ktx:1.12.0 and the correct Kotlin version (e.g., 1.8.22 or later).
  • App Usage Stats Not Working: This requires special permission. Guide users to enable it in settings:
    // Check if permission is granted
    if (!(await Permission.systemAppInfo.isGranted)) {
      // Open settings
      await openAppSettings();
    }
    

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature).
  3. Make your changes and commit (git commit -m 'Add your feature').
  4. Push to the branch (git push origin feature/your-feature).
  5. Open a Pull Request.

Please include tests and update the documentation for new features.

License

This plugin is licensed under the MIT License.

Contact

For issues or feature requests, please open an issue on the GitHub repository.

카테고리

의존성

의존성 목록 2 개

  • plugin_platform_interface^2.0.2
  • web^1.0.0

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.