Skip to content

Commit 437cb14

Browse files
authored
Update Android PartySample
1 parent d62cc3e commit 437cb14

File tree

110 files changed

+60810
-14399
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+60810
-14399
lines changed

.gitignore

+22-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
xcuserdata/
66

77
# Generated by Android Studio
8+
.cxx/
89
.gradle/
910
build/
10-
gradle/
11-
gradlew
12-
gradlew.bat
1311

1412
# Local configuration file (sdk path, etc)
1513
local.properties
@@ -58,3 +56,24 @@ fastlane/Preview.html
5856
fastlane/screenshots
5957
fastlane/test_output
6058
fastlane/readme.md
59+
60+
#
61+
## Visual Studio cache/options directory
62+
.vs/
63+
.vscode/
64+
65+
## User-added PlayFab Party Binaries
66+
# Debug
67+
android/bin/debug/arm64-v8a
68+
android/bin/debug/x86_64
69+
android/bin/debug/*.aar
70+
android/bin/debug/*.fpie
71+
# Release
72+
android/bin/release/arm64-v8a
73+
android/bin/release/x86_64
74+
android/bin/release/*.aar
75+
android/bin/release/*.fpie
76+
77+
## Output Binaries
78+
output/
79+
output_int/

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The compiled PlayFab Party library binaries are attached as zip assets to each t
66

77
Please download, unzip, and copy the corresponding asset folder for your platform:
88

9-
* iOS - `/iOS/bin/Release`
10-
* Android - `/android/bin`
9+
* iOS - `/iOS/bin/Release/`
10+
* Android - `/android/bin/release/`
1111
* Win32 - The win32 binaries are not included in the zip assets. They are available on download on [nuget](https://www.nuget.org/packages/Microsoft.PlayFab.PlayFabParty.Cpp.Windows).
1212
* Linux - `/x64/Release/libparty.so`

android/PartySample/README.md

+39-9
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,53 @@
11
# PartySample
22

3-
PartySample is a sample Android application with the PlayFabParty library integrated into it. Its purpose is to demonstrate the main functional capabilities provided by PlayFabParty API.
3+
PartySample is a sample Android application with the PlayFabParty library integrated into it. Its purpose is to demonstrate the main functional capabilities provided by the PlayFabParty API.
44

55
_Note: a registered PlayFab title is required to use PartySample app. Please refer to corresponding documentation._
66

77
## Building and Deploying to Device
8-
Please use the latest Android Studio.
8+
Please use the latest Android Studio. If you run into any issues, please refer to the [FAQ](#faq) before filing a GitHub Issue.
99

10-
1. Download `libparty_a-for-Android-Release.zip` from one of the PlayFabParty GitHub repository releases.
10+
1. Download `PlayFabParty.Android.Release.zip` (previously `libparty-android-release.zip`) from one of the PlayFab Party GitHub [repository releases](https://github.com/PlayFab/PlayFabParty/releases).
1111
2. Unzip the contents of the downloaded archive directly into `<REPO ROOT>/android/bin/release/`.
12-
3. In Android Studio, open a project, navigate to your cloned repository and select `<REPO ROOT>/android/PartySample/`
13-
4. Once the project has opened and gradle has synced, in Android Studio select `Run->Run 'demo'`
14-
5. Select your destination device and press `OK`
12+
3. In Android Studio, open a project, navigate to your cloned repository and select `<REPO ROOT>/android/PartySample/`.
13+
4. After the project has opened, run `Gradle Sync` in Android Studio.
14+
5. Navigate to `Build > Select Build Variant`. In the sidebar that opens, change the `Active Build Variant` for `:demo` to `fullRelease`.
15+
6. Navigate to `Build > Make Project`. You should see both the Java and C++ builds kickoff. You should see the following text if the build was successful.
16+
```
17+
BUILD SUCCESSFUL in xm xxs
18+
29 actionable tasks: 29 executed
19+
```
20+
7. In the top right, select the device you wish to deploy the `PartySample` app to. Navigate to `Run > Run 'demo'`.
21+
22+
a. You may run into the following error:
23+
```
24+
Error: The apk for your currently selected variant cannot be signed. Please specify a signing configuration for this variant (<build-variant>).
25+
```
26+
If you have a `signingConfig` you'd like to use, you may do so. Otherwise, you can just select the `Fix` button. That will add a `signingConfig` line to your `build.gradle` that looks like this: `signingConfig signingConfigs.debug`. **DO NOT CHECK THIS LINE INTO YOUR PRODUCTION APPLICATIONS.**
27+
28+
After you're clicked `Fix` and you've confirmed the line has been added, you can run the application again.
29+
5. If everything has gone well, you should see the application pop up on your device asking for permissions!
1530
1631
## Running
17-
As the PartySample app starts on your Android device it will show a screen asking you to provide a PlayFab title ID and select a sample user. Please provide the required information and tap "Login".
32+
As the PartySample app starts on your Android device it will show a screen asking you to provide a PlayFab title ID and select a sample user. Please provide the required information and tap "Login".
1833
1934
On the subsequent screen, you can choose your desired room number, language, and then `Create`, `Join` or `Leave` to get in and out of party rooms with other users.
2035
21-
The application is designed to demo PlayFabParty's voice, transcription and translation capabilities. Chat with your friends and then dig into the code to see how it's done!
36+
The application is designed to demo PlayFabParty's voice, transcription and translation capabilities. Chat with your friends and then dig into the code to see how it's done!
2237
23-
Good luck!
38+
Good luck!
39+
40+
## FAQ
41+
1. If you see an error similar to this:
42+
43+
```
44+
Unsupported Java.
45+
Your build is currently configured to use Java 17.0.6 and Gradle 6.6.
46+
47+
Possible solution:
48+
- Upgrade Gradle wrapper to 7.2 version and re-import the project
49+
```
50+
51+
Navigate to `Android Studio > Settings > Build, Execution, Deployment > Build Tools > Gradle` and change the Gradle JDK to version 1.8. You may need to download it.
52+
53+
After you have changed the Gradle JDK to version 1.8, run `Gradle Sync` again and verify that the error has disappeared.

android/PartySample/build.gradle

+24-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
import java.util.regex.Matcher
2+
import java.util.regex.Pattern
3+
14
// Top-level build file where you can add configuration options common to all sub-projects/modules.
25

36
buildscript {
4-
7+
58
repositories {
69
google()
7-
jcenter()
10+
mavenCentral()
11+
maven {
12+
url "https://maven.google.com"
13+
}
814
}
915
dependencies {
1016
classpath 'com.android.tools.build:gradle:4.1.2'
@@ -18,10 +24,25 @@ buildscript {
1824
allprojects {
1925
repositories {
2026
google()
21-
jcenter()
27+
mavenCentral()
28+
maven {
29+
url "https://maven.google.com"
30+
}
2231
}
2332
}
2433

34+
ext.getTaskFlavorName = { taskPrefix, task ->
35+
36+
Pattern pattern
37+
pattern = Pattern.compile(taskPrefix + "(\\w+)(Release|Debug)")
38+
39+
Matcher matcher = pattern.matcher( task.name )
40+
if( matcher.find() )
41+
return matcher.group(1)
42+
43+
return ""
44+
}
45+
2546
task clean(type: Delete) {
2647
delete rootProject.buildDir
2748
}

android/PartySample/demo/AndroidManifest.xml

+9-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
1212
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
1313
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
14+
<uses-permission android:name="android.permission.BLUETOOTH"/>
15+
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
16+
<!-- Needed only if your app looks for Bluetooth devices. -->
17+
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
18+
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
1419

1520
<application
1621
android:allowBackup="true"
@@ -19,14 +24,14 @@
1924
android:roundIcon="@drawable/playfab_logo"
2025
android:supportsRtl="true"
2126
android:theme="@style/AppTheme">
22-
<activity android:screenOrientation="landscape"
27+
<activity android:screenOrientation="portrait"
2328
android:name=".ChatActivity">
2429
</activity>
25-
<activity android:screenOrientation="landscape"
26-
android:name=".MainActivity">
30+
<activity android:screenOrientation="portrait"
31+
android:name=".MainActivity"
32+
android:exported="true">
2733
<intent-filter>
2834
<action android:name="android.intent.action.MAIN" />
29-
3035
<category android:name="android.intent.category.LAUNCHER" />
3136
</intent-filter>
3237
</activity>

android/PartySample/demo/build.gradle

+44-16
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@ apply plugin: 'com.android.application'
22
def libType
33

44
android {
5-
compileSdkVersion 28
5+
compileSdkVersion 34
6+
ndkVersion "21.1.6352462"
7+
68
defaultConfig {
79
applicationId "com.microsoft.playfab.partysample"
8-
minSdkVersion 19
9-
targetSdkVersion 28
10+
minSdkVersion 21
11+
targetSdkVersion 34
1012
versionCode 1
1113
versionName "1.0"
12-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14+
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
1315
externalNativeBuild {
1416
cmake {
1517
cppFlags "-std=c++14 -fexceptions -Wall -Wextra -Werror"
16-
abiFilters "arm64-v8a","armeabi-v7a","x86","x86_64"
1718
}
1819
}
1920
}
@@ -27,36 +28,63 @@ android {
2728
libType = 'debug'
2829
}
2930
}
31+
flavorDimensions "ABI"
32+
productFlavors {
33+
full {
34+
dimension "ABI"
35+
externalNativeBuild {
36+
cmake {
37+
abiFilters "arm64-v8a", "x86_64"
38+
}
39+
}
40+
}
41+
arm8 {
42+
dimension "ABI"
43+
externalNativeBuild {
44+
cmake {
45+
abiFilters "arm64-v8a"
46+
}
47+
}
48+
}
49+
x86_64 {
50+
dimension "ABI"
51+
externalNativeBuild {
52+
cmake {
53+
abiFilters "x86_64"
54+
}
55+
}
56+
}
57+
}
3058
externalNativeBuild {
3159
cmake {
32-
path file('./src/main/cpp/CMakeLists.txt')
60+
path file('src/main/cpp/CMakeLists.txt')
3361
}
3462
}
3563
sourceSets {
3664
main {
3765
manifest.srcFile 'AndroidManifest.xml'
38-
java.srcDir '.src/main/java'
39-
res.srcDir './src/main/res'
66+
java.srcDir 'src/main/java'
67+
res.srcDir 'src/main/res'
4068
}
4169
}
4270
repositories {
4371
flatDir {
44-
dirs = ['../../../../output/android/debug', '../../../../output/android/release']
72+
dirs = ['../../../../output/android/party/PlayFabParty/debug', '../../../../output/android/party/PlayFabParty/release']
4573
}
4674
}
4775
}
4876

4977
dependencies {
5078
implementation fileTree(include: ['*.jar'], dir: 'libs')
51-
implementation 'com.android.support:appcompat-v7:28.0.0'
52-
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
79+
implementation 'androidx.appcompat:appcompat:1.0.0'
80+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
5381
testImplementation 'junit:junit:4.12'
54-
androidTestImplementation 'com.android.support.test:runner:1.0.2'
55-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
56-
implementation 'com.android.support:recyclerview-v7:28.0.0'
82+
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
83+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
84+
implementation 'androidx.recyclerview:recyclerview:1.0.0'
5785
implementation 'com.google.code.gson:gson:2.8.5'
5886
implementation 'com.playfab:client-sdk:0.82.181218'
59-
implementation 'com.squareup.okhttp3:okhttp:4.0.0-alpha02'
87+
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
6088
releaseImplementation fileTree(include: ['*.aar'], dir: '../../bin/release')
61-
debugImplementation fileTree(include: ['*.aar'], dir: '../../bin/release')
89+
debugImplementation fileTree(include: ['*.aar'], dir: '../../bin/debug')
6290
}

0 commit comments

Comments
 (0)