io.particle.android.sdk.cloud.Responses.ClaimCodeResponse Java Examples
The following examples show how to use
io.particle.android.sdk.cloud.Responses.ClaimCodeResponse.
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: GetReadyActivity.java From particle-android with Apache License 2.0 | 5 votes |
private void handleClaimCode(@NonNull ClaimCodeResponse result) { log.d("Claim code generated: " + result.getClaimCode()); DeviceSetupState.claimCode = result.getClaimCode(); if (truthy(result.getDeviceIds())) { DeviceSetupState.claimedDeviceIds.addAll(Arrays.asList(result.getDeviceIds())); } if (isFinishing()) { return; } moveToDeviceDiscovery(); }
Example #2
Source File: GetReadyActivity.java From particle-android with Apache License 2.0 | 5 votes |
private ClaimCodeResponse generateClaimCode(Context ctx) throws ParticleCloudException { Resources res = ctx.getResources(); if (res.getBoolean(R.bool.organization) && !res.getBoolean(R.bool.productMode)) { return sparkCloud.generateClaimCodeForOrg(res.getString(R.string.organization_slug), res.getString(R.string.product_slug)); } else if (res.getBoolean(R.bool.productMode)) { int productId = res.getInteger(R.integer.product_id); if (productId == 0) { throw new ParticleCloudException(new Exception("Product id must be set when productMode is in use.")); } return sparkCloud.generateClaimCode(productId); } else { return sparkCloud.generateClaimCode(); } }
Example #3
Source File: GetReadyActivity.java From spark-setup-android with Apache License 2.0 | 5 votes |
private void handleClaimCode(@NonNull ClaimCodeResponse result) { log.d("Claim code generated: " + result.claimCode); DeviceSetupState.claimCode = result.claimCode; if (truthy(result.deviceIds)) { DeviceSetupState.claimedDeviceIds.addAll(Arrays.asList(result.deviceIds)); } if (isFinishing()) { return; } moveToDeviceDiscovery(); }
Example #4
Source File: GetReadyActivity.java From spark-setup-android with Apache License 2.0 | 5 votes |
private ClaimCodeResponse generateClaimCode(Context ctx) throws ParticleCloudException { Resources res = ctx.getResources(); if (res.getBoolean(R.bool.organization) && !res.getBoolean(R.bool.productMode)) { return sparkCloud.generateClaimCodeForOrg(res.getString(R.string.organization_slug), res.getString(R.string.product_slug)); } else if (res.getBoolean(R.bool.productMode)) { int productId = res.getInteger(R.integer.product_id); if (productId == 0) { throw new ParticleCloudException(new Exception("Product id must be set when productMode is in use.")); } return sparkCloud.generateClaimCode(productId); } else { return sparkCloud.generateClaimCode(); } }
Example #5
Source File: ApiDefs.java From spark-sdk-android with Apache License 2.0 | 4 votes |
@FormUrlEncoded @POST("/v1/products/{productId}/device_claims") ClaimCodeResponse generateClaimCodeForOrg(@Field("blank") String blankBody, @Path("productId") Integer productId);
Example #6
Source File: ApiDefs.java From spark-sdk-android with Apache License 2.0 | 4 votes |
@FormUrlEncoded @POST("/v1/orgs/{orgSlug}/products/{productSlug}/device_claims") @Deprecated ClaimCodeResponse generateClaimCodeForOrg(@Field("blank") String blankBody, @Path("orgSlug") String orgSlug, @Path("productSlug") String productSlug);
Example #7
Source File: ApiDefs.java From spark-sdk-android with Apache License 2.0 | 2 votes |
/** * Newer versions of OkHttp <em>require</em> a body for POSTs, but just pass in * a blank string for the body and all is well. */ @FormUrlEncoded @POST("/v1/device_claims") ClaimCodeResponse generateClaimCode(@Field("blank") String blankBody);