Skip to content

Latest commit

 

History

History
118 lines (90 loc) · 18.5 KB

MobileSDK_To_AmplifyAndroid.md

File metadata and controls

118 lines (90 loc) · 18.5 KB

Migrating to Amplify Android From AWS Mobile SDK

Amplify Android simplifies integrating AWS services into Android apps, making it easier to add features like authentication, data storage, and real-time updates without lots of code. This user-friendly interface not only cuts down on complexity but also speeds up the development process. With Amplify Android, developers get tools that make setup straightforward, provide detailed documentation, and support advanced capabilities like offline data sync and GraphQL. This means you can spend less time dealing with the technicalities of cloud integration and more time crafting engaging user experiences. Choosing Amplify Android could lead to quicker development, plus applications that are both scalable and secure.

Categories

AWS SDK For Android Amplify Android
SignUp Sign Up
Confirm SignUp Confirm SignUp
Sign In Sign In
Guest Access Guest Access
Drop-in Auth Amplify UI Authenticator
Confirm Sign In (MFA) MFA
Change Password Change Password
Forgot Password Reset Password
Get Current User Get Current User
Managing Tokens and Credentials Accessing Credentials / Check Current Auth Session
SignOut Sign Out
Global SignOut Global Sign Out
Federated Identities Federated Identities
Hosted UI Web UI Sign In / Social Web UI Sign In
Custom Auth Flow Custom Auth Flow
Track/Remember Device Track/Remember Device

Notes:

  • Drop-in Auth provided by AWSMobileClient is replaced with Authenticator UI component. Additionally, Authenticator UI component does not support social providers yet. You can track updates on it here.

  • To manually refresh the ID and access tokens (such as in scenarios where you might need to ensure that you have the latest tokens, perhaps because of changes in permissions or other security-related updates) refer to Amplify docs

  • Amplify Sign In's will handle token refreshing as long as the refresh token is valid. Amplify does not support refreshing tokens automatically through federateToIdentityPool().

AWS SDK For Android Amplify Android
Upload File Upload File
Download File Download File
Track Progress Track Progress Download
Pause/Resume/Start/Cancel Pause/Resume/Start/Cancel
Long-running Transfers Amplify supports this by default
Transfer with Metadata Transfer with Metadata
Transfer Network Connection Type Amplify does not support this for now
AWS SDK For Android Amplify Android
Basic Operations Create, Fetch, Update, Delete
IAM Authorization IAM Authorization
Cognito User pool Authorization Cognito User pool Authorization
AWS SDK For Android Amplify Android
Setup, Push Notification Service Setup Setup, Push Notification Service Setup
Register Device Register Device
Record Notification Events Record Notification Events
AWS SDK For Android Amplify Android
Manually Track Session Automatically Track Session
Add Analytics Add Analytics
Authentication Events Authentication events
Custom Events Custom Events
Monetization events Please Check Notes

Notes:

  • For recording events:

When migrating from the AWS SDK for Android to Amplify, you'll need to adjust your approach to handle user sessions, as the two libraries have different mechanisms for managing user authentication and session management.

  • Use Amplify.Analytics.recordEvent() for recording Monetization event.
// Example:    
    val PURCHASE_EVENT_NAME = "_monetization.purchase"
    val PURCHASE_EVENT_QUANTITY_METRIC = "_quantity"
    val PURCHASE_EVENT_ITEM_PRICE_METRIC = "_item_price"
    val PURCHASE_EVENT_PRODUCT_ID_ATTR = "_product_id"
    val PURCHASE_EVENT_PRICE_FORMATTED_ATTR = "_item_price_formatted"
    val PURCHASE_EVENT_STORE_ATTR = "_store"
    val PURCHASE_EVENT_TRANSACTION_ID_ATTR = "_transaction_id"
    val PURCHASE_EVENT_CURRENCY_ATTR = "_currency"
    
    val event = AnalyticsEvent.builder()
            .name(PURCHASE_EVENT_NAME)
            .addProperty(PURCHASE_EVENT_PRODUCT_ID_ATTR, productId)
            .addProperty(PURCHASE_EVENT_STORE_ATTR, store)
            .addProperty(PURCHASE_EVENT_QUANTITY_METRIC, quantity)
            .addProperty(PURCHASE_EVENT_PRICE_FORMATTED_ATTR, formattedItemPrice)
            .addProperty(PURCHASE_EVENT_ITEM_PRICE_METRIC, itemPrice)
            .addProperty(PURCHASE_EVENT_TRANSACTION_ID_ATTR, transactionId)
            .addProperty(PURCHASE_EVENT_CURRENCY_ATTR, currency)
            .build()
    Amplify.Analytics.recordEvent(event)
  • Amplify Analytics events have default configuration to flush out to the network every 30 seconds. This interval can be configured in amplifyconfiguration.json. Refer Flush Events section in Amplify Documentation for more details.
  • Limits applicable to ingestion of events for Amazon Pinpoint can be found here.

Notes: