Estimote / Android-Fleet-Management-SDK

Estimote Fleet Management SDK for Android
https://developer.estimote.com
MIT License
836 stars 451 forks source link

Android Things Compatibility Issue #256

Closed nwrner closed 5 years ago

nwrner commented 6 years ago

Hello all. I am trying to get an Android app that simply Logs the phrase "Found" when a Beacon is discovered and "Lost" when it is lost. When I run this app on my Galaxy S7 Edge, it works great. However, getting it to work on Android Things running on a Raspberry Pi isn't working as it returns the following error:

E/EstimoteSDK: LollipopBluetoothAdapter$1.onScanFailed:244 Unable to start BLE scanning. Error code: 4

Here is my MainActivity.java code:

import android.; import android.content.DialogInterface; import android.content.pm.PackageManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import com.estimote.coresdk.common.config.EstimoteSDK; import com.estimote.coresdk.common.requirements.SystemRequirementsChecker; import com.estimote.coresdk.recognition.packets.Beacon; import com.estimote.coresdk.service.BeaconManager; import com.estimote.coresdk.observation.region.beacon.BeaconRegion; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.util.List; import java.util.UUID; import android.util.Log; import java.util.Calendar; import java.util.Date; import android.app.Application; import android.app.; import android.app.PendingIntent; import android.app.IntentService; import android.content.Context; import android.content.Intent; import com.estimote.coresdk.common.config.EstimoteSDK;

public class MainActivity extends AppCompatActivity { private BeaconManager beaconManager;

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);

    beaconManager = new BeaconManager(getApplicationContext());
    beaconManager.setMonitoringListener(new BeaconManager.BeaconMonitoringListener() {

        @Override
        public void onEnteredRegion(BeaconRegion region, List<Beacon> list) {
            Log.d("Down", "Found");
        }

        @Override
        public void onExitedRegion(BeaconRegion region) {
            Log.d("Down", "Lost");
        }
    });

    beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
        @Override
        public void onServiceReady() {
            beaconManager.startMonitoring(new BeaconRegion("beacon-1", UUID.fromString("B9407F30-F5F8-466E-AFF9-25556B57FE6D"), null, null));
        }
    });
}

protected void onDestroy() {
    super.onDestroy();
}

protected void onResume() {
    super.onResume();
    SystemRequirementsChecker.checkWithDefaultDialogs(this);

}

}

Here is my AndroidManifest.xml code:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.ndwarner.ranging">

<uses-permission
    android:name="android.permission.BLUETOOTH" />

<uses-permission
    android:name="android.permission.BLUETOOTH_ADMIN" />

<uses-permission-sdk-23
    android:name="android.permission.ACCESS_COARSE_LOCATION" />

<uses-feature
    android:name="android.hardware.bluetooth_le"
    android:required="false" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
<meta-data android:name="disable_hardware_filtering" android:value="true" />

The above statement comes from a similar topic on this page addressing a similar issue but has not yet worked for me.

Everytime this is run on the Raspberry Pi running Android Things, it returns the following error:

E/EstimoteSDK: LollipopBluetoothAdapter$1.onScanFailed:244 Unable to start BLE scanning. Error code: 4

Thanks!

Poberro commented 6 years ago

I run the same scanning code on NXP Pico i.MX7D and Raspberry Pi 3, running Android of Things. NXP Pico scans without problems, but Raspberry Pi3 gives error above. This looks like a platform issue.

pawelDylag commented 6 years ago

Hey, read the info below - soon we will publish full support for Android Things in the mentioned SDK, plus there will be a complete blog post on how to configure the stuff :)

I encourage you to try our new ProximitySDK 🚀 - it is dedicated for creating proximity interactions with our beacons - its main focus is to deliver the reliable enter/exit experience according to a different zones of beacons, based on our own data-science, and Estimote Monitoring packet. It works extremely well with Android 5.0-8.0 devices (full support for Nougat, and Oreo included), and also allows you to configure it to keep scanning in the background.

Here is the official repository page -> https://github.com/Estimote/Android-Proximity-SDK

Also, we keep posting updates about the progress of our development on this thread at our forums. I encourage you to track it in order to be super up-to-date :)

Please, check the mentioned new SDK - the current SDK will soon be deprecated, and we will support only critical issues for some time.

heypiotr commented 5 years ago

[Cleaning up stale issues following the rebranding of Estimote SDK to Estimote Fleet Management SDK]

You can try our Proximity SDK for Android Things:

https://developer.estimote.com/sensors/android-things/