Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 当应用程序被终止时,在Xamarin.android中扫描ibeacon不起作用_C#_Android_Xamarin.android_Bluetooth Lowenergy_Ibeacon - Fatal编程技术网

C# 当应用程序被终止时,在Xamarin.android中扫描ibeacon不起作用

C# 当应用程序被终止时,在Xamarin.android中扫描ibeacon不起作用,c#,android,xamarin.android,bluetooth-lowenergy,ibeacon,C#,Android,Xamarin.android,Bluetooth Lowenergy,Ibeacon,我正在创建Xamarin.android应用程序,通过该应用程序,我可以扫描BLE设备,并在范围内时通知用户,无论应用程序位于前台、暂停或终止。我正在使用ESP32 BLE设备作为ibeacon。 我使用了AltBeacon库,并遵循了下面链接中提到的所有步骤 我已经转换了Xamarin.android的代码。 当应用程序处于前台并处于暂停状态时,我会收到一个通知,但在被终止时不会收到通知
. 我还尝试过在消息API附近使用谷歌。但我无法检测到ibeacon 下面是应用程序类的代码 [Appl

我正在创建Xamarin.android应用程序,通过该应用程序,我可以扫描BLE设备,并在范围内时通知用户,无论应用程序位于前台、暂停或终止。我正在使用ESP32 BLE设备作为ibeacon。 我使用了AltBeacon库,并遵循了下面链接中提到的所有步骤

我已经转换了Xamarin.android的代码。 当应用程序处于前台并处于暂停状态时,我会收到一个通知,但在被终止时不会收到通知
.

我还尝试过在消息API附近使用谷歌。但我无法检测到ibeacon

下面是应用程序类的代码

[Application]
public class Myapplication : Application, IBootstrapNotifier
{
    BackgroundPowerSaver backgroundPowerSave;
    RegionBootstrap regionBootstrap;

    public Myapplication(IntPtr handle, JniHandleOwnership ownerShip) : base(handle, ownerShip)
    {
    }

    public override void OnCreate()
    {
        base.OnCreate();
        BeaconManager beaconManager = BeaconManager.GetInstanceForApplication(this);
        beaconManager.BeaconParsers.Add(new BeaconParser().SetBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));

        backgroundPowerSave = new BackgroundPowerSaver(this);
        regionBootstrap = new RegionBootstrap(this, Helper.GetRegion());
    }

    public void DidDetermineStateForRegion(int state, Region region)
    {
        Helper.ShowNotification(this, "Beacon - state for region", "Log in");
    }

    public void DidEnterRegion(Region region)
    {
        regionBootstrap.Disable();
       //show notification 
    }

    public void DidExitRegion(Region region)
    {
       //show notification 
    }
}

如何解决这个问题?

在“杀死”一个应用程序之后测试检测是一件棘手的事情,它是否有效(通常是有效的)取决于你到底是如何杀死它的,以及你谈论的是哪个设备制造商

仔细阅读上的所有详细信息,以确保您正在测试一个预期可以工作的场景