Fix
This commit is contained in:
@@ -2,12 +2,13 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0">
|
||||||
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
|
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
|
||||||
<application android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true">
|
<application android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true">
|
||||||
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name">
|
<activity android:name="com.google.firebase.MessagingUnityPlayerActivity" android:label="@string/app_name" android:theme="@style/BaseUnityGameActivityTheme" android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
|
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
|
||||||
|
<meta-data android:name="android.app.lib_name" android:value="game" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
|
<activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
|
||||||
<activity android:name="com.facebook.unity.FBUnityDialogsActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
|
<activity android:name="com.facebook.unity.FBUnityDialogsActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?><resources><string name="com.crashlytics.android.build_id" translatable="false">b1198bcb-9e68-42ca-afdc-de38c0753861</string></resources>
|
<?xml version="1.0" encoding="utf-8"?><resources><string name="com.crashlytics.android.build_id" translatable="false">0a4c6c8f-8290-4f0a-8af5-899267e3f184</string></resources>
|
||||||
|
|||||||
82
Assets/Plugins/Android/MessagingUnityPlayerActivity.java
Normal file
82
Assets/Plugins/Android/MessagingUnityPlayerActivity.java
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is generated by the FirebaseMessagingActivityGenerator script.
|
||||||
|
* Refer to that script for more information.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.google.firebase;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import com.google.firebase.messaging.MessageForwardingService;
|
||||||
|
import com.unity3d.player.UnityPlayerGameActivity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MessagingUnityPlayerActivity is a UnityPlayerGameActivity that updates its intent when new intents
|
||||||
|
* are sent to it.
|
||||||
|
*
|
||||||
|
* This is a workaround for a known issue that prevents Firebase Cloud Messaging from responding to
|
||||||
|
* data payloads when both a data and notification payload are sent to the app while it is in the
|
||||||
|
* background.
|
||||||
|
*/
|
||||||
|
public class MessagingUnityPlayerActivity extends UnityPlayerGameActivity {
|
||||||
|
// The key in the intent's extras that maps to the incoming message's message ID. Only sent by
|
||||||
|
// the server, GmsCore sends EXTRA_MESSAGE_ID_KEY below. Server can't send that as it would get
|
||||||
|
// stripped by the client.
|
||||||
|
private static final String EXTRA_MESSAGE_ID_KEY_SERVER = "message_id";
|
||||||
|
|
||||||
|
// An alternate key value in the intent's extras that also maps to the incoming message's message
|
||||||
|
// ID. Used by upstream, and set by GmsCore.
|
||||||
|
private static final String EXTRA_MESSAGE_ID_KEY = "google.message_id";
|
||||||
|
|
||||||
|
// The key in the intent's extras that maps to the incoming message's sender value.
|
||||||
|
private static final String EXTRA_FROM = "google.message_id";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Workaround for when a message is sent containing both a Data and Notification payload.
|
||||||
|
*
|
||||||
|
* <p>When the app is in the background, if a message with both a data and notification payload is
|
||||||
|
* received the data payload is stored on the Intent passed to onNewIntent. By default, that
|
||||||
|
* intent does not get set as the Intent that started the app, so when the app comes back online
|
||||||
|
* it doesn't see a new FCM message to respond to. As a workaround, we override onNewIntent so
|
||||||
|
* that it sends the intent to the MessageForwardingService which forwards the message to the
|
||||||
|
* FirebaseMessagingService which in turn sends the message to the application.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void onNewIntent(Intent intent) {
|
||||||
|
super.onNewIntent(intent);
|
||||||
|
|
||||||
|
// If we do not have a 'from' field this intent was not a message and should not be handled. It
|
||||||
|
// probably means this intent was fired by tapping on the app icon.
|
||||||
|
Bundle extras = intent.getExtras();
|
||||||
|
if (extras == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String from = extras.getString(EXTRA_FROM);
|
||||||
|
String messageId = extras.getString(EXTRA_MESSAGE_ID_KEY);
|
||||||
|
if (messageId == null) {
|
||||||
|
messageId = extras.getString(EXTRA_MESSAGE_ID_KEY_SERVER);
|
||||||
|
}
|
||||||
|
if (from != null && messageId != null) {
|
||||||
|
Intent message = new Intent(this, MessageForwardingService.class);
|
||||||
|
message.setAction(MessageForwardingService.ACTION_REMOTE_INTENT);
|
||||||
|
message.putExtras(intent);
|
||||||
|
message.setData(intent.getData());
|
||||||
|
MessageForwardingService.enqueueWork(this, message);
|
||||||
|
}
|
||||||
|
setIntent(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispose of the mUnityPlayer when restarting the app.
|
||||||
|
*
|
||||||
|
* <p>This ensures that when the app starts up again it does not start with stale data.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
if (mUnityPlayer != null) {
|
||||||
|
mUnityPlayer.destroy();
|
||||||
|
mUnityPlayer = null;
|
||||||
|
}
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e79bd7233f70e4addb0fced7e984ef06
|
||||||
|
labels:
|
||||||
|
- FirebaseMessagingActivityGenerated
|
||||||
|
PluginImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 3
|
||||||
|
iconMap: {}
|
||||||
|
executionOrder: {}
|
||||||
|
defineConstraints: []
|
||||||
|
isPreloaded: 0
|
||||||
|
isOverridable: 0
|
||||||
|
isExplicitlyReferenced: 0
|
||||||
|
validateReferences: 1
|
||||||
|
platformData:
|
||||||
|
Android:
|
||||||
|
enabled: 1
|
||||||
|
settings: {}
|
||||||
|
Any:
|
||||||
|
enabled: 0
|
||||||
|
settings: {}
|
||||||
|
Editor:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
DefaultValueInitialized: true
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -49,7 +49,7 @@ MonoBehaviour:
|
|||||||
m_ExportAsGoogleAndroidProject: 0
|
m_ExportAsGoogleAndroidProject: 0
|
||||||
m_DebugSymbolLevel: 4
|
m_DebugSymbolLevel: 4
|
||||||
m_DebugSymbolFormat: 5
|
m_DebugSymbolFormat: 5
|
||||||
m_CurrentDeploymentTargetId: __builtin__target_default
|
m_CurrentDeploymentTargetId: KBUKQ4PNCAOBS8YH
|
||||||
m_BuildType: 2
|
m_BuildType: 2
|
||||||
m_LinkTimeOptimization: 0
|
m_LinkTimeOptimization: 0
|
||||||
m_BuildAppBundle: 1
|
m_BuildAppBundle: 1
|
||||||
|
|||||||
Reference in New Issue
Block a user