Class SystemV1


  • public class SystemV1
    extends java.lang.Object

    Package Starting Point - This is the class that offers services to provide information on the system update.



    It is used by an application to make API calls to subscribe and unsubscribe to system events like SystemV1Events.PA and SystemV1Events.DECOMPRESSION. SystemV1 service gives back updates in the form of intents.

    Applications need to register for intents with a Local Broadcast Manager. When registering for intents with a Local Broadcast Manager, pass in as parameters:

    1. Local Broadcast Receiver
      When this receiver's onReceive(Context,Intent) callback is invoked, the value of the System Events can be accessed as follows:
      • Event name as String from InFlightIntentExtras.EVENT_NAME.

               public void onReceive(Context context, Intent intent) {
                     String eventName = intent
                     .getStringExtra(InFlightIntentExtras.EVENT_NAME
                     .getKeyName());
        
                     if (eventName.equals(SystemV1Events
                        .getSystemV1EventName(SystemV1Events.PA))) {
                     }
                 }
                      
      • Event payload as Bundle from InFlightIntentExtras.EVENT_DATA.

                 Bundle data = intent
                 .getBundleExtra(InFlightIntentExtras.EVENT_DATA
                 .getKeyName());
                 Log.d("Debug","getState(): "+ data.getInt(InFlightIntentExtras.STATE.getKeyName()));
                      
      • Event ID as String from InFlightIntentExtras.SERVICE_INSTANCE_ID.

                String eventID = intent
                .getStringExtra(InFlightIntentExtras.SERVICE_INSTANCE_ID
                .getKeyName());
                      
    2. IntentFilter with action: InFlightIntentActions.ACTION_SYSTEM_EVENT


    Intent registration example:
     LocalBroadcastManager.getInstance(this)
        .registerReceiver(
            mLocalBroadcastReceiver,
            new IntentFilter(
                InFlightIntentActions.ACTION_SYSTEM_EVENT
                .getIntentAction()));
    
    • Field Detail

      • SDK_VERSION

        public static final java.lang.String SDK_VERSION
    • Constructor Detail

      • SystemV1

        public SystemV1​(Context appContext,
                        java.lang.String appId)
    • Method Detail

      • initService

        public static void initService​(Context context,
                                       java.lang.String serviceInstanceId,
                                       IInFlightCallback inFlightCallback,
                                       InFlight inFlight)
        Initialize a SystemV1 object and return the object with the IInFlightCallback.
        Parameters:
        context - : provide a Context to initialize the object.
        serviceInstanceId - : service instance id identify the service object.
        inFlightCallback - : IInFlightCallback will be used to return the instance or providing the error message.
        inFlight - : provide an InFlight instance to initialize
      • subscribe

        public void subscribe​(java.util.List<SystemV1Events> systemEvents)
        Parameters:
        systemEvents - The list of system events the app wants to subscribe to



        Example:
         SystemV1.initService(activity, serviceInstanceId, inflightCallbackListener, new InFlight());
         

        public void onInitServiceComplete(Object service,String serviceName) { if (service instanceof SystemV1) { mSystemV1 = (SystemV1) service; try { ArrayList mSystemEvents = new ArrayList(); mSystemEvents.add(SystemV1Events.PA); mSystemEvents.add(SystemV1Events.DECOMPRESSION); mSystemV1.subscribe(mSystemEvents); } catch (Exception e) { Log.exception(e); } }

      • unSubscribe

        public void unSubscribe​(java.util.List<SystemV1Events> SystemEvents)
        This API is to unsubscribe to the list of system events like PA, Decompression, and Weight On wheels.
        Parameters:
        SystemEvents - The list of system events the app wants to unsubscribe to

        Example:
         SystemV1.initService(activity, serviceInstanceId, inflightCallbackListener, new InFlight());
         

        public void onInitServiceComplete(Object service,String serviceName) { if (service instanceof SystemV1) { mSystemV1 = (SystemV1) service; try { ArrayList mSystemEvents = new ArrayList(); mSystemEvents.add(SystemV1Events.DECOMPRESSION); mSystemEvents.add(SystemV1Events.PA); mSystemV1.unSubscribe(mSystemEvents); } catch (Exception e) { e.printStackTrace(); } }

      • getPaStatus

        public int getPaStatus()
        Returns PA status.
        Returns:
        int
      • getDecompressionStatus

        public boolean getDecompressionStatus()
        Returns Decompression status.
        Returns:
        boolean