private RangingData(Parcel in) { BeaconManager.logDebug(TAG, "parsing RangingData"); Parcelable[] parcelables = in.readParcelableArray(this.getClass().getClassLoader()); beacons = new ArrayList<Beacon>(parcelables.length); for (int i = 0; i < parcelables.length; i++) { beacons.add((Beacon) parcelables[i]); } region = in.readParcelable(this.getClass().getClassLoader()); }
@Override public void onReceive(Context context, Intent intent) { BeaconManager.logDebug(TAG, "onReceive called in startup broadcast receiver"); if (android.os.Build.VERSION.SDK_INT < 18) { Log.w( TAG, "Not starting up beacon service because we do not have SDK version 18 (Android 4.3). We have: " + android.os.Build.VERSION.SDK_INT); return; } BeaconManager beaconManager = BeaconManager.getInstanceForApplication(context.getApplicationContext()); Intent startServiceIntent = new Intent(context, BeaconService.class); context.startService(startServiceIntent); startServiceIntent = new Intent(context, BeaconIntentProcessor.class); context.startService(startServiceIntent); }
public void writeToParcel(Parcel out, int flags) { BeaconManager.logDebug(TAG, "writing RangingData"); out.writeParcelableArray(beacons.toArray(new Parcelable[0]), flags); out.writeParcelable(region, flags); BeaconManager.logDebug(TAG, "done writing RangingData"); }