public class ReelyAwareApplicationCallback
extends java.lang.Object
implements android.app.Application.ActivityLifecycleCallbacks
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 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 |
onActivityCreated(android.app.Activity activity,
android.os.Bundle savedInstanceState)
************* METHODS NOT USED ******************
|
void |
onActivityDestroyed(android.app.Activity activity) |
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 |
onActivitySaveInstanceState(android.app.Activity activity,
android.os.Bundle outState) |
void |
onActivityStarted(android.app.Activity activity) |
void |
onActivityStopped(android.app.Activity activity) |
protected void |
onBleEvent(BleService.Event event)
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
runningprotected void onBleEvent(BleService.Event event)
BleService.Event
is received.ReelyAwareActivity
(if any).event
- The BleService.Event
received from the BleService
.protected android.content.Context getContext()
Context
.Context
.protected android.app.Activity getCurrentActivity()
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()
public void onActivityCreated(android.app.Activity activity, android.os.Bundle savedInstanceState)
onActivityCreated
in interface android.app.Application.ActivityLifecycleCallbacks
public void onActivityDestroyed(android.app.Activity activity)
onActivityDestroyed
in interface android.app.Application.ActivityLifecycleCallbacks
public void onActivityStarted(android.app.Activity activity)
onActivityStarted
in interface android.app.Application.ActivityLifecycleCallbacks
public void onActivityStopped(android.app.Activity activity)
onActivityStopped
in interface android.app.Application.ActivityLifecycleCallbacks
public void onActivitySaveInstanceState(android.app.Activity activity, android.os.Bundle outState)
onActivitySaveInstanceState
in interface android.app.Application.ActivityLifecycleCallbacks