Skip to content

Commit

Permalink
chore: bump the version
Browse files Browse the repository at this point in the history
  • Loading branch information
Atul Kumar committed Feb 18, 2020
1 parent 4a7da39 commit 9093eb4
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 87 deletions.
7 changes: 4 additions & 3 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.0

* stable version

## 0.0.2

* update documentation
Expand Down
84 changes: 76 additions & 8 deletions README.md
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.
```
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright 2020 The Author. All rights reserved.
// Use of this source code is governed by a license that can be
// found in the LICENSE file.

package com.pocketpills.advertisingid.flutter_advertising_id

import com.google.android.gms.ads.identifier.AdvertisingIdClient
Expand All @@ -11,6 +15,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers

/** FlutterAdvertisingIdPlugin */
class FlutterAdvertisingIdPlugin(private val registrar: Registrar) : MethodCallHandler {

companion object {
Expand All @@ -21,6 +26,9 @@ class FlutterAdvertisingIdPlugin(private val registrar: Registrar) : MethodCallH
}
}

/**
* Method channel
*/
override fun onMethodCall(call: MethodCall, result: Result) {
when (call.method) {
"getAdvertisingId" -> {
Expand Down
82 changes: 8 additions & 74 deletions example/README.md
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.
5 changes: 5 additions & 0 deletions ios/Classes/SwiftFlutterAdvertisingIdPlugin.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
// Copyright 2020 The Author. All rights reserved.
// Use of this source code is governed by a license that can be
// found in the LICENSE file.
import Flutter
import UIKit
import AdSupport

/*SwiftFlutterAdvertisingIdPlugin*/
public class SwiftFlutterAdvertisingIdPlugin: NSObject, FlutterPlugin {
public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: "flutter_advertising_id", binaryMessenger: registrar.messenger())
let instance = SwiftFlutterAdvertisingIdPlugin()
registrar.addMethodCallDelegate(instance, channel: channel)
}

// Method Channel
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
switch call.method {
case "getAdvertisingId":
Expand Down
5 changes: 3 additions & 2 deletions pubspec.yaml
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

Expand Down

0 comments on commit 9093eb4

Please sign in to comment.