-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Atul Kumar
committed
Feb 18, 2020
1 parent
4a7da39
commit 9093eb4
Showing
7 changed files
with
108 additions
and
87 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 1.0.0 | ||
|
||
* stable version | ||
|
||
## 0.0.2 | ||
|
||
* update documentation | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,82 @@ | ||
# flutter_advertising_id | ||
|
||
Flutter plugin to get GAID android and IDFA ios. | ||
|
||
A new Flutter project. | ||
Demonstrates how to use the flutter_advertising_id plugin. | ||
|
||
## Usage | ||
To use this plugin, add `flutter_advertising_id` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/). | ||
|
||
## Getting Started | ||
|
||
This project is a starting point for a Flutter | ||
[plug-in package](https://flutter.dev/developing-packages/), | ||
a specialized package that includes platform-specific implementation code for | ||
Android and/or iOS. | ||
Check out the `example` directory for a sample app using flutter advertising id. | ||
|
||
In your flutter project add the dependency: | ||
|
||
```yml | ||
dependencies: | ||
... | ||
flutter_advertising_id: ^0.0.1 | ||
``` | ||
For help getting started with Flutter, view the online | ||
[documentation](https://flutter.io/). | ||
## Usage example | ||
import `package:flutter_advertising_id/flutter_advertising_id.dart;` | ||
|
||
```dart | ||
import 'package:flutter_advertising_id/flutter_advertising_id.dart'; | ||
``` | ||
|
||
```$xslt | ||
class MyApp extends StatefulWidget { | ||
@override | ||
_MyAppState createState() => _MyAppState(); | ||
} | ||
class _MyAppState extends State<MyApp> { | ||
String _advertisingId = 'Unknown'; | ||
@override | ||
void initState() { | ||
super.initState(); | ||
initPlatformState(); | ||
} | ||
// AdvertisingId are asynchronous, so we initialize in an async method. | ||
Future<void> initPlatformState() async { | ||
String advertisingId; | ||
// Advertising id may fail, so we use a try/catch PlatformException. | ||
try { | ||
advertisingId = await FlutterAdvertisingId.advertisingId; | ||
} on PlatformException { | ||
advertisingId = 'Failed to get platform version.'; | ||
} | ||
// If the widget was removed from the tree while the asynchronous platform | ||
// message was in flight, we want to discard the reply rather than calling | ||
// setState to update our non-existent appearance. | ||
if (!mounted) return; | ||
setState(() { | ||
_advertisingId = advertisingId; | ||
}); | ||
} | ||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
home: Scaffold( | ||
appBar: AppBar( | ||
title: const Text('Plugin example app'), | ||
), | ||
body: Center( | ||
child: Text('Running on: $_advertisingId\n'), | ||
), | ||
), | ||
); | ||
} | ||
} | ||
For help getting started with Flutter, view our | ||
[online documentation](https://flutter.dev/docs), which offers tutorials, | ||
samples, guidance on mobile development, and a full API reference. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,16 @@ | ||
# flutter_advertising_id | ||
|
||
Flutter plugin to get GAID android and IDFA ios. | ||
# flutter_advertising_id_example | ||
|
||
Demonstrates how to use the flutter_advertising_id plugin. | ||
|
||
## Usage | ||
To use this plugin, add `flutter_advertising_id` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/). | ||
|
||
## Getting Started | ||
|
||
Check out the `example` directory for a sample app using flutter advertising id. | ||
|
||
In your flutter project add the dependency: | ||
|
||
```yml | ||
dependencies: | ||
... | ||
flutter_advertising_id: ^0.0.1 | ||
``` | ||
For help getting started with Flutter, view the online | ||
[documentation](https://flutter.io/). | ||
## Usage example | ||
import `package:flutter_advertising_id/flutter_advertising_id.dart;` | ||
|
||
```dart | ||
import 'package:flutter_advertising_id/flutter_advertising_id.dart'; | ||
``` | ||
|
||
```$xslt | ||
class MyApp extends StatefulWidget { | ||
@override | ||
_MyAppState createState() => _MyAppState(); | ||
} | ||
class _MyAppState extends State<MyApp> { | ||
String _advertisingId = 'Unknown'; | ||
@override | ||
void initState() { | ||
super.initState(); | ||
initPlatformState(); | ||
} | ||
// AdvertisingId are asynchronous, so we initialize in an async method. | ||
Future<void> initPlatformState() async { | ||
String advertisingId; | ||
// Advertising id may fail, so we use a try/catch PlatformException. | ||
try { | ||
advertisingId = await FlutterAdvertisingId.advertisingId; | ||
} on PlatformException { | ||
advertisingId = 'Failed to get platform version.'; | ||
} | ||
// If the widget was removed from the tree while the asynchronous platform | ||
// message was in flight, we want to discard the reply rather than calling | ||
// setState to update our non-existent appearance. | ||
if (!mounted) return; | ||
This project is a starting point for a Flutter application. | ||
|
||
setState(() { | ||
_advertisingId = advertisingId; | ||
}); | ||
} | ||
A few resources to get you started if this is your first Flutter project: | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
home: Scaffold( | ||
appBar: AppBar( | ||
title: const Text('Plugin example app'), | ||
), | ||
body: Center( | ||
child: Text('Running on: $_advertisingId\n'), | ||
), | ||
), | ||
); | ||
} | ||
} | ||
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) | ||
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) | ||
|
||
``` | ||
For help getting started with Flutter, view our | ||
[online documentation](https://flutter.dev/docs), which offers tutorials, | ||
samples, guidance on mobile development, and a full API reference. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
name: flutter_advertising_id | ||
description: A new Flutter project. | ||
version: 0.0.2 | ||
description: Flutter plugin for Android and IOS, a cross-platform to get | ||
Advertising id that is GAID for android and IDFA for ios. this plugin using kotlin android and swift ios for implement method channel. | ||
version: 1.0.0 | ||
author: Atul kumar <[email protected]> | ||
homepage: https://github.com/iamatulkumar/flutter_advertising_id | ||
|
||
|