Skip to content
This repository was archived by the owner on Jul 3, 2024. It is now read-only.

Conversation

@AniVerma17
Copy link

  • Add the quick start guide to document the steps of installing and using the ImageKit Android SDK.
  • Update the summary file to add the link of the Android SDK guide.


## Rendering Images in Android application

Image URL can be created from an image path or using the absolute image URL. You can learn more about it in [docs](https://github.com/imagekit-developer/imagekit-javascript#url-generation).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we linking javascript SDK here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the hyperlink.

// https://ik.imagekit.io/your_imagekit_id/default-image.jpg?tr=h-400,ar-3-2
```

It will look as shown below. In the sample app, the buttons are present to demonstrate the use of different transformations. \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no screenshot right below this. Looks a bit confusing to me. Also there is unwanted \ at the end of this sentence?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


### **Upload policy**

The [UploadPolicy](https://github.com/imagekit-developer/imagekit-android/blob/master/README.md#uploadpolicy) class represents a set of conditions that need to be met for an upload request to be executed.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add more details here as to cover why someone might need upload policy in the first place.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


The `ImageKitUploader` can also perform the preprocessing of the image/video to modify them before uploading, by passing an instance of [ImageUploadPreprocessor](https://github.com/imagekit-developer/imagekit-android/blob/master/README.md#image-preprocessing)/[VideoUploadPreprocessor](https://github.com/imagekit-developer/imagekit-android/blob/master/README.md#video-preprocessing).

Currently, follwing processes can be applied by upload preprocessors:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add more details to cover the use-case e.g. optimize imagekit storage by avoiding upload of large files, speed up upload request etc.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


## Integrations with third-party libraries

ImageKit Android SDK also provides library extensions for integrations with the following image loading libraries for Android:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This heading should be hyper linked in rendering images section IMO. We can do that in the end.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the hyperlink to this section at the end of rendering images section.

## **Clone and run the tutorial app**

For this tutorial, we have used our sample Android app as shown below. If you have your own existing Android app, you can integrate the ImageKit Android SDK to it, the instructions for which are provided in the subsequent sections.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a line before the git clone command
Clone tutorial app repository with the following command


#### Initializing the SDK

Initialize our SDK prefereable in the `Application` class or any `Activity` as needed, with the following code:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Initialize our SDK prefereable in the `Application` class or any `Activity` as needed, with the following code:
Initialize our SDK preferably in the `Application` class or any `Activity` as needed, with the following code:

git clone https://github.com/imagekit-samples/quickstart.git
```

Open the `android` folder within the cloned repository in Android Studio, and run Gradle sync to install the dependencies that are needed to run the Android app. Then run the app by selecting your target device/emulator and clicking on the Run button in Studio.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems a little confusing and too many things at once

Suggested change
Open the `android` folder within the cloned repository in Android Studio, and run Gradle sync to install the dependencies that are needed to run the Android app. Then run the app by selecting your target device/emulator and clicking on the Run button in Studio.
Once you've cloned the repository, open `android` folder in Android Studio. Perform Gradle sync to install all the necessary dependencies for the Android app. After the sync, run the app by selecting your target device/emulator and clicking on the `Run` button in Studio.

Copy link
Author

@AniVerma17 AniVerma17 Jan 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edited the text for better clarity of each step.

You should see the following screen. This means the sample app has been set up correctly.

![](<../../.gitbook/assets/Screenshot 2023-09-11 at 2.05.12 PM.png>)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing section Setup ImageKit Android SDK

This section is necessary to distinguish between the Clone and run the tutorial app and Installing the SDK section. Right now it seems like in the tutorial app you have to install the sdk, but those instructions are for adding sdk into an existing application

Refer: https://docs.imagekit.io/getting-started/quickstart-guides/ios#setup-imagekit-ios-sdk

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the heading to separate the sections.

* ​Aspect Ratio
* ​Chained transformation

ImageKit Android SDK provides a function to each transformation parameter e.g. `height` for `h` and `width` for `w` parameter. It makes your code more readable. See the [full list of supported transformations](https://github.com/imagekit-developer/imagekit-Android#list-of-supported-transformations) in Android SDK on Github.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ImageKit Android SDK provides a function to each transformation parameter e.g. `height` for `h` and `width` for `w` parameter. It makes your code more readable. See the [full list of supported transformations](https://github.com/imagekit-developer/imagekit-Android#list-of-supported-transformations) in Android SDK on Github.
ImageKit Android SDK provides a function to each transformation parameter e.g. `height` for `h` and `width` for `w` parameter. It makes your code more readable. See the [full list of supported transformations](https://github.com/imagekit-developer/imagekit-android#list-of-supported-transformations) in Android SDK on Github.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


Let's learn how to upload an image to our media library.

Android SDK provides `ImageKitUploader` which provide functions to allow upload files to the [ImageKit media library](../../media-library/overview/) directly from the client-side.&#x20;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Android SDK provides `ImageKitUploader` which provide functions to allow upload files to the [ImageKit media library](../../media-library/overview/) directly from the client-side.&#x20;
Android SDK provides `ImageKitUploader` which provide functions to allow upload files to the [ImageKit media library](../../media-library/overview/) directly from the client-side.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


For this, we would need a dummy backend app to authenticate our upload request. API authentication for upload always happens on the backend for security reasons.

The tutorial repository comes with a sample backend server that we can use.&#x20;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove from everywhere, not commenting in the entire page

Suggested change
The tutorial repository comes with a sample backend server that we can use.&#x20;
The tutorial repository comes with a sample backend server that we can use.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


Android SDK provides `ImageKitUploader` which provide functions to allow upload files to the [ImageKit media library](../../media-library/overview/) directly from the client-side.&#x20;

For using upload functionality, we need to pass `publicKey` while [initializing the SDK](Android.md#setup-imagekit-Android-sdk), and pass the client-generated JSON Web Token (JWT) in the upload method, which the ImageKit.io server uses to authenticate and check that the upload request parameters have not been tampered with after the generation of the token. Refer this [guide](https://docs.imagekit.io/api-reference/upload-file-api/secure-client-side-file-upload#how-to-implement-authenticationendpoint-endpoint) to create the token below on the page.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary but URL's are case sensitive, it's better to keep it consistent

Suggested change
For using upload functionality, we need to pass `publicKey` while [initializing the SDK](Android.md#setup-imagekit-Android-sdk), and pass the client-generated JSON Web Token (JWT) in the upload method, which the ImageKit.io server uses to authenticate and check that the upload request parameters have not been tampered with after the generation of the token. Refer this [guide](https://docs.imagekit.io/api-reference/upload-file-api/secure-client-side-file-upload#how-to-implement-authenticationendpoint-endpoint) to create the token below on the page.
For using upload functionality, we need to pass `publicKey` while [initializing the SDK](android.md#setup-imagekit-Android-sdk), and pass the client-generated JSON Web Token (JWT) in the upload method, which the ImageKit.io server uses to authenticate and check that the upload request parameters have not been tampered with after the generation of the token. Refer this [guide](https://docs.imagekit.io/api-reference/upload-file-api/secure-client-side-file-upload#how-to-implement-authenticationendpoint-endpoint) to create the token below on the page.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@AniVerma17 AniVerma17 force-pushed the chore/android_quickstart_guide branch from b043074 to 33b807b Compare January 22, 2024 13:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants