java.lang.Object
android.content.BroadcastReceiver
protected static final java.lang.String SDL_ROUTER_SERVICE_CLASS_NAME
protected static final int ANDROID_12_ROUTER_SERVICE_VERSION
public static final java.lang.String LOCAL_ROUTER_SERVICE_EXTRA
public static final java.lang.String LOCAL_ROUTER_SERVICE_DID_START_OWN
public static final java.lang.String TRANSPORT_GLOBAL_PREFS
public static final java.lang.String IS_TRANSPORT_CONNECTED
public static java.util.Vector runningBluetoothServicePackage
public SdlBroadcastReceiver()
public int getRouterServiceVersion()
public void onReceive(Context context,Intent intent)
This method will set a new UncaughtExceptionHandler for the current thread. There are two exceptions we want to catch here. The first exception is the rare occurrence that the SdlRouterService can't be started fast enough by the system after calling startForegroundService so the onCreate method doesn't get called before the foreground promise timer expires. The second is for the instance where the developers "SdlService" class can't be started fast enough by the system after calling startForegroundService OR the app is unable to start the "SdlService" class because the developer did not export the service in the manifest. The new UncaughtExceptionHandler will catch these specific exception and tell the main looper to continue forward. This still leaves the respective Service killed, but prevents an ANR to the app that makes the startForegroundService call.
protected static void setForegroundExceptionHandler()
Attempts to ping a running router service. It does call startForegroundService so it is important to only call this as a ping if the service is already started.
protected static void pingRouterService(Context context,String packageName,String className)
This call will reach out to all SDL related router services to check if they're connected. If a the router service is connected, it will react by pinging all clients. This receiver will then receive that ping and if the router service is trusted, the onSdlEnabled method will be called.
public static void queryForConnectedService(Context context)
Convenience method to log details on the specific exception that occurred while attempting to start a foreground service.
protected static void handleStartServiceException(Exception e)
public static android.content.ComponentName consumeQueuedRouterService()
We need to define this for local copy of the Sdl Router Service class. It will be the main point of connection for Sdl enabled apps
public abstract java.lang.Class defineLocalSdlRouterClass()
The developer will need to define exactly what should happen when Sdl is enabled. This method will only get called when a Sdl session is initiated.
The most useful code here would be to start the activity or service that handles most of the Livio Connect code.
public abstract void onSdlEnabled(Context context,Intent intent)
The developer can override this method to return the name of the class that manages their SdlService. This method is used to ensure the SdlBroadcastReceivers exception catcher catches the correct exception that may be thrown by the app trying to start their SdlService. If this exception is not caught the user may experience an ANR for that app.
public java.lang.String getSdlServiceName()
From Class | Methods |
---|---|
android.content.BroadcastReceiver | onReceive, goAsync, peekService, setResultCode, getResultCode, setResultData, getResultData, setResultExtras, getResultExtras, setResult, getAbortBroadcast, abortBroadcast, clearAbortBroadcast, isOrderedBroadcast, isInitialStickyBroadcast, setOrderedHint, setDebugUnregister, getDebugUnregister |
java.lang.Object | getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize |