本文整理汇总了Java中org.altbeacon.beacon.BeaconManager.getInstanceForApplication方法的典型用法代码示例。如果您正苦于以下问题:Java BeaconManager.getInstanceForApplication方法的具体用法?Java BeaconManager.getInstanceForApplication怎么用?Java BeaconManager.getInstanceForApplication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.altbeacon.beacon.BeaconManager
的用法示例。
在下文中一共展示了BeaconManager.getInstanceForApplication方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import org.altbeacon.beacon.BeaconManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
beaconList = (ListView) findViewById(R.id.beacon_list);
beaconManager = BeaconManager.getInstanceForApplication(this);
// Detect the main identifier (UID) frame:
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout(BeaconParser.EDDYSTONE_UID_LAYOUT));
// Detect the telemetry (TLM) frame:
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout(BeaconParser.EDDYSTONE_TLM_LAYOUT));
// Detect the URL frame:
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout(BeaconParser.EDDYSTONE_URL_LAYOUT));
beaconManager.bind(this);
}
示例2: initiateBeaconService
import org.altbeacon.beacon.BeaconManager; //导入方法依赖的package包/类
private void initiateBeaconService() {
beaconManager = BeaconManager.getInstanceForApplication(this.getApplicationContext());
// Detect the main identifier (UID) frame:
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout(BeaconParser.EDDYSTONE_UID_LAYOUT));
// Detect the telemetry (TLM) frame:
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout(BeaconParser.EDDYSTONE_TLM_LAYOUT));
// Detect the URL frame:
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout(BeaconParser.EDDYSTONE_URL_LAYOUT));
//beaconManager.setDebug(true);
beaconManager.setBackgroundScanPeriod(1100l);
beaconManager.setBackgroundBetweenScanPeriod(30000l);
beaconManager.bind(this);
}
示例3: onCreate
import org.altbeacon.beacon.BeaconManager; //导入方法依赖的package包/类
@Override
public void onCreate() {
Toast.makeText(context, "Service created!", Toast.LENGTH_LONG).show();
beaconManager = BeaconManager.getInstanceForApplication(this);
beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:0-3=4c000215,i:4-19,i:20-21,i:22-23,p:24-24"));
beaconManager.setBackgroundScanPeriod(1500l);
beaconManager.setBackgroundBetweenScanPeriod(30000l);
beaconManager.setForegroundScanPeriod(2000l);
beaconManager.setForegroundBetweenScanPeriod(4000l);
//Start Monitoring and Ranging
beaconManager.bind(this);
// handler = new Handler();
// runnable = new Runnable() {
// public void run() {
// Toast.makeText(context, "Service is still running", Toast.LENGTH_LONG).show();
// handler.postDelayed(runnable, 5000);
// }
// };
//
// handler.postDelayed(runnable, 5000);
}
示例4: ThunderBoardPowerSaver
import org.altbeacon.beacon.BeaconManager; //导入方法依赖的package包/类
public ThunderBoardPowerSaver(Context context, PreferenceManager preferenceManager) {
if (android.os.Build.VERSION.SDK_INT < 18) {
Timber.d("BackgroundPowerSaver requires API 18 or higher.");
return;
}
if (context instanceof Application) {
((Application) context).registerActivityLifecycleCallbacks(this);
} else {
Timber.e("Context is not an application instance, so we cannot use the BackgroundPowerSaver");
}
this.preferenceManager = preferenceManager;
this.beaconManager = BeaconManager.getInstanceForApplication(context);
}
示例5: onCreateView
import org.altbeacon.beacon.BeaconManager; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View beaconListView = inflater.inflate(R.layout.fragment_main, container, false);
ButterKnife.bind(this, beaconListView);
// Setting toolbar.
setToolbar();
// Setting linear layout manager as layout manager for the beacon recycler view.
beaconRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));
// Getting instance of beacon manager.
beaconManager = BeaconManager.getInstanceForApplication(getActivity());
// Initializing scan service.
initBeaconScanService();
// Initializing transmit service.
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) initBeaconTransmitService();
// Disables dragging on switch button
disableSwitchDrag();
// Updates user interface so that all the right views are displayed.
updateUI();
return beaconListView;
}
示例6: onStartCommand
import org.altbeacon.beacon.BeaconManager; //导入方法依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.i(TAG, "onStartCommand method called");
beaconManager = BeaconManager.getInstanceForApplication(this);
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"));
beaconManager.bind(this);
RangedBeacon.setSampleExpirationMilliseconds(10000);
//ArmaRssiFilter.setDEFAULT_ARMA_SPEED(1);
myDBHandler = new DBHandler(this, null, null, 1);
// restart the service if the service is closed somehow
return Service.START_STICKY;
}
示例7: startBeaconService
import org.altbeacon.beacon.BeaconManager; //导入方法依赖的package包/类
/**
* Start the XamoomBeaconService with a beacon majorId.
* This will automatically start (background-)monitoring for xamoom beacons
* with the used majorId.
*
* @param majorId MajorId you get from your xamoom system.
*/
public void startBeaconService(@NonNull String majorId) {
Log.i(TAG, "startBeaconService");
if (majorId.equalsIgnoreCase("")) {
throw new IllegalArgumentException("MajorId should not be a number.");
}
mRegion = new Region("test", Identifier.parse("de2b94ae-ed98-11e4-3432-78616d6f6f6d"),
Identifier.parse(majorId), null);
mRegionBootstrap = new RegionBootstrap(this, mRegion);
mBeaconManager = BeaconManager.getInstanceForApplication(mContext);
mBeaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
mBeaconManager.setRangeNotifier(this);
mBeaconManager.bind(this);
}
示例8: onCreate
import org.altbeacon.beacon.BeaconManager; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mBeacons = new ArrayList<>();
mAdapter = new BeaconListAdapter(getActivity(), mBeacons);
setListAdapter(mAdapter);
// Beacon: simulator
if (BeaconSimulator.USE_SIMULATED_BEACONS) BeaconManager.setBeaconSimulator(new BeaconSimulator());
// Beacon: set initial parameters and start scanning, if ble is present
mBeaconManager = BeaconManager.getInstanceForApplication(getActivity());
mBeaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout(BeaconLayout.IBEACON.layout()));
mBeaconManager.bind(this);
}
示例9: onCreate
import org.altbeacon.beacon.BeaconManager; //导入方法依赖的package包/类
@Override
public void onCreate() {
System.out.println("Ranging Service created");
c = this;
records = ReferenceApplication.records;
// System.out.println("SIZE : "+ Integer.toString(records.size()));
// ANDROID BEACON LIBRARY
mBeaconManager = BeaconManager.getInstanceForApplication(this);
// NORDIC BEACON
mBeaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"));
mBeaconManager.bind(this);
}
示例10: setUpBeaconManager
import org.altbeacon.beacon.BeaconManager; //导入方法依赖的package包/类
@NonNull
private BeaconManager setUpBeaconManager() {
final BeaconManager beaconManager = BeaconManager.getInstanceForApplication(this);
beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"));
beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("s:0-1=feaa,m:2-2=00,p:3-3:-41,i:4-13,i:14-19"));
beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("x,s:0-1=feaa,m:2-2=20,d:3-3,d:4-5,d:6-7,d:8-11,d:12-15"));
beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("s:0-1=feaa,m:2-2=10,p:3-3:-41,i:4-20v"));
beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"));
beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:0-3=4c000215,i:4-19,i:20-21,i:22-23,p:24-24"));
return beaconManager;
}
示例11: onCreate
import org.altbeacon.beacon.BeaconManager; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Logger.getInstance().Information(TAG, "onCreate");
_context = this;
_beaconManager = BeaconManager.getInstanceForApplication(_context.getApplicationContext());
BeaconParser beaconParser = new BeaconParser();
_beaconManager.getBeaconParsers().add(beaconParser.setBeaconLayout(BeaconParser.ALTBEACON_LAYOUT));
_beaconManager.getBeaconParsers().add(beaconParser.setBeaconLayout(BeaconParser.EDDYSTONE_TLM_LAYOUT));
_beaconManager.getBeaconParsers().add(beaconParser.setBeaconLayout(BeaconParser.EDDYSTONE_UID_LAYOUT));
_beaconManager.getBeaconParsers().add(beaconParser.setBeaconLayout(BeaconParser.EDDYSTONE_URL_LAYOUT));
_beaconManager.getBeaconParsers().add(beaconParser.setBeaconLayout(BeaconParser.URI_BEACON_LAYOUT));
_bluetoothController = new BluetoothController();
_broadcastController = new BroadcastController(_context);
_receiverController = new ReceiverController(_context);
_receiverController.RegisterReceiver(_bluetoothChangedReceiver, new String[]{BluetoothAdapter.ACTION_STATE_CHANGED});
_receiverController.RegisterReceiver(_homeNetworkAvailableReceiver, new String[]{NetworkController.WIFIReceiverInHomeNetworkBroadcast});
_receiverController.RegisterReceiver(_homeNetworkNotAvailableReceiver, new String[]{NetworkController.WIFIReceiverNoHomeNetworkBroadcast});
_receiverController.RegisterReceiver(_puckJsDownloadReceiver, new String[]{PuckJsListService.PuckJsListDownloadFinishedBroadcast});
_bluetoothIsEnabled = _bluetoothController.IsBluetoothEnabled();
SetScanEnabled(SettingsController.getInstance().IsBeaconScanEnabled());
SetHandleBluetoothAutomatically(SettingsController.getInstance().HandleBluetoothAutomatically());
SetBetweenScanPeriod(SettingsController.getInstance().GetTimeBetweenBeaconScansSec());
SetScanPeriod(SettingsController.getInstance().GetTimeBeaconScansMsec());
}
示例12: getBeaconManager
import org.altbeacon.beacon.BeaconManager; //导入方法依赖的package包/类
public void getBeaconManager() {
try {
beaconManager = BeaconManager.getInstanceForApplication(getApplicationContext());
beaconManager.getBeaconParsers().add(new BeaconParser()
.setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
beaconManager.setForegroundScanPeriod(250);
beaconManager.bind(this);
Log.i(TAG, "-- betw-scan-period=" + beaconManager.getForegroundBetweenScanPeriod());
Log.i(TAG, "-- scan-period=" + beaconManager.getForegroundScanPeriod());
Toast.makeText(getApplicationContext(), "Started listening for iBeacons", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Log.e(TAG, e.getMessage(), e.getCause());
}
}
示例13: BeaconsAndroidModule
import org.altbeacon.beacon.BeaconManager; //导入方法依赖的package包/类
public BeaconsAndroidModule(ReactApplicationContext reactContext) {
super(reactContext);
Log.d(LOG_TAG, "BeaconsAndroidModule - started");
this.mReactContext = reactContext;
this.mApplicationContext = reactContext.getApplicationContext();
this.mBeaconManager = BeaconManager.getInstanceForApplication(mApplicationContext);
// Detect iBeacons ( http://stackoverflow.com/questions/25027983/is-this-the-correct-layout-to-detect-ibeacons-with-altbeacons-android-beacon-li )
addParser("m:0-3=4c000215,i:4-19,i:20-21,i:22-23,p:24-24");
mBeaconManager.bind(this);
}
示例14: onCreate
import org.altbeacon.beacon.BeaconManager; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Log.d("SERV", "onCreate: STARTED SERVICE");
mBeaconManager = BeaconManager.getInstanceForApplication(getApplicationContext());
mRegion = new Region(PreferencesUtil.getDefaultRegionName(getApplicationContext()), null, null, null);
mBeaconManager.bind(this);
mBeaconManager.addRangeNotifier(this);
setupTimer();
}
示例15: onCreate
import org.altbeacon.beacon.BeaconManager; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mBeaconManager = BeaconManager.getInstanceForApplication(getApplicationContext());
mRegion = new Region(PreferencesUtil.getDefaultRegionName(getApplicationContext()), null, null, null);
mBeaconManager.bind(this);
mBeaconManager.addRangeNotifier(this);
if (savedInstanceState != null) {
needContinueScan = savedInstanceState.getBoolean(STATE_SCANNING);
}
}