io.particle.android.sdk.cloud.ParticleCloud Java Examples

The following examples show how to use io.particle.android.sdk.cloud.ParticleCloud. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AuthenticatedSseEventSourceImpl.java    From spark-sdk-android with Apache License 2.0 6 votes vote down vote up
public AuthenticatedSseEventSourceImpl(URI location, ParticleCloud cloud) {
    super(location);
    this.cloud = cloud;

    URI loc = location;

    // Map "sse" to "http".
    if (location.getScheme().equalsIgnoreCase("sse")) {
        String fragment = location.getFragment();
        String schemeSpecificPart = location.getSchemeSpecificPart();

        if (fragment == null) {
            fragment = "";
        }
        loc = URI.create("http:" + schemeSpecificPart + fragment);
    }

    _location = loc;
    _readyState = ReadyState.CLOSED;

    // Used by the producer(i.e. the eventSourceListener) and the
    // consumer(i.e. the SseEventReader).
    _sharedQueue = new BlockingQueueImpl<>();
    _eventReader = new SseEventReaderImpl(this, _sharedQueue);
}
 
Example #2
Source File: SuccessActivity.java    From spark-setup-android with Apache License 2.0 6 votes vote down vote up
private void finishSetup(Context context, String deviceName, boolean isSuccess) {
    ParticleUi.showParticleButtonProgress(SuccessActivity.this, R.id.action_done, true);
    Async.executeAsync(particleCloud, new Async.ApiWork<ParticleCloud, Void>() {
        @Override
        public Void callApi(@NonNull ParticleCloud cloud) throws ParticleCloudException, IOException {
            ParticleDevice device = particleCloud.getDevice(getIntent().getStringExtra(EXTRA_DEVICE_ID));
            setDeviceName(device, deviceName);
            return null;
        }

        @Override
        public void onSuccess(@NonNull Void result) {
            leaveActivity(context, isSuccess);
        }

        @Override
        public void onFailure(@NonNull ParticleCloudException e) {
            ParticleUi.showParticleButtonProgress(SuccessActivity.this, R.id.action_done, false);
            deviceNameView.setError(getString(R.string.device_naming_failure));
        }
    });
}
 
Example #3
Source File: CreateAccountActivity.java    From spark-setup-android with Apache License 2.0 6 votes vote down vote up
private void singUpTaskSuccess(String email, String password, AccountInfo accountInfo, ParticleCloud cloud) {
    SEGAnalytics.track("android account creation", new Properties()
            .putValue("email", email)
            .putValue("firstname", accountInfo.getFirstName())
            .putValue("lastname", accountInfo.getLastName())
            .putValue("isbusiness", accountInfo.isBusinessAccount())
            .putValue("company", accountInfo.getCompanyName()));
    log.d("onAccountCreated()!");
    if (isFinishing()) {
        return;
    }
    if (useOrganizationSignup || useProductionSignup) {
        // with org setup, we're already logged in upon successful account creation
        onLoginSuccess(cloud);
        SEGAnalytics.track("Auth: Signed Up New Customer");
    } else {
        SEGAnalytics.track("Auth: Signed Up New User");
        attemptLogin(email, password);
    }
}
 
Example #4
Source File: AuthenticatedSseEventSourceImpl.java    From particle-android with Apache License 2.0 6 votes vote down vote up
public AuthenticatedSseEventSourceImpl(URI location, ParticleCloud cloud) {
    super(location);
    this.cloud = cloud;

    URI loc = location;

    // Map "sse" to "http".
    if (location.getScheme().equalsIgnoreCase("sse")) {
        String fragment = location.getFragment();
        String schemeSpecificPart = location.getSchemeSpecificPart();

        if (fragment == null) {
            fragment = "";
        }
        loc = URI.create("http:" + schemeSpecificPart + fragment);
    }

    _location = loc;
    _readyState = ReadyState.CLOSED;

    // Used by the producer(i.e. the eventSourceListener) and the
    // consumer(i.e. the SseEventReader).
    _sharedQueue = new BlockingQueueImpl<>();
    _eventReader = new SseEventReaderImpl(this, _sharedQueue);
}
 
Example #5
Source File: SuccessActivity.java    From particle-android with Apache License 2.0 6 votes vote down vote up
private void finishSetup(Context context, String deviceName, boolean isSuccess) {
    ParticleUi.showParticleButtonProgress(SuccessActivity.this, R.id.action_done, true);
    Async.executeAsync(particleCloud, new Async.ApiWork<ParticleCloud, Void>() {
        @Override
        public Void callApi(@NonNull ParticleCloud cloud) throws ParticleCloudException, IOException {
            ParticleDevice device = particleCloud.getDevice(getIntent().getStringExtra(EXTRA_DEVICE_ID));
            setDeviceName(device, deviceName);
            return null;
        }

        @Override
        public void onSuccess(@NonNull Void result) {
            leaveActivity(context, isSuccess);
        }

        @Override
        public void onFailure(@NonNull ParticleCloudException e) {
            ParticleUi.showParticleButtonProgress(SuccessActivity.this, R.id.action_done, false);
            deviceNameView.setError(getString(R.string.device_naming_failure));
        }
    });
}
 
Example #6
Source File: CreateAccountActivity.java    From particle-android with Apache License 2.0 6 votes vote down vote up
private void singUpTaskSuccess(String email, String password, AccountInfo accountInfo, ParticleCloud cloud) {
    SEGAnalytics.track("android account creation", new Properties()
            .putValue("email", email)
            .putValue("firstname", accountInfo.getFirstName())
            .putValue("lastname", accountInfo.getLastName())
            .putValue("isbusiness", accountInfo.isBusinessAccount())
            .putValue("company", accountInfo.getCompanyName()));
    log.d("onAccountCreated()!");
    if (isFinishing()) {
        return;
    }
    if (useOrganizationSignup || useProductionSignup) {
        // with org setup, we're already logged in upon successful account creation
        onLoginSuccess(cloud);
        SEGAnalytics.track("Auth: Signed Up New Customer");
    } else {
        SEGAnalytics.track("Auth: Signed Up New User");
        attemptLogin(email, password);
    }
}
 
Example #7
Source File: NextActivitySelector.java    From spark-setup-android with Apache License 2.0 5 votes vote down vote up
private NextActivitySelector(ParticleCloud cloud,
                             SensitiveDataStorage credStorage,
                             SetupCompleteIntentBuilder setupCompleteIntentBuilder) {
    Preconditions.checkNotNull(setupCompleteIntentBuilder, "SetupCompleteIntentBuilder instance is null");

    this.cloud = cloud;
    this.credStorage = credStorage;
    this.setupCompleteIntentBuilder = setupCompleteIntentBuilder;
}
 
Example #8
Source File: NextActivitySelector.java    From particle-android with Apache License 2.0 5 votes vote down vote up
public static Intent getNextActivityIntent(Context ctx,
                                           ParticleCloud particleCloud,
                                           SensitiveDataStorage credStorage,
                                           SetupResult setupResult) {
    NextActivitySelector selector = new NextActivitySelector(particleCloud, credStorage,
            ParticleDeviceSetupLibrary.getInstance().getSetupCompleteIntentBuilder());

    return selector.buildIntentForNextActivity(ctx, setupResult);
}
 
Example #9
Source File: NextActivitySelector.java    From particle-android with Apache License 2.0 5 votes vote down vote up
private NextActivitySelector(ParticleCloud cloud,
                             SensitiveDataStorage credStorage,
                             SetupCompleteIntentBuilder setupCompleteIntentBuilder) {
    Preconditions.checkNotNull(setupCompleteIntentBuilder, "SetupCompleteIntentBuilder instance is null");

    this.cloud = cloud;
    this.credStorage = credStorage;
    this.setupCompleteIntentBuilder = setupCompleteIntentBuilder;
}
 
Example #10
Source File: SetupStepsFactory.java    From particle-android with Apache License 2.0 5 votes vote down vote up
@RestrictTo(RestrictTo.Scope.LIBRARY)
public CheckIfDeviceClaimedStep newCheckIfDeviceClaimedStep(ParticleCloud sparkCloud, String deviceId) {
    return new CheckIfDeviceClaimedStep(
            StepConfig.newBuilder()
                    .setMaxAttempts(MAX_RETRIES_CLAIM)
                    .setResultCode(SuccessActivity.RESULT_FAILURE_CLAIMING)
                    .setStepId(R.id.verify_product_ownership)
                    .build(),
            sparkCloud, deviceId);
}
 
Example #11
Source File: NextActivitySelector.java    From spark-setup-android with Apache License 2.0 5 votes vote down vote up
public static Intent getNextActivityIntent(Context ctx,
                                           ParticleCloud particleCloud,
                                           SensitiveDataStorage credStorage,
                                           SetupResult setupResult) {
    NextActivitySelector selector = new NextActivitySelector(particleCloud, credStorage,
            ParticleDeviceSetupLibrary.getInstance().getSetupCompleteIntentBuilder());

    return selector.buildIntentForNextActivity(ctx, setupResult);
}
 
