public abstract class ReelyAwareApplicationCallback extends java.lang.Object implements android.app.Application.ActivityLifecycleCallbacks, BleServiceCallback
Application.registerActivityLifecycleCallbacks(Application.ActivityLifecycleCallbacks)
BleService
as soon as the app is created.Application.ActivityLifecycleCallbacks
Constructor and Description |
---|
ReelyAwareApplicationCallback(android.content.Context context)
As soon as the component is created, we bindBleService to the
BleService |
Modifier and Type | Method and Description |
---|---|
protected void |
bindBleService()
************* PRIVATE STUFF ******************
|
protected int |
getActivityCount()
Get the number of
ReelyAwareActivities currently running (0 or 1 basically) |
protected BleService |
getBleService()
Get access to the underlying service.
|
protected android.content.Context |
getContext()
Access the application
Context . |
protected android.app.Activity |
getCurrentActivity()
Get currently running Activity.
|
protected ScanFilter |
getScanFilter()
Override this in order to chose which scan filter is to be used before
startScan() is called when the service starts. |
protected BleService.ScanType |
getScanType()
Override this in order to chose which kind of scan is to be used before
startScan() is called when the service starts. |
protected static boolean |
isReelyAware(android.app.Activity activity)
Find out if an
Activity implements ReelyAwareActivity |
void |
onActivityPaused(android.app.Activity activity)
The default behaviour is to check if any
ReelyAwareActivity is still running, and call a scan if so. |
void |
onActivityResumed(android.app.Activity activity)
The default behaviour is to check if a
ReelyAwareActivity is running, and call a scan if so. |
void |
onBleEvent(BleService.Event event,
java.lang.Object data)
This method is called when a
BleService.Event is received. |
protected void |
onBleServiceBound()
This method is called when the
is available . |
protected void |
startScan()
This method sends a scan request to the
BleService . |
protected void |
unbindBleService() |
protected void |
updateScanFilter(ScanFilter scanFilter)
This method sets the scan filter of the
BleService . |
protected void |
updateScanType(BleService.ScanType scanType)
This method sets the scan type of the
BleService . |
public ReelyAwareApplicationCallback(android.content.Context context)
BleService
context
- The application's Context
public void onActivityResumed(android.app.Activity activity)
ReelyAwareActivity
is running, and call a scan if so.startScan()
and getScanType()
onActivityResumed
in interface android.app.Application.ActivityLifecycleCallbacks
activity
- The resumed Activity
public void onActivityPaused(android.app.Activity activity)
ReelyAwareActivity
is still running, and call a scan if so.startScan()
and getScanType()
onActivityPaused
in interface android.app.Application.ActivityLifecycleCallbacks
activity
- The resumed Activity
.protected void startScan()
BleService
.protected void updateScanType(BleService.ScanType scanType)
BleService
.scanType
- The scan type
protected void updateScanFilter(ScanFilter scanFilter)
BleService
.scanFilter
- The scan filter
protected ScanFilter getScanFilter()
startScan()
is called when the service starts.ScanFilter
to be used in the current application state.protected BleService.ScanType getScanType()
startScan()
is called when the service starts.BleService.ScanType
to be used in the current application state.protected int getActivityCount()
ReelyAwareActivities
currently running (0 or 1 basically)ReelyAwareActivities
runningpublic void onBleEvent(BleService.Event event, java.lang.Object data)
BleService.Event
is received.ReelyAwareActivity
(if any).onBleEvent
in interface BleServiceCallback
event
- The BleService.Event
received from the BleService
.protected android.content.Context getContext()
Context
.Context
.protected android.app.Activity getCurrentActivity()
protected BleService getBleService()
BleService
instance running.protected static boolean isReelyAware(android.app.Activity activity)
Activity
implements ReelyAwareActivity
activity
- The Activity
Activity
implements ReelyAwareActivity
, false if not.protected void onBleServiceBound()
is available
.protected void bindBleService()
protected void unbindBleService()