OneSignal / OneSignal-Xamarin-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Xamarin app with OneSignal. https://onesignal.com
Other
105 stars 50 forks source link

FusedLocationApi.requestLocationUpdates failed! Android 12 #282

Closed Dipannita20 closed 2 years ago

Dipannita20 commented 2 years ago

Description: FusedLocationApi.requestLocationUpdates failed! Testing device: Pixel 3XL 12

Environment

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.

Steps to Reproduce Issue:

  1. Install 4.0.0 beta 4 as nuget package
  2. Upgrade targetSdkVersion to 31
  3. Project has other dependencies which may point of interest image
  4. Build and deploy the app
  5. Notice below exception on console

[OneSignal] FusedLocationApi.requestLocationUpdates failed! [OneSignal] java.lang.NullPointerException: Calling thread must be a prepared Looper thread. [OneSignal] at com.google.android.gms.common.internal.Preconditions.checkNotNull(com.google.android.gms:play-services-basement@@17.6.0:2) [OneSignal] at com.google.android.gms.internal.location.zzz.requestLocationUpdates(com.google.android.gms:play-services-location@@18.0.0:4) [OneSignal] at com.onesignal.GMSLocationController$FusedLocationApiWrapper.requestLocationUpdates(GMSLocationController.java:198) [OneSignal] at com.onesignal.GMSLocationController$LocationUpdateListener.init(GMSLocationController.java:181) [OneSignal] at com.onesignal.GMSLocationController$LocationUpdateListener.<init>(GMSLocationController.java:165) [OneSignal] at com.onesignal.GMSLocationController.onFocusChange(GMSLocationController.java:117) [OneSignal] at com.onesignal.LocationController.onFocusChange(LocationController.java:326) [OneSignal] at com.onesignal.OneSignal.onAppLostFocus(OneSignal.java:1307) [OneSignal] at com.onesignal.OSFocusHandler$Companion.onLostFocusDoWork(OSFocusHandler.kt:139) [OneSignal] at com.onesignal.OSFocusHandler$OnLostFocusWorker.doWork(OSFocusHandler.kt:118) [OneSignal] at androidx.work.Worker$1.run(Worker.java:86) [OneSignal] at co03-23 17:35:20.154 W/OneSignal(25598): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) [OneSignal] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) [OneSignal] at java.lang.Thread.run(Thread.java:920)

Anything else:

Attached log:

<ItemGroup>
    <PackageReference Include="Com.OneSignal">
      <Version>4.0.0-beta4</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.AppCenter.Analytics">
      <Version>3.1.0</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.AppCenter.Crashes">
      <Version>3.1.0</Version>
    </PackageReference>
    <PackageReference Include="reactiveui">
      <Version>11.2.3</Version>
    </PackageReference>
    <PackageReference Include="ReactiveUI.Events.XamForms">
      <Version>15.1.1</Version>
    </PackageReference>
    <PackageReference Include="ReactiveUI.XamForms">
      <Version>11.2.3</Version>
    </PackageReference>
    <PackageReference Include="Rg.Plugins.Popup">
      <Version>2.0.0.14</Version>
    </PackageReference>
    <PackageReference Include="Shiny.Jobs">
      <Version>2.5.0-preview.3045</Version>
    </PackageReference>
    <PackageReference Include="Shiny.Locations">
      <Version>2.5.0-preview.3045</Version>
    </PackageReference>
    <PackageReference Include="Shiny.Notifications">
      <Version>2.5.0-preview.3045</Version>
    </PackageReference>
    <PackageReference Include="SkiaSharp.Views.Forms">
      <Version>2.80.3</Version>
    </PackageReference>
    <PackageReference Include="sqlite-net-sqlcipher">
      <Version>1.6.292</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.AndroidX.Migration">
      <Version>1.0.8</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.FFImageLoading.Svg.Forms">
      <Version>2.4.11.982</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.FFImageLoading.Transformations">
      <Version>2.4.11.982</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Forms" Version="5.0.0.2125" />
    <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
    <PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.3" />
    <PackageReference Include="Xamarin.Essentials" Version="1.5.1" />
    <PackageReference Include="Xamarin.GooglePlayServices.Location">
      <Version>118.0.0.2</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.4.0.1" />
  </ItemGroup>
Dipannita20 commented 2 years ago

There is slight delay to show up app on notification tap when app is in closed state(killed state) and tapping on notification multiple times app stuck at splash screen, then ANR

  1. Send first push -> tap on notification -> opens the app
  2. Close the app, swipe away killed state
  3. Send 2nd push -> tap on notification -> app stuck at splash screen result in ANR

8197 W ActivityManager: Stale PhantomProcessRecord {1a8248c 8203:7649:/u0a804}, removing 03-24 11:51:40.868 1852 8197 E ActivityManager: ANR in com.dciartform.brandambassador.soa.dev 03-24 11:51:40.868 1852 8197 E ActivityManager: PID: 7649 03-24 11:51:40.868 1852 8197 E ActivityManager: Reason: executing service com.dciartform.brandambassador.soa.dev/com.onesignal.SyncJobService 03-24 11:51:40.868 1852 8197 E ActivityManager: Frozen: false 03-24 11:51:40.868 1852 8197 E ActivityManager: Load: 0.0 / 0.0 / 0.0 03-24 11:51:40.868 1852 8197 E ActivityManager: ----- Output from /proc/pressure/memory ----- 03-24 11:51:40.868 1852 8197 E ActivityManager: some avg10=0.00 avg60=0.00 avg300=0.00 total=218520642 03-24 11:51:40.868 1852 8197 E ActivityManager: full avg10=0.00 avg60=0.00 avg300=0.00 total=84002174 03-24 11:51:40.868 1852 8197 E ActivityManager: ----- End output from /proc/pressure/memory -----

Attached full log

logcat_output_24#1.txt

tanaynigam commented 2 years ago

@Dipannita20 We have a release OneSignalSDK.Xamarin-4.0.0-beta5 which should have a fix for the Null pointer exception. 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

tanaynigam commented 2 years ago

Please re-open this issue if you believe it isn't fixed. We are closing the issue for now