Closed Cvijo closed 2 years ago
@Cvijo The 3.0.0-beta1 SDK is now live which should fix this double Android Activity issue you are running into. Check out the OneSignal Xamarin SDK Version 4 - Beta now available!#262 thread for more details.
With OneSignal SDK 3.10.6
Testing Steps:
Repeated same test, same observation First time open and then close the app, not receiving push until unless reopen again.
I am on Pixel 3XL Android 12 Build detail: Project "Ambassador.Mobile.Android.csproj" (Install target(s)): Found Java SDK version 1.8.0. Found Java SDK version 1.8.0. Dex Fast Deployment Enabled: False MonoAndroid Tools: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\Android\ Android Platform API level: 30 TargetFrameworkVersion: v11.0 Android NDK: C:\Users\xxxxx\AppData\Local\Android\Sdk dk-bundle\ Android SDK: C:\Users\xxxxx\AppData\Local\Android\Sdk\ Android SDK Build Tools: C:\Users\xxxxx\AppData\Local\Android\Sdk\build-tools\30.0.2\
App is in background, tapping on the push notification, app stuck on splash screen(inconsistent)
I am testing multiple rounds on actual project which has other 3rd party dependencies, out of which one dependency linked with OneSignal is Shiny. Shiny uses jobs which use Xamarin.AndroidX.Work.Runtime, for more details you can https://shinylib.net/
With Xamarin SDK Version 4.0.0 - beta3, everything works fine, could not reproduce above issues. However noticed, tapping on notification when app is in closed state, app does not opens immediately, as if nothing has happened, then after few secs, splash screen shows up and then home screen of the app. This was not the case with 3.10.6 SDK, it was immediate. Is this expected? Tested on same device (Pixel 3XL Android 12), same setup except different OneSignal SDK.
One point to be mentioned here, project is having shiny dependency which was having conflict, I had mentioned Xamarin.AndroidX.Work.Runtime 2.7.0 directly to project Ambassador.Mobile.Android.
NU1107: Version conflict detected for Xamarin.AndroidX.Work.Runtime. Install/reference Xamarin.AndroidX.Work.Runtime 2.7.0 directly to project Ambassador.Mobile.Android to resolve this issue.
Ambassador.Mobile.Android -> Com.OneSignal 4.0.0-beta3 -> Xamarin.AndroidX.Work.Runtime (>= 2.7.0)
Ambassador.Mobile.Android -> Shiny.Jobs 2.4.3.3003 -> Xamarin.AndroidX.Work.Runtime (>= 2.5.0 && < 2.6.0).
@Cvijo any update on my above comment
However noticed, tapping on notification when app is in closed state, app does not opens immediately, as if nothing has happened, then after few secs, splash screen shows up and then home screen of the app. This was not the case with 3.10.6 SDK, it was immediate. Is this expected?
@Dipannita20
I can see from your log that Shiny.Jobs
is requesting version >= 2.5.0 && < 2.6.0
but OneSignal is requesting >= 2.7.0
. The solutions will be to add Xamarin.AndroidX.Work.Runtime 2.7.0
directly to your project (Ambassador.Mobile.Android
) as the error recommends. Let us know if that doesn't work for your situation.
Could you provide a logcat with the slow startup issue? Please disable all filtering so we can see Android system entries as well. This way we can see how the Android system and handling the notification and where the biggest delays are.
@jkasten2
Please find the video related to delay https://photos.app.goo.gl/j2kjX6MQExoWwA66A, for time being device screen is visible after few secs splash screen shows up.
Attached logcat, cleaned up previous logcat -> then sent push -> capture logcat to text file, let me know if you need any more information.
logcat_notification_tap_app_closed.txt
I have upgraded OneSginal Xamarin SDK to 4.0.0-beta 4 and Visual Studio to 2022, but confirming same issue was happening on Visual Studio 2019. Note that AndroidManifest android:targetSdkVersion is 30, testing on Pixel 3xl (Android 12) Its a Xamarin Forms app, MainActivity LaunchMode = LaunchMode.SingleInstance
Microsoft Visual Studio Professional 2022 Version 17.1.1 VisualStudio.17.Release/17.1.1+32228.430 Microsoft .NET Framework Version 4.8.04084
Installed Version: Professional
Azure App Service Tools v3.0.0 17.1.358.51495 Azure App Service Tools v3.0.0
C# Tools 4.1.0-5.22109.6+0c82c4114a4e4b8b723b915eee3b13261db6717f C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Extensibility Message Bus 1.2.6 (master@34d6af2) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers
Mono Debugging for Visual Studio 17.1.10 (65f98f5) Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 6.1.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Visual Basic Tools 4.1.0-5.22109.6+0c82c4114a4e4b8b723b915eee3b13261db6717f Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 17.1.0-beta.21610.4+07b5673e4f2fa7630e78abe37f16b372353a7242 Microsoft Visual F# Tools
Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio.
VisualStudio.DeviceLog 1.0 Information about my package
VisualStudio.Foo 1.0 Information about my package
VisualStudio.Mac 1.0 Mac Extension for Visual Studio
Xamarin 17.1.0.309 (d17-1@3f96c58) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 17.1.0.87 (remotes/origin/main@d50fb5635) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 17.1.8 (590388a) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 12.2.0.4 (d17-1/19b97b7) Xamarin.Android Reference Assemblies and MSBuild support. Mono: a5d1934 Java.Interop: xamarin/java.interop/d17-1@7ac33610 ProGuard: Guardsquare/proguard/v7.0.1@912d149 SQLite: xamarin/sqlite/3.37.1@0893b3b Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-1@db125a7
Xamarin.iOS and Xamarin.Mac SDK 15.6.0.3 (caa899d24) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
@jkasten2 any update on this? Will this be resolved in next Beta release?
@jkasten2 @tanaynigam
OneSginal Xamarin SDK to 4.0.0-beta 4 and Visual Studio to 2022 There are two blocker issues:
In all the above cases MaiActivity LaunchMode set to LaunchMode.SingleTop Debug mode Test Device: Pixel 3XL (Android 12)
@Cvijo @Dipannita20 It seems the issue no longer seems to exist in our latest release OneSignalSDK.Xamarin-4.0.0.
Please note that we have changed the package name and namespace for the SDK from Com.OneSignal
to OneSignalSDK.Xamarin
and would require you to remove the previous package name and add the new package name to import the SDK in your code.
Additionally, when searching for the package on nuget.org, you will be required to search for OneSignalSDK.Xamarin to import the package
Closing the issue for now. Please re-open if the issue still exists
Description: I am using Xamarin Forms and I setup my project according to your instructions and everything works fine, but if I got the notification and my app is not in focused (in the background) and when I click on notification new application is started instead to open an existing one. When I debug my app I got event fired "OnNotificationOpened" in xamarin shared but after that new application start to load and it crash the application
Environment I am using Com.OneSignal v 3.10.6 added thru nugget Xamarin Form v 5
Steps to Reproduce Issue:
When I receive a push notification and my app is in the background I got event fired. I am not sure but it seems like 2 instances of my App are running at the same time because all my initialization is starting all over again.
OnNotificationOpened
but then it starts a new app from scratch showing a splash screen and then crashes because I use Dependency Injector (SimpleInjector) that has a static Container and it doesn't allow adding new registrations after you use first GetInstanceI am testing this on Android Emulator and i have splash activity as MainLauncher