Tested on a Pixel 2 with Android 8.1
I have a repro project, but I can't share it publicly.
Broadcast receiver:
[assembly: UsesPermission(Name = Manifest.Permission.ReceiveBootCompleted)]
namespace Something
{
[BroadcastReceiver(Enabled = true, DirectBootAware = true)]
[IntentFilter(new[] {Intent.ActionLockedBootCompleted, Intent.ActionBootCompleted}, Categories = new []{Intent.CategoryDefault})]
public class BootedBroadcastReceiver : MvxBroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{
// it does not even reach this point
base.OnReceive(context, intent);
Log.Info("Boot message received");
ForegroundSyncService.Start(context);
}
}
}
I think this relates to https://bugzilla.xamarin.com/show_bug.cgi?id=51940
The code in the broadcast receiver runs.
The process/app crashes with the error No implementation found for void mono.android.Runtime.register(java.lang.String, java.lang.Class, java.lang.String) (tried Java_mono_android_Runtime_register and Java_mono_android_Runtime_register__Ljava_lang_String_2Ljava_lang_Class_2Ljava_lang_String_2)
=== Visual Studio Enterprise 2017 for Mac ===
Version 7.4.3 (build 10)
Installation UUID: 3a10834c-9029-4294-9cb1-5893f35a8f5e
Runtime:
Mono 5.8.1.0 (2017-10/6bf3922f3fd) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 508010000
=== NuGet ===
Version: 4.3.1.4445
=== .NET Core ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
2.0.7
2.0.6
1.1.7
1.0.10
SDK: /usr/local/share/dotnet/sdk/2.1.105/Sdks
SDK Versions:
2.1.105
2.1.101
1.1.8
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.8.1/lib/mono/msbuild/15.0/bin/Sdks
=== Xamarin.Profiler ===
Version: 1.6.1
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Xamarin.Android ===
Version: 8.2.0.16 (Visual Studio Enterprise)
Android SDK: /Users/sam/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
8.0 (API level 26)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 27.0.1
SDK Build Tools Version: 28.0.0 rc1
Java SDK: /usr
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Xamarin Inspector ===
Version: 1.4.0
Hash: b3f92f9
Branch: master
Build date: Fri, 19 Jan 2018 22:00:34 GMT
Client compatibility: 1
=== Apple Developer Tools ===
Xcode 9.3 (14154)
Build 9E145
=== Xamarin.Mac ===
Version: 4.2.1.29 (Visual Studio Enterprise)
=== Xamarin.iOS ===
Version: 11.9.1.24 (Visual Studio Enterprise)
Hash: f62de472
Branch: xcode9.3
Build date: 2018-03-29 19:30:53-0400
=== Build Information ===
Release ID: 704030010
Git revision: 5af3e98549653fcc5335896ccc296343d08f31bb
Build date: 2018-04-12 12:32:07-04
Xamarin addins: fadb82fb0fe2668cb7789f8b524aec6fb8568ee7
Build lane: monodevelop-lion-d15-6
=== Operating System ===
Mac OS X 10.13.3
Darwin 17.4.0 Darwin Kernel Version 17.4.0
Sun Dec 17 09:19:54 PST 2017
root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64
=== Enabled user installed addins ===
Android Signature Tool 2.1.2
Gist Ide Information 1.1.0
MSBuild Editor 2.0.3
NuGet Package Explorer 0.2
NuGet Package Management Extensions 0.12.6
PowerShell 0.3
Redth's Addins 1.0.9
Show in Github 1.0.4
Internet of Things (IoT) development (Preview) 7.1
04-19 15:11:00.749 be.ypto.edriveapps.edrive 2313 - E zygote64 No implementation found for void mono.android.Runtime.register(java.lang.String, java.lang.Class, java.lang.String) (tried Java_mono_android_Runtime_register and Java_mono_android_Runtime_register__Ljava_lang_String_2Ljava_lang_Class_2Ljava_lang_String_2)
04-19 15:11:00.750 be.ypto.edriveapps.edrive 2313 - D AndroidRuntime Shutting down VM
04-19 15:11:00.750 be.ypto.edriveapps.edrive 2313 - E AndroidRuntime FATAL EXCEPTION: main
04-19 15:11:00.750 be.ypto.edriveapps.edrive 2313 - E AndroidRuntime Process: be.ypto.edriveapps.edrive, PID: 2313
04-19 15:11:00.750 be.ypto.edriveapps.edrive 2313 - E AndroidRuntime java.lang.UnsatisfiedLinkError: No implementation found for void mono.android.Runtime.register(java.lang.String, java.lang.Class, java.lang.String) (tried Java_mono_android_Runtime_register and Java_mono_android_Runtime_register__Ljava_lang_String_2Ljava_lang_Class_2Ljava_lang_String_2)
04-19 15:11:00.750 be.ypto.edriveapps.edrive 2313 - E AndroidRuntime at mono.android.Runtime.register(Native Method)
04-19 15:11:00.750 be.ypto.edriveapps.edrive 2313 - E AndroidRuntime at mvvmcross.droid.services.MvxBroadcastReceiver.<clinit>(MvxBroadcastReceiver.java:15)
04-19 15:11:00.750 be.ypto.edriveapps.edrive 2313 - E AndroidRuntime at java.lang.Class.newInstance(Native Method)
04-19 15:11:00.750 be.ypto.edriveapps.edrive 2313 - E AndroidRuntime at android.app.ActivityThread.handleReceiver(ActivityThread.java:3166)
04-19 15:11:00.750 be.ypto.edriveapps.edrive 2313 - E AndroidRuntime at android.app.ActivityThread.-wrap17(Unknown Source:0)
04-19 15:11:00.750 be.ypto.edriveapps.edrive 2313 - E AndroidRuntime at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1672)
04-19 15:11:00.750 be.ypto.edriveapps.edrive 2313 - E AndroidRuntime at android.os.Handler.dispatchMessage(Handler.java:106)
04-19 15:11:00.750 be.ypto.edriveapps.edrive 2313 - E AndroidRuntime at android.os.Looper.loop(Looper.java:164)
04-19 15:11:00.750 be.ypto.edriveapps.edrive 2313 - E AndroidRuntime at android.app.ActivityThread.main(ActivityThread.java:6494)
04-19 15:11:00.750 be.ypto.edriveapps.edrive 2313 - E AndroidRuntime at java.lang.reflect.Method.invoke(Native Method)
04-19 15:11:00.750 be.ypto.edriveapps.edrive 2313 - E AndroidRuntime at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
04-19 15:11:00.750 be.ypto.edriveapps.edrive 2313 - E AndroidRuntime at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Exactly the same bug occurs here. Any fix or work-around would be great.
I'm here because I think I have the same problem. I've created a BroadcastReceiver class in order to do push notifications for Android. The weird thing is when I test my application on a Samsung Galaxy S8+ running Android 8.0 it will always execute the code within the OnReceive override. When I test it on a newer Pixel 3XL running Android 9.0 it never reaches the code. Very strange.
There was a bug in my BroadcastReceiver code. It works fine now.