Skip to content

Commit 2294dd5

Browse files
committed
fix and update android example
1 parent a509daf commit 2294dd5

File tree

22 files changed

+215
-193
lines changed

22 files changed

+215
-193
lines changed

example/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ app.*.map.json
4545
/android/app/release
4646

4747
android/app/.cxx/
48+
lib/firebase_options.dart

example/.metadata

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,42 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 60bd88df915880d23877bfc1602e8ddcf4c4dd2a
8-
channel: stable
7+
revision: "19074d12f7eaf6a8180cd4036a430c1d76de904e"
8+
channel: "stable"
99

1010
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
17+
base_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
18+
- platform: android
19+
create_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
20+
base_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
21+
- platform: ios
22+
create_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
23+
base_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
24+
- platform: linux
25+
create_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
26+
base_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
27+
- platform: macos
28+
create_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
29+
base_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
30+
- platform: web
31+
create_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
32+
base_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
33+
- platform: windows
34+
create_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
35+
base_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
36+
37+
# User provided section
38+
39+
# List of Local paths (relative to this file) that should be
40+
# ignored by the migrate tool.
41+
#
42+
# Files that are not part of the templates will be ignored by default.
43+
unmanaged_files:
44+
- 'lib/main.dart'
45+
- 'ios/Runner.xcodeproj/project.pbxproj'

example/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
Demonstrates how to use the twilio_voice plugin.
44

5-
## Getting Started
5+
## Getting Started - Android
66

7-
This project is a starting point for a Flutter application.
8-
9-
A few resources to get you started if this is your first Flutter project:
10-
11-
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12-
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
13-
14-
For help getting started with Flutter, view our
15-
[online documentation](https://flutter.dev/docs), which offers tutorials,
16-
samples, guidance on mobile development, and a full API reference.
7+
- Create firebase project
8+
- Create android application
9+
- install `flutterfire_cli`
10+
```shell
11+
dart pub global activate flutterfire_cli
12+
```
13+
- run in terminal
14+
```shell
15+
flutterfire configure --project=[your_firebase_project_name] --android-app-id=[your_android_app_id] --platforms=android
16+
```

example/android/.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ gradle-wrapper.jar
55
/gradlew.bat
66
/local.properties
77
GeneratedPluginRegistrant.java
8-
/app/google-services.json
8+
.cxx/
9+
google-services.json
10+
911
# Remember to never publicly share your keystore.
10-
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
12+
# See https://flutter.dev/to/reference-keystore
1113
key.properties
14+
**/*.keystore
15+
**/*.jks

example/android/app/build.gradle

Lines changed: 0 additions & 60 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
plugins {
2+
id("com.android.application")
3+
// START: FlutterFire Configuration
4+
id("com.google.gms.google-services")
5+
// END: FlutterFire Configuration
6+
id("kotlin-android")
7+
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
8+
id("dev.flutter.flutter-gradle-plugin")
9+
}
10+
11+
android {
12+
namespace = "com.twilio.twilio_voice_example"
13+
compileSdk = flutter.compileSdkVersion
14+
ndkVersion = flutter.ndkVersion
15+
16+
compileOptions {
17+
sourceCompatibility = JavaVersion.VERSION_17
18+
targetCompatibility = JavaVersion.VERSION_17
19+
}
20+
21+
kotlinOptions {
22+
jvmTarget = JavaVersion.VERSION_17.toString()
23+
}
24+
25+
defaultConfig {
26+
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
27+
applicationId = "com.twilio.twilio_voice_example"
28+
// You can update the following values to match your application needs.
29+
// For more information, see: https://flutter.dev/to/review-gradle-config.
30+
minSdk = 26
31+
targetSdk = flutter.targetSdkVersion
32+
versionCode = flutter.versionCode
33+
versionName = flutter.versionName
34+
}
35+
36+
buildTypes {
37+
release {
38+
// TODO: Add your own signing config for the release build.
39+
// Signing with the debug keys for now, so `flutter run --release` works.
40+
signingConfig = signingConfigs.getByName("debug")
41+
}
42+
}
43+
}
44+
45+
flutter {
46+
source = "../.."
47+
}
48+
49+
dependencies {
50+
implementation(platform("com.google.firebase:firebase-bom:34.6.0"))
51+
implementation("com.google.firebase:firebase-analytics")
52+
}

example/android/app/src/debug/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2-
<!-- Flutter needs it to communicate with the running application
2+
<!-- The INTERNET permission is required for development. Specifically,
3+
the Flutter tool needs it to communicate with the running application
34
to allow setting breakpoints, to provide hot reload, etc.
45
-->
56
<uses-permission android:name="android.permission.INTERNET"/>
Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,45 @@
1-
<manifest xmlns:tools="http://schemas.android.com/tools"
2-
xmlns:android="http://schemas.android.com/apk/res/android">
3-
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
42
<application
5-
android:icon="@mipmap/ic_launcher"
6-
android:label="twilio_voice_example">
3+
android:label="twilio_voice_example"
4+
android:name="${applicationName}"
5+
android:icon="@mipmap/ic_launcher">
76
<activity
87
android:name=".MainActivity"
9-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
108
android:exported="true"
11-
android:hardwareAccelerated="true"
129
android:launchMode="singleTop"
10+
android:taskAffinity=""
1311
android:theme="@style/LaunchTheme"
12+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
13+
android:hardwareAccelerated="true"
1414
android:windowSoftInputMode="adjustResize">
1515
<!-- Specifies an Android theme to apply to this Activity as soon as
1616
the Android process has started. This theme is visible to the user
1717
while the Flutter UI initializes. After that, this theme continues
1818
to determine the Window background behind the Flutter UI. -->
1919
<meta-data
20-
android:name="io.flutter.embedding.android.NormalTheme"
21-
android:resource="@style/NormalTheme" />
22-
<!-- Displays an Android View that continues showing the launch screen
23-
Drawable until Flutter paints its first frame, then this splash
24-
screen fades out. A splash screen is useful to avoid any visual
25-
gap between the end of Android's launch screen and the painting of
26-
Flutter's first frame. -->
27-
<meta-data
28-
android:name="io.flutter.embedding.android.SplashScreenDrawable"
29-
android:resource="@drawable/launch_background" />
20+
android:name="io.flutter.embedding.android.NormalTheme"
21+
android:resource="@style/NormalTheme"
22+
/>
3023
<intent-filter>
31-
<action android:name="android.intent.action.MAIN" />
32-
<category android:name="android.intent.category.LAUNCHER" />
24+
<action android:name="android.intent.action.MAIN"/>
25+
<category android:name="android.intent.category.LAUNCHER"/>
3326
</intent-filter>
3427
</activity>
35-
<service
36-
android:name="com.twilio.twilio_voice.fcm.VoiceFirebaseMessagingService"
37-
android:exported="false"
38-
android:stopWithTask="false">
39-
<intent-filter>
40-
<action android:name="com.google.firebase.MESSAGING_EVENT" />
41-
</intent-filter>
42-
</service>
4328
<!-- Don't delete the meta-data below.
4429
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
4530
<meta-data
4631
android:name="flutterEmbedding"
4732
android:value="2" />
4833
</application>
34+
<!-- Required to query activities that can process text, see:
35+
https://developer.android.com/training/package-visibility and
36+
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
37+
38+
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
39+
<queries>
40+
<intent>
41+
<action android:name="android.intent.action.PROCESS_TEXT"/>
42+
<data android:mimeType="text/plain"/>
43+
</intent>
44+
</queries>
4945
</manifest>

example/android/app/src/main/java/com/twilio/twilio_voice_example/MainActivity.java

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.twilio.twilio_voice_example
2+
3+
import io.flutter.embedding.android.FlutterActivity
4+
5+
class MainActivity : FlutterActivity()

0 commit comments

Comments
 (0)