Skip to content

Commit 787e136

Browse files
committed
Migrate to embedding v2.
1 parent ea27835 commit 787e136

File tree

4 files changed

+21
-89
lines changed

4 files changed

+21
-89
lines changed

android/app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222
additional functionality it is fine to subclass or reimplement
2323
FlutterApplication and put your custom class here. -->
2424
<application
25-
android:name="io.flutter.app.FlutterApplication"
2625
android:label="flutter_webrtc_demo"
2726
android:icon="@mipmap/ic_launcher">
27+
<meta-data
28+
android:name="flutterEmbedding"
29+
android:value="2" />
2830
<activity
29-
android:name=".MainActivity"
31+
android:name="io.flutter.embedding.android.FlutterActivity"
3032
android:launchMode="singleTop"
3133
android:theme="@style/LaunchTheme"
3234
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
package com.cloudwebrtc.flutterwebrtcdemo;
22

3-
import android.os.Bundle;
4-
import io.flutter.app.FlutterActivity;
5-
import io.flutter.plugins.GeneratedPluginRegistrant;
3+
import io.flutter.embedding.android.FlutterActivity;
64

75
public class MainActivity extends FlutterActivity {
8-
@Override
9-
protected void onCreate(Bundle savedInstanceState) {
10-
super.onCreate(savedInstanceState);
11-
GeneratedPluginRegistrant.registerWith(this);
12-
}
136
}
Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
11
package io.flutter.plugins;
22

3-
import io.flutter.plugin.common.PluginRegistry;
4-
import com.cloudwebrtc.webrtc.FlutterWebRTCPlugin;
5-
import io.flutter.plugins.pathprovider.PathProviderPlugin;
6-
import io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin;
3+
import androidx.annotation.Keep;
4+
import androidx.annotation.NonNull;
5+
6+
import io.flutter.embedding.engine.FlutterEngine;
77

88
/**
99
* Generated file. Do not edit.
10+
* This file is generated by the Flutter tool based on the
11+
* plugins that support the Android platform.
1012
*/
13+
@Keep
1114
public final class GeneratedPluginRegistrant {
12-
public static void registerWith(PluginRegistry registry) {
13-
if (alreadyRegisteredWith(registry)) {
14-
return;
15-
}
16-
FlutterWebRTCPlugin.registerWith(registry.registrarFor("com.cloudwebrtc.webrtc.FlutterWebRTCPlugin"));
17-
PathProviderPlugin.registerWith(registry.registrarFor("io.flutter.plugins.pathprovider.PathProviderPlugin"));
18-
SharedPreferencesPlugin.registerWith(registry.registrarFor("io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin"));
19-
}
20-
21-
private static boolean alreadyRegisteredWith(PluginRegistry registry) {
22-
final String key = GeneratedPluginRegistrant.class.getCanonicalName();
23-
if (registry.hasPlugin(key)) {
24-
return true;
25-
}
26-
registry.registrarFor(key);
27-
return false;
15+
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
16+
flutterEngine.getPlugins().add(new com.cloudwebrtc.webrtc.FlutterWebRTCPlugin());
17+
flutterEngine.getPlugins().add(new io.flutter.plugins.pathprovider.PathProviderPlugin());
18+
flutterEngine.getPlugins().add(new io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin());
2819
}
2920
}

pubspec.yaml

Lines changed: 5 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,23 @@
11
name: flutter_webrtc_demo
22
description: A new Flutter application.
3-
4-
# The following defines the version and build number for your application.
5-
# A version number is three numbers separated by dots, like 1.2.43
6-
# followed by an optional build number separated by a +.
7-
# Both the version and the builder number may be overridden in flutter
8-
# build by specifying --build-name and --build-number, respectively.
9-
# Read more about versioning at semver.org.
103
version: 1.0.1
114

125
environment:
13-
sdk: ">=2.6.0 <3.0.0"
6+
sdk: ">=2.2.2 <3.0.0"
147

158
dependencies:
169
flutter:
1710
sdk: flutter
1811

19-
# The following adds the Cupertino Icons font to your application.
20-
# Use with the CupertinoIcons class for iOS style icons.
2112
cupertino_icons: ^1.0.0
22-
flutter_webrtc: ^0.5.2
23-
shared_preferences:
24-
shared_preferences_macos:
25-
shared_preferences_web:
13+
flutter_webrtc: ^0.5.7
14+
shared_preferences: ^0.5.12
2615
http: ^0.12.1
27-
28-
# Required for MediaRecorder example
29-
path_provider:
30-
path_provider_macos:
16+
path_provider: ^1.6.24
3117

3218
dev_dependencies:
3319
flutter_test:
3420
sdk: flutter
3521

36-
37-
# For information on the generic Dart part of this file, see the
38-
# following page: https://www.dartlang.org/tools/pub/pubspec
39-
40-
# The following section is specific to Flutter.
4122
flutter:
42-
43-
# The following line ensures that the Material Icons font is
44-
# included with your application, so that you can use the icons in
45-
# the material Icons class.
46-
uses-material-design: true
47-
48-
# To add assets to your application, add an assets section, like this:
49-
# assets:
50-
# - images/a_dot_burr.jpeg
51-
# - images/a_dot_ham.jpeg
52-
53-
# An image asset can refer to one or more resolution-specific "variants", see
54-
# https://flutter.io/assets-and-images/#resolution-aware.
55-
56-
# For details regarding adding assets from package dependencies, see
57-
# https://flutter.io/assets-and-images/#from-packages
58-
59-
# To add custom fonts to your application, add a fonts section here,
60-
# in this "flutter" section. Each entry in this list should have a
61-
# "family" key with the font family name, and a "fonts" key with a
62-
# list giving the asset and other descriptors for the font. For
63-
# example:
64-
# fonts:
65-
# - family: Schyler
66-
# fonts:
67-
# - asset: fonts/Schyler-Regular.ttf
68-
# - asset: fonts/Schyler-Italic.ttf
69-
# style: italic
70-
# - family: Trajan Pro
71-
# fonts:
72-
# - asset: fonts/TrajanPro.ttf
73-
# - asset: fonts/TrajanPro_Bold.ttf
74-
# weight: 700
75-
#
76-
# For details regarding fonts from package dependencies,
77-
# see https://flutter.io/custom-fonts/#from-packages
23+
uses-material-design: true

0 commit comments

Comments
 (0)