Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(data_strength_plus): ANDROID_DEPLOYMENT_TARGET 0.0.1 #2596

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 0.0.1

Added the Data Strength plus
1. To Get Wifi strength (dBm) and Mbps.
2. To Get Mobile Data Strength
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ support for more platforms and better maintenance.
- [Share➕ (`share_plus`)](#share_plus)
- [Android Alarm Manager➕ (`android_alarm_manager_plus`)](#android_alarm_manager_plus)
- [Android Intent➕ (`android_intent_plus`)](#android_intent_plus)
- [Data Strength Plus ➕ (`data_strength_plus`)](#data_strength_plus)

---

Expand Down Expand Up @@ -185,6 +186,22 @@ Flutter plugin for launching Android Intents. Not supported on iOS.

---

### `data_strength_plus`

> [![data_strength_plus][data_strength_plus_badge_pub]][data_strength_plus] [![pub points][data_strength_plus_badge_pub_points]][data_strength_plus_pub_points]

Flutter plugin for launching Android Intents. Not supported on iOS.

[[View Source][data_strength_plus_code]]

#### Platform Support

| Android |
| :-----: |
| ✅ |

---

## Issues

Please file PlusPlugins specific issues, bugs, or feature requests in our [issue tracker](https://github.com/fluttercommunity/plus_plugins/issues/new).
Expand Down
37 changes: 37 additions & 0 deletions docs/data_strength_plus/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: Data Strength Plus Overview
sidebar_label: Overview
hide_title: true
---

## Data Strength Plus Overview

A Flutter plugin for accessing the Android Data Strength service, and running
Dart code in the background when alarms fire.

### Get started

#### 1. Add it to your project

```yaml {4} title="pubspec.yaml"
dependencies:
flutter:
sdk: flutter
data_strength_plus: "^{{ plugins.data_strength_plus }}"
```

#### 2. Download dependency

```bash
$ flutter pub get
```

#### 3. Rebuild the app

```bash
$ flutter run
```

### Next steps

Read the [usage page](usage.mdx) to see examples of how to use the package.
109 changes: 109 additions & 0 deletions docs/data_strength_plus/usage.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
title: Android Alarm Manager Plus Usage
sidebar_label: Usage
hide_title: true
---

After importing this plugin to your project as usual, add the following to your
`AndroidManifest.xml` within the `<manifest></manifest>` tags:

```xml

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
```

Then in Dart code add:

```dart
import 'package:data_strength_plus/data_strength_plus.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';

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

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

@override
State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
int? _mobileSignal;
int? _wifiSignal;
int? _wifiSpeed;
String? _version;

final _internetSignal = DataStrengthPlus();

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

Future<void> _getPlatformVersion() async {
try {
_version = await _internetSignal.getPlatformVersion();
} on PlatformException {
if (kDebugMode) print('Error get Android version.');
_version = null;
}
setState(() {});
}

Future<void> _getInternetSignal() async {
int? mobile;
int? wifi;
int? wifiSpeed;
try {
mobile = await _internetSignal.getMobileSignalStrength();
wifi = await _internetSignal.getWifiSignalStrength();
wifiSpeed = await _internetSignal.getWifiLinkSpeed();
} on PlatformException {
if (kDebugMode) print('Error get internet signal.');
}
setState(() {
_mobileSignal = mobile;
_wifiSignal = wifi;
_wifiSpeed = wifiSpeed;
});
}

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Internet Signal Example'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('On Version: $_version \n'),
Text(
'Mobile signal: ${_mobileSignal ?? '--'} dBm ::${DataStrengthPlus.rangeName(_mobileSignal)}\n'),
Text(
'Wifi signal: ${_wifiSignal ?? '--'} dBm :: ${DataStrengthPlus.rangeName(_wifiSignal)}\n'),
Text('Wifi speed: ${_wifiSpeed ?? '--'} Mbps\n'),
ElevatedButton(
onPressed: _getInternetSignal,
child: const Text('Get internet signal'),
)
],
),
),
),
);
}
}
```
25 changes: 25 additions & 0 deletions packages/data_strength_plus/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Auto detect text files and perform LF normalization
* text=auto

# Always perform LF normalization on these files
*.dart text
*.gradle text
*.html text
*.java text
*.json text
*.md text
*.py text
*.sh text
*.txt text
*.xml text
*.yaml text

# Make sure that these Windows files always have CRLF line endings in checkout
*.bat text eol=crlf
*.ps1 text eol=crlf

# Never perform LF normalization on these files
*.ico binary
*.jar binary
*.png binary
*.zip binary
47 changes: 47 additions & 0 deletions packages/data_strength_plus/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.DS_Store
.atom/
.idea/
.vscode/

.packages
.pub/
.dart_tool/
pubspec.lock
flutter_export_environment.sh

examples/all_plugins/pubspec.yaml

Podfile
Podfile.lock
Pods/
.symlinks/
**/Flutter/App.framework/
**/Flutter/ephemeral/
**/Flutter/Flutter.framework/
**/Flutter/Generated.xcconfig
**/Flutter/flutter_assets/

ServiceDefinitions.json
xcuserdata/
**/DerivedData/

local.properties
keystore.properties
.gradle/
gradlew
gradlew.bat
gradle-wrapper.jar
.flutter-plugins-dependencies
*.iml

generated_plugin_registrant.dart
GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m
GeneratedPluginRegistrant.java
GeneratedPluginRegistrant.swift
build/
.flutter-plugins

.project
.classpath
.settings
42 changes: 42 additions & 0 deletions packages/data_strength_plus/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "ead455963c12b453cdb2358cad34969c76daf180"
channel: "stable"

project_type: plugin

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: ead455963c12b453cdb2358cad34969c76daf180
base_revision: ead455963c12b453cdb2358cad34969c76daf180
- platform: android
create_revision: ead455963c12b453cdb2358cad34969c76daf180
base_revision: ead455963c12b453cdb2358cad34969c76daf180
- platform: ios
create_revision: ead455963c12b453cdb2358cad34969c76daf180
base_revision: ead455963c12b453cdb2358cad34969c76daf180
- platform: linux
create_revision: ead455963c12b453cdb2358cad34969c76daf180
base_revision: ead455963c12b453cdb2358cad34969c76daf180
- platform: macos
create_revision: ead455963c12b453cdb2358cad34969c76daf180
base_revision: ead455963c12b453cdb2358cad34969c76daf180
- platform: windows
create_revision: ead455963c12b453cdb2358cad34969c76daf180
base_revision: ead455963c12b453cdb2358cad34969c76daf180

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
6 changes: 6 additions & 0 deletions packages/data_strength_plus/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## 0.0.1

1. Signal Strength of Wifi Data (dMs)
2. Signal Strength of Mobile Data (dMs)
3. Wifi Signal Speed.

27 changes: 27 additions & 0 deletions packages/data_strength_plus/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright 2017 The Chromium Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading
Loading