Java Code Examples for android.net.Uri.Builder#appendPath()
The following examples show how to use
android.net.Uri.Builder#appendPath() .
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: EventsDelegate.java From spark-sdk-android with Apache License 2.0 | 5 votes |
Uri buildSingleDeviceEventUri(@Nullable String eventNamePrefix, String deviceId) { Builder builder = devicesBaseUri.buildUpon() .appendPath(deviceId) .appendPath(EVENTS); if (truthy(eventNamePrefix)) { builder.appendPath(eventNamePrefix); } return builder.build(); }
Example 2
Source File: BootstrapClient.java From StreamHub-Android-SDK with MIT License | 5 votes |
/** * Generates a general bootstrap endpoint with the specified parameters. * * @param siteId The Id of the article's site. * @param articleId The Id of the collection's article. * @param opts Optional parameters to pass in. Currently takes in pageNumber param for Bootstrap page number. * @return The init endpoint with the specified parameters. * @throws UnsupportedEncodingException * @throws MalformedURLException */ public static String generateBootstrapEndpoint(String siteId,String articleId,Map<String, Object>... opts)throws UnsupportedEncodingException { // Casting final String article64 = Helpers.generateBase64String(articleId); // Build the URL Builder uriBuilder = new Uri.Builder() .scheme(LivefyreConfig.scheme) .authority(LivefyreConfig.bootstrapDomain + "." + LivefyreConfig.getConfiguredNetworkID()) .appendPath("bs3") .appendPath("v3.1") .appendPath(LivefyreConfig.getConfiguredNetworkID()) .appendPath(siteId) .appendPath(article64); if (opts.length <= 0) { uriBuilder.appendPath("init"); } else { if (opts[0].get("pageNumber") instanceof Integer) { String page = opts[0].get("pageNumber").toString() + ".json"; uriBuilder.appendPath(page); } else { throw new IllegalArgumentException("Bootstrap page number must be an Integer"); } } return uriBuilder.toString(); }
Example 3
Source File: WriteClient.java From StreamHub-Android-SDK with MIT License | 5 votes |
/** * @param collectionId The Id of the collection. * @param userToken The token of the logged in user. * @param endpoint * @return * @throws MalformedURLException */ public static String generateWriteURL( String collectionId, String userToken, String endpoint) throws MalformedURLException { final Builder uriBuilder = new Uri.Builder().scheme(LivefyreConfig.scheme) .authority(LivefyreConfig.quillDomain + "." + LivefyreConfig.getConfiguredNetworkID()) .appendPath("api").appendPath("v3.0").appendPath("collection") .appendPath(collectionId).appendPath("post"); if (LFSConstants.LFSPostTypeReview == endpoint) uriBuilder.appendPath(endpoint).appendPath(""); else uriBuilder.appendPath(""); Log.d("Write URL", "" + uriBuilder.toString()); return uriBuilder.toString(); }
Example 4
Source File: WriteClient.java From StreamHub-Android-SDK with MIT License | 5 votes |
/** * @param collectionId The Id of the collection. * @param userToken The token of the logged in user. * @param endpoint * @param networkID Livefyre provided network name. * @return * @throws MalformedURLException */ public static String generateWriteURL( String collectionId, String userToken, String endpoint, String networkID) throws MalformedURLException { final Builder uriBuilder = new Uri.Builder().scheme(LivefyreConfig.scheme) .authority(LivefyreConfig.quillDomain + "." + networkID) .appendPath("api").appendPath("v3.0").appendPath("collection") .appendPath(collectionId).appendPath("post"); if (LFSConstants.LFSPostTypeReview.equals(endpoint)) uriBuilder.appendPath(endpoint).appendPath(""); else uriBuilder.appendPath(""); Log.d("Write URL", "" + uriBuilder.toString()); return uriBuilder.toString(); }