Example #12
Source File: CreateAccountActivity.java    From particle-android with Apache License 2.0 5 votes vote down vote up
private void attemptLogin(final String username, final String password) {
    final ParticleCloud cloud = ParticleCloudSDK.getCloud();
    Async.executeAsync(cloud, new Async.ApiWork<ParticleCloud, Void>() {
        @Override
        public Void callApi(@NonNull ParticleCloud particleCloud) throws ParticleCloudException {
            particleCloud.logIn(username, password);
            return null;
        }

        @Override
        public void onSuccess(@NonNull Void result) {
            log.d("Logged in...");
            if (isFinishing()) {
                return;
            }
            onLoginSuccess(cloud);
        }

        @Override
        public void onFailure(@NonNull ParticleCloudException error) {
            log.w("onFailed(): " + error.getMessage());
            ParticleUi.showParticleButtonProgress(CreateAccountActivity.this,
                    R.id.action_create_account, false);
            passwordView.setError(error.getBestMessage());
            passwordView.requestFocus();
        }
    });

}
 
Example #13
Source File: CreateAccountActivity.java    From particle-android with Apache License 2.0 5 votes vote down vote up
private void onLoginSuccess(ParticleCloud cloud) {
    startActivity(NextActivitySelector.getNextActivityIntent(
            CreateAccountActivity.this,
            cloud,
            SDKGlobals.getSensitiveDataStorage(),
            null));
    finish();
}
 
Example #14
Source File: SetupStepsFactory.java    From spark-setup-android with Apache License 2.0 5 votes vote down vote up
@RestrictTo(RestrictTo.Scope.LIBRARY)
public CheckIfDeviceClaimedStep newCheckIfDeviceClaimedStep(ParticleCloud sparkCloud, String deviceId) {
    return new CheckIfDeviceClaimedStep(
            StepConfig.newBuilder()
                    .setMaxAttempts(MAX_RETRIES_CLAIM)
                    .setResultCode(SuccessActivity.RESULT_FAILURE_CLAIMING)
                    .setStepId(R.id.verify_product_ownership)
                    .build(),
            sparkCloud, deviceId);
}
 
Example #15
Source File: CreateAccountActivity.java    From spark-setup-android with Apache License 2.0 5 votes vote down vote up
private void attemptLogin(final String username, final String password) {
    final ParticleCloud cloud = ParticleCloudSDK.getCloud();
    Async.executeAsync(cloud, new Async.ApiWork<ParticleCloud, Void>() {
        @Override
        public Void callApi(@NonNull ParticleCloud particleCloud) throws ParticleCloudException {
            particleCloud.logIn(username, password);
            return null;
        }

        @Override
        public void onSuccess(@NonNull Void result) {
            log.d("Logged in...");
            if (isFinishing()) {
                return;
            }
            onLoginSuccess(cloud);
        }

        @Override
        public void onFailure(@NonNull ParticleCloudException error) {
            log.w("onFailed(): " + error.getMessage());
            ParticleUi.showParticleButtonProgress(CreateAccountActivity.this,
                    R.id.action_create_account, false);
            passwordView.setError(error.getBestMessage());
            passwordView.requestFocus();
        }
    });

}
 
Example #16
Source File: SetupFlowTest.java    From particle-android with Apache License 2.0 5 votes vote down vote up
private void mockSetupSteps() {
    ConfigureAPStep configureAPStep = mock(ConfigureAPStep.class);
    ConnectDeviceToNetworkStep connectDeviceToNetworkStep = mock(ConnectDeviceToNetworkStep.class);
    CheckIfDeviceClaimedStep checkIfDeviceClaimedStep = mock(CheckIfDeviceClaimedStep.class);
    EnsureSoftApNotVisible ensureSoftApNotVisible = mock(EnsureSoftApNotVisible.class);
    WaitForCloudConnectivityStep waitForCloudConnectivityStep = mock(WaitForCloudConnectivityStep.class);
    WaitForDisconnectionFromDeviceStep waitForDisconnectionFromDeviceStep = mock(WaitForDisconnectionFromDeviceStep.class);
    //step configuration for each step
    mockStepConfig(configureAPStep, R.id.configure_device_wifi_credentials);
    mockStepConfig(connectDeviceToNetworkStep, R.id.connect_to_wifi_network);
    mockStepConfig(checkIfDeviceClaimedStep, R.id.verify_product_ownership);
    mockStepConfig(ensureSoftApNotVisible, R.id.wait_for_device_cloud_connection);
    mockStepConfig(waitForCloudConnectivityStep, R.id.check_for_internet_connectivity);
    mockStepConfig(waitForDisconnectionFromDeviceStep, R.id.reconnect_to_wifi_network);

    mockStep(configureAPStep, connectDeviceToNetworkStep, checkIfDeviceClaimedStep, ensureSoftApNotVisible,
            waitForCloudConnectivityStep, waitForDisconnectionFromDeviceStep);
    //return mocked setup steps from factory
    when(setupStepsFactory.newConfigureApStep(any(CommandClient.class), any(SetupStepApReconnector.class),
            any(ScanApCommand.Scan.class), isNull(), isNull()))
            .thenReturn(configureAPStep);
    when(setupStepsFactory.newConnectDeviceToNetworkStep(any(CommandClient.class), any(SetupStepApReconnector.class)))
            .thenReturn(connectDeviceToNetworkStep);
    when(setupStepsFactory.newCheckIfDeviceClaimedStep(any(ParticleCloud.class), isNull()))
            .thenReturn(checkIfDeviceClaimedStep);
    when(setupStepsFactory.newEnsureSoftApNotVisible(any(SSID.class), any(WifiFacade.class)))
            .thenReturn(ensureSoftApNotVisible);
    when(setupStepsFactory.newWaitForCloudConnectivityStep(any(Context.class)))
            .thenReturn(waitForCloudConnectivityStep);
    when(setupStepsFactory.newWaitForDisconnectionFromDeviceStep(any(SSID.class), any(WifiFacade.class)))
            .thenReturn(waitForDisconnectionFromDeviceStep);
}
 
Example #17
Source File: CreateAccountActivity.java    From spark-setup-android with Apache License 2.0 5 votes vote down vote up
private void onLoginSuccess(ParticleCloud cloud) {
    startActivity(NextActivitySelector.getNextActivityIntent(
            CreateAccountActivity.this,
            cloud,
            SDKGlobals.getSensitiveDataStorage(),
            null));
    finish();
}
 
Example #18
Source File: SetupFlowTest.java    From spark-setup-android with Apache License 2.0 5 votes vote down vote up
private void mockSetupSteps() {
    ConfigureAPStep configureAPStep = mock(ConfigureAPStep.class);
    ConnectDeviceToNetworkStep connectDeviceToNetworkStep = mock(ConnectDeviceToNetworkStep.class);
    CheckIfDeviceClaimedStep checkIfDeviceClaimedStep = mock(CheckIfDeviceClaimedStep.class);
    EnsureSoftApNotVisible ensureSoftApNotVisible = mock(EnsureSoftApNotVisible.class);
    WaitForCloudConnectivityStep waitForCloudConnectivityStep = mock(WaitForCloudConnectivityStep.class);
    WaitForDisconnectionFromDeviceStep waitForDisconnectionFromDeviceStep = mock(WaitForDisconnectionFromDeviceStep.class);
    //step configuration for each step
    mockStepConfig(configureAPStep, R.id.configure_device_wifi_credentials);
    mockStepConfig(connectDeviceToNetworkStep, R.id.connect_to_wifi_network);
    mockStepConfig(checkIfDeviceClaimedStep, R.id.verify_product_ownership);
    mockStepConfig(ensureSoftApNotVisible, R.id.wait_for_device_cloud_connection);
    mockStepConfig(waitForCloudConnectivityStep, R.id.check_for_internet_connectivity);
    mockStepConfig(waitForDisconnectionFromDeviceStep, R.id.reconnect_to_wifi_network);

    mockStep(configureAPStep, connectDeviceToNetworkStep, checkIfDeviceClaimedStep, ensureSoftApNotVisible,
            waitForCloudConnectivityStep, waitForDisconnectionFromDeviceStep);
    //return mocked setup steps from factory
    when(setupStepsFactory.newConfigureApStep(any(CommandClient.class), any(SetupStepApReconnector.class),
            any(ScanApCommand.Scan.class), isNull(), isNull()))
            .thenReturn(configureAPStep);
    when(setupStepsFactory.newConnectDeviceToNetworkStep(any(CommandClient.class), any(SetupStepApReconnector.class)))
            .thenReturn(connectDeviceToNetworkStep);
    when(setupStepsFactory.newCheckIfDeviceClaimedStep(any(ParticleCloud.class), isNull()))
            .thenReturn(checkIfDeviceClaimedStep);
    when(setupStepsFactory.newEnsureSoftApNotVisible(any(SSID.class), any(WifiFacade.class)))
            .thenReturn(ensureSoftApNotVisible);
    when(setupStepsFactory.newWaitForCloudConnectivityStep(any(Context.class)))
            .thenReturn(waitForCloudConnectivityStep);
    when(setupStepsFactory.newWaitForDisconnectionFromDeviceStep(any(SSID.class), any(WifiFacade.class)))
            .thenReturn(waitForDisconnectionFromDeviceStep);
}
 
Example #19
Source File: AuthenticatedEventSourceFactory.java    From spark-sdk-android with Apache License 2.0 4 votes vote down vote up
public AuthenticatedEventSourceFactory(ParticleCloud cloud) {
    this.cloud = cloud;
}
 
Example #20
Source File: CloudModule.java    From spark-setup-android with Apache License 2.0 4 votes vote down vote up
@Singleton
@Provides
protected ParticleCloud providesParticleCloud() {
    return ParticleCloudSDK.getCloud();
}
 
Example #21
Source File: CreateAccountActivity.java    From spark-setup-android with Apache License 2.0 4 votes vote down vote up
private void attemptSignUp() {
    AccountInfo accountInfo = new AccountInfo();
    accountInfo.setFirstName(firstNameView.getText().toString());
    accountInfo.setLastName(lastNameView.getText().toString());
    accountInfo.setCompanyName(companyNameView.getText().toString());
    accountInfo.setBusinessAccount(companyChoiceView.isChecked());
    // Store values at the time of the signup attempt.
    final String email = emailView.getText().toString();
    final String password = passwordView.getText().toString();
    SignUpInfo signUpInfo = new SignUpInfo(email, password, accountInfo);
    // Show a progress spinner, and kick off a background task to
    // perform the user login attempt.
    ParticleUi.showParticleButtonProgress(this, R.id.action_create_account, true);
    final ParticleCloud cloud = ParticleCloudSDK.getCloud();
    createAccountTask = Async.executeAsync(cloud, new Async.ApiWork<ParticleCloud, Void>() {
        @Override
        public Void callApi(@NonNull ParticleCloud particleCloud) throws ParticleCloudException {
            if (useOrganizationSignup && !useProductionSignup) {
                throw new ParticleCloudException(new Exception("Organization is deprecated, use productMode instead."));
            } else if (useProductionSignup) {
                int productId = getResources().getInteger(R.integer.product_id);
                if (productId == 0) {
                    throw new ParticleCloudException(new Exception("Product id must be set when productMode is in use."));
                }
                particleCloud.signUpAndLogInWithCustomer(signUpInfo, productId);
            } else {
                particleCloud.signUpWithUser(signUpInfo);
            }
            return null;
        }

        @Override
        public void onTaskFinished() {
            createAccountTask = null;
        }

        @Override
        public void onSuccess(@NonNull Void result) {
            singUpTaskSuccess(email, password, accountInfo, cloud);
        }

        @Override
        public void onFailure(@NonNull ParticleCloudException error) {
            signUpTaskFailure(error);
        }
    });
}
 
Example #22
Source File: Async.java    From spark-sdk-android with Apache License 2.0 4 votes vote down vote up
public static <T> AsyncApiWorker<ParticleCloud, T> executeAsync(ParticleCloud particleCloud,
                                                                ApiWork<ParticleCloud, T> work) {
    return (AsyncApiWorker<ParticleCloud, T>) new AsyncApiWorker<>(particleCloud, work)
            .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
 
Example #23
Source File: CloudModule.java    From particle-android with Apache License 2.0 4 votes vote down vote up
@Singleton
@Provides
protected ParticleCloud providesParticleCloud() {
    return ParticleCloudSDK.getCloud();
}
 
Example #24
Source File: Async.java    From particle-android with Apache License 2.0 4 votes vote down vote up
public static <T> AsyncApiWorker<ParticleCloud, T> executeAsync(ParticleCloud particleCloud,
                                                                ApiWork<ParticleCloud, T> work) {
    return (AsyncApiWorker<ParticleCloud, T>) new AsyncApiWorker<>(particleCloud, work)
            .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
 
Example #25
Source File: CheckIfDeviceClaimedStep.java    From spark-setup-android with Apache License 2.0 4 votes vote down vote up
CheckIfDeviceClaimedStep(StepConfig stepConfig, ParticleCloud sparkCloud,
                                String deviceBeingConfiguredId) {
    super(stepConfig);
    this.sparkCloud = sparkCloud;
    this.deviceBeingConfiguredId = deviceBeingConfiguredId;
}
 
Example #26
Source File: AuthenticatedEventSourceFactory.java    From particle-android with Apache License 2.0 4 votes vote down vote up
public AuthenticatedEventSourceFactory(ParticleCloud cloud) {
    this.cloud = cloud;
}
 
Example #27
Source File: CheckIfDeviceClaimedStep.java    From particle-android with Apache License 2.0 4 votes vote down vote up
CheckIfDeviceClaimedStep(StepConfig stepConfig, ParticleCloud sparkCloud,
                                String deviceBeingConfiguredId) {
    super(stepConfig);
    this.sparkCloud = sparkCloud;
    this.deviceBeingConfiguredId = deviceBeingConfiguredId;
}
 
Example #28
Source File: CreateAccountActivity.java    From particle-android with Apache License 2.0 4 votes vote down vote up
private void attemptSignUp() {
    AccountInfo accountInfo = new AccountInfo();
    accountInfo.setFirstName(firstNameView.getText().toString());
    accountInfo.setLastName(lastNameView.getText().toString());
    accountInfo.setCompanyName(companyNameView.getText().toString());
    accountInfo.setBusinessAccount(companyChoiceView.isChecked());
    // Store values at the time of the signup attempt.
    final String email = emailView.getText().toString();
    final String password = passwordView.getText().toString();
    SignUpInfo signUpInfo = new SignUpInfo(email, password, accountInfo);
    // Show a progress spinner, and kick off a background task to
    // perform the user login attempt.
    ParticleUi.showParticleButtonProgress(this, R.id.action_create_account, true);
    final ParticleCloud cloud = ParticleCloudSDK.getCloud();
    createAccountTask = Async.executeAsync(cloud, new Async.ApiWork<ParticleCloud, Void>() {
        @Override
        public Void callApi(@NonNull ParticleCloud particleCloud) throws ParticleCloudException {
            if (useOrganizationSignup && !useProductionSignup) {
                throw new ParticleCloudException(new Exception("Organization is deprecated, use productMode instead."));
            } else if (useProductionSignup) {
                int productId = getResources().getInteger(R.integer.product_id);
                if (productId == 0) {
                    throw new ParticleCloudException(new Exception("Product id must be set when productMode is in use."));
                }
                particleCloud.signUpAndLogInWithCustomer(signUpInfo, productId);
            } else {
                particleCloud.signUpWithUser(signUpInfo);
            }
            return null;
        }

        @Override
        public void onTaskFinished() {
            createAccountTask = null;
        }

        @Override
        public void onSuccess(@NonNull Void result) {
            singUpTaskSuccess(email, password, accountInfo, cloud);
        }

        @Override
        public void onFailure(@NonNull ParticleCloudException error) {
            signUpTaskFailure(error);
        }
    });
}
 
Example #29
Source File: AuthenticatedSseEventStream.java    From spark-sdk-android with Apache License 2.0 3 votes vote down vote up
public AuthenticatedSseEventStream(String sseLoc, ParticleCloud cloud) throws IOException {
    super(sseLoc);
    LOG.entering(CLASS_NAME, "<init>", sseLoc);

    this.cloud = cloud;

    // Validate the URI.
    URI.create(sseLoc);

    this.sseLocation = sseLoc;

    sseHandler = SSE_HANDLER_FACTORY.createHandler();

    sseHandler.setListener(new EventStreamHttpRequestListener());
}
 
Example #30
Source File: AuthenticatedSseEventStream.java    From particle-android with Apache License 2.0 3 votes vote down vote up
public AuthenticatedSseEventStream(String sseLoc, ParticleCloud cloud) throws IOException {
        super(sseLoc);
//        //LOG.entering(CLASS_NAME, "<init>", sseLoc);

        this.cloud = cloud;

        // Validate the URI.
        URI.create(sseLoc);

        this.sseLocation = sseLoc;

        sseHandler = SSE_HANDLER_FACTORY.createHandler();

        sseHandler.setListener(new EventStreamHttpRequestListener());
    }