저는 RadiusNetworks API를 사용하여 iBeacons를 사용하고 있습니다.iBeacon 백그라운드 스캐닝 RadiusNetworks 라이브러리의 PRO 기능?
이 라이브러리를 사용했지만 제대로 작동하지만 배경 스캔이 내 응용 프로그램에서 발생하지 않는다고 내가 잘못하고 있는지 물어볼 필요가 있습니까? 내가 뭘 놓치고 있니? 여기
어떻게 당신이 당신의 활동을 보내는 지금까지, 난 단지 그러나 배경에 활동을 설정, 비콘 측에 관련 코드를 유지 완전히 스캔을 정지가 구현 ...package ro.gebs.zonizbeacon;
public class MainActivity extends FragmentActivity
implements NavigationDrawerFragment.NavigationDrawerCallbacks, SearchView.OnQueryTextListener, IBeaconConsumer, RangeNotifier, IBeaconDataNotifier {
/**
* Fragment managing the behaviors, interactions and presentation of the navigation drawer.
*/
private NavigationDrawerFragment mNavigationDrawerFragment;
private MainOffersFragment mOffersFragment;
protected static final String TAG = "BeaconActivity";
private IBeaconManager iBeaconManager = IBeaconManager.getInstanceForApplication(this);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//getActionBar().setIcon(R.drawable.home);
setContentView(R.layout.activity_main);
BeaconUtils.verifyBluetooth(MainActivity.this);
iBeaconManager.bind(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
iBeaconManager.unBind(this);
}
@Override
protected void onPause() {
super.onPause();
if (iBeaconManager.isBound(this)) iBeaconManager.setBackgroundMode(this, true);
}
@Override
protected void onResume() {
super.onResume();
if (iBeaconManager.isBound(this)) iBeaconManager.setBackgroundMode(this, false);
}
@Override
public void onIBeaconServiceConnect() {
Region region = new Region("MainActivityRanging", null, null, null);
try {
iBeaconManager.startRangingBeaconsInRegion(region);
iBeaconManager.setRangeNotifier(this);
} catch (RemoteException e) {
e.printStackTrace();
}
}
@Override
public void iBeaconDataUpdate(IBeacon iBeacon, IBeaconData iBeaconData, DataProviderException e) {
if (e != null) {
Log.d(TAG, "data fetch error:" + e);
}
if (iBeaconData != null) {
String displayString = iBeacon.getProximityUuid() + " " + iBeacon.getMajor() + " " + iBeacon.getMinor() + "\n" + "Welcome message:" + iBeaconData.get("welcomeMessage");
Log.d(TAG, displayString);
}
}
@Override
public void didRangeBeaconsInRegion(Collection<IBeacon> iBeacons, Region region) {
for (IBeacon iBeacon : iBeacons) {
iBeacon.requestData(this);
String displayString = iBeacon.getProximityUuid() + " " + iBeacon.getMajor() + " " + iBeacon.getMinor() + "\n";
Log.d(TAG, displayString);
}
}
}
답장을 보내 주셔서 감사합니다. 정말 유용한 팁과 멋진 라이브러리입니다. :) –