Class BroadcastResultReceiver

java.lang.Object
com.vuzix.connectivity.sdk.BroadcastResultReceiver

public abstract class BroadcastResultReceiver extends Object

Base class for code that receives and handles broadcast results sent by Connectivity.sendOrderedBroadcast(Device, Intent, BroadcastResultReceiver).

This class exists due to recent versions of Android preventing the use of Reflection to access private APIs, including BroadcastReceiver.PendingResult and BroadcastReceiver.setPendingResult(). Overall, this class functions very similarly to BroadcastReceiver and should be a drop-in replacement.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final int
    Retrieve the current result code, as set by the previous receiver.
    final String
    Retrieve the current result data, as set by the previous receiver.
    final android.os.Bundle
    getResultExtras(boolean makeMap)
    Retrieve the current result extra data, as set by the previous receiver.
    abstract void
    onReceive(android.content.Context context, android.content.Intent intent)
    This method is called when the BroadcastResultReceiver is receiving a result.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BroadcastResultReceiver

      public BroadcastResultReceiver()
  • Method Details

    • onReceive

      public abstract void onReceive(android.content.Context context, android.content.Intent intent)
      This method is called when the BroadcastResultReceiver is receiving a result. During this time you can use the other methods on BroadcastResultReceiver to view/modify the current result values.
      Parameters:
      context - The Context in which the receiver is running.
      intent - The Intent being received.
    • getResultCode

      public final int getResultCode()
      Retrieve the current result code, as set by the previous receiver.
      Returns:
      int The current result code.
    • getResultData

      public final String getResultData()
      Retrieve the current result data, as set by the previous receiver. Often this is null.
      Returns:
      String The current result data; may be null.
    • getResultExtras

      public final android.os.Bundle getResultExtras(boolean makeMap)
      Retrieve the current result extra data, as set by the previous receiver. Any changes you make to the returned Map will be propagated to the next receiver.
      Parameters:
      makeMap - If true then a new empty Map will be made for you if the current Map is null; if false you should be prepared to receive a null Map.
      Returns:
      Map The current extras map.