public static Branch getInstance(@NonNull Context context, @NonNull String branchKey) {
        if (branchReferral_ == null) {
            branchReferral_ = Branch.initInstance(context);
        }
        branchReferral_.context_ = context.getApplicationContext();
        if (branchKey.startsWith("key_")) {
            boolean isNewBranchKeySet = branchReferral_.prefHelper_.setBranchKey(branchKey);
            //on setting a new key clear link cache and pending requests
            if (isNewBranchKeySet) {
                branchReferral_.linkCache_.clear();
                branchReferral_.requestQueue_.clear();
            }
        } else {
            PrefHelper.Debug("Branch Key is invalid. Please check your BranchKey");
        }
        return branchReferral_;
    }
public static Branch getInstance ( @ NonNull Context context , @ NonNull String branchKey ) { if ( branchReferral_ == null ) { branchReferral_ = Branch . initInstance ( context ) ; } branchReferral_ . context_ = context . getApplicationContext ( ) ; if ( branchKey . startsWith ( "key_" ) ) { boolean isNewBranchKeySet = branchReferral_ . prefHelper_ . setBranchKey ( branchKey ) ; if ( isNewBranchKeySet ) { branchReferral_ . linkCache_ . clear ( ) ; branchReferral_ . requestQueue_ . clear ( ) ; } } else { PrefHelper . Debug ( "Branch Key is invalid. Please check your BranchKey" ) ; } return branchReferral_ ; }
<p>Singleton method to return the pre-initialised, or newly initialise and return, a singleton
object of the type {@link Branch}.</p>

@param context   A {@link Context} from which this call was made.
@param branchKey Your Branch key as a {@link String}.
@return An initialised {@link Branch} object, either fetched from a pre-initialised
instance within the singleton class, or a newly instantiated object where
one was not already requested during the current app lifecycle.
@see <a href="https://github.com/BranchMetrics/Branch-Android-SDK/blob/05e234855f983ae022633eb01989adb05775532e/README.md#add-your-app-key-to-your-project">
Adding your app key to your project</a>