aws-amplify / aws-sdk-android

AWS SDK for Android. For more information, see our web site:
https://docs.amplify.aws
Other
1.03k stars 548 forks source link

Documentation is Quite Confusing (package names and .ts code in Android documentation) #3637

Closed nithinbandaru1 closed 1 month ago

nithinbandaru1 commented 1 month ago

State your question

  1. Package names in repo README are different compared to package names provided in Amplify Documentation.
dependencies {
    implementation 'com.amazonaws:aws-android-sdk-SERVICE:2.x.y'
}

# Above, SERVICE might be s3, ddb, pinpoint, etc. A full list is provided below.
dependencies {
    // Amplify API dependencies
    implementation("com.amplifyframework:aws-storage-s3:2.19.1")
    implementation("com.amplifyframework:aws-auth-cognito:2.19.1")    
    // ... other dependencies
    coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.3")
}

Q1: I am not quite confused on which set should I be using for Android development. Please give some insight here? Q2: com.amazonaws:aws-android-sdk, is this package AWS Mobile SDK which gives low level APIs and not Amplify SDK? Q3: Amplify SDK, will it provide performance optimization or API usage optimization or both? Any insights on this like documentation could be great to understand Amplify advantages compared to other SDKs like Java SDK or Kotlin SDK which can also be used in Android if needed. Q4: Code samples in Amplify documentation shows typescript code. Is that supposed to be that way? Q5: I also see Gen 1 and Gen2 docs. Is Gen 1 legacy and Gen 2 latest? Gen 1 have V1 and V2 sessions. I don't get this part. I see that AWS REST APIs did not change from 2006. So I guess it is referring to Kotlin SDK versions? Correct? Or it just about amplify library versions?

Which AWS Services are you utilizing? S3

Provide code snippets (if applicable) Not applicable

Environment(please complete the following information):

Device Information (please complete the following information):

tylerjroach commented 1 month ago

@nithinbandaru1

The docs for the AWS-SDK-Android (this repo) can be found here: https://docs.amplify.aws/gen1/android/sdk/. The AWS SDK Android is an older SDK that was written pre-Amplify, but the provided documentation is hosted on the Amplify site. If you are writing new code, we would recommend that you use Amplify and/or the AWS Kotlin SDK.

The recommendation would be to use Amplify v2 (client side) with the Gen2 backend. Under the hood, the Amplify client library uses the AWS Kotlin SDK.

The AWS Kotlin SDK provides codegen API's to directly communicate with AWS Services. Amplify builds on top of these APIs to provide an opinionated solution/implementation to complex problems.

For example, Amplify Auth helps securely store tokens on device, and automatically handles refresh. Amplify Storage manages background transfers, restarts, splitting files for multipart uploads, etc. You could do all of this with the AWS Kotlin SDK, but you would have to implement the complexities of these scenarios yourself.

nithinbandaru1 commented 1 month ago

@tylerjroach Thanks for the reply.

Based on your reply. I got what is gen 1 and gen 2 means, advantage of amplify. Can you please confirm below things.

Q1: Can I assume that README in this repo is outdated because I see the package names different in Gen 2 documentation as shown in below image, Ideally it should be pointing to latest, greatest and highly recommended one right?

Edit:

  • I just saw you said this repo is for AWS-SDK-Android. That makes sense.
  • So, this repo will have no more updates. Right?
  • I have to say this repo README is not very clear because at beginning it talks directly about Amplify without any context saying this is AWS Android SDK which is legacy and Amplify or AWS SDK for Kotlin should be used. Hope this will be updated.
  • Amplify repo is at https://github.com/aws-amplify/amplify-android.

https://docs.amplify.aws/android/build-a-backend/storage/set-up-storage/

image

Q2: Code samples in Amplify documentation shows typescript code. Is that supposed to be that way?

https://docs.amplify.aws/android/build-a-backend/storage/set-up-storage/

image

vincetran commented 1 month ago

@nithinbandaru1 The README in this repo is accurate for developers that are still using or wish to use these packages. Therefore the README that says to use

dependencies {
    implementation 'com.amazonaws:aws-android-sdk-SERVICE:2.x.y'
}

is accurate for them.

The screenshot you provided to the Amplify documentation which all out packages with the namespace com.amplifyframework is also accurate for developers who wish to use Amplify. The README in this repo calls out Amplify as what we recommend as the "latest and greatest" and provides links to the documentation to use that library. We are not going to prevent developers from using this repo in their projects as there may be circumstances that require them to use this repo (e.g. older min SDK or a module that isn't supported by Amplify).

For your second question, the Typescript is there for setting up your backend resources like your S3 bucket. It is the Gen 2 way of setting up those resources. The Gen 1 way of setting up those same resources is to use the Amplify CLI tooling. You can read more about what Gen 2 specifically provides here: https://docs.amplify.aws/android/how-amplify-works/concepts/

nithinbandaru1 commented 1 month ago

Thanks for the fast replies guys. I really appreciate that. I think now I have good clarity on the AWS S3 SDK for Android ecosystem 😊.

vincetran commented 1 month ago

That's great! Glad we could help ☺️ will close this issue now.

github-actions[bot] commented 1 month ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.