Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Expand your Android apps beyond the phone

Anisha Malde
November 21, 2022

Expand your Android apps beyond the phone

Expand your Android apps beyond the phone with Amazon Appstore

Anisha Malde

November 21, 2022
Tweet

More Decks by Anisha Malde

Other Decks in Technology

Transcript

  1. class AmazonAppstoreIAPDataSource private constructor( application: Application, private val defaultScope: CoroutineScope,

    knownInappSKUs: Array<String>?, knownSubscriptionSKUs: Array<String>?, autoConsumeSKUs: Array<String>? ) : PurchasingListener {
  2. class AmazonAppstoreIAPDataSource private constructor( application: Application, private val defaultScope: CoroutineScope,

    knownInappSKUs: Array<String>?, knownSubscriptionSKUs: Array<String>?, autoConsumeSKUs: Array<String>? ) : PurchasingListener {
  3. public interface PurchasingListener { void onUserDataResponse(UserDataResponse userDataResponse); void onProductDataResponse(ProductDataResponse productDataResponse);

    void onPurchaseResponse(PurchaseResponse purchaseResponse); void onPurchaseUpdatesResponse(PurchaseUpdatesResponse purchaseUpdatesResponse);
  4. class MyA3LMessagingService : A3LMessagingService() { override fun onMessageReceived(context: Context, aMessage:

    RemoteMessage) { // Handle message } override fun onNewToken(context: Context, token: String) { Log.d(TAG, "In onNewDeviceId") Log.d(TAG, "Device token: $token") } }
  5. class MyA3LMessagingService : A3LMessagingService() { override fun onMessageReceived(context: Context, aMessage:

    RemoteMessage) { // Handle message } override fun onNewToken(context: Context, token: String) { Log.d(TAG, "In onNewDeviceId") Log.d(TAG, "Device token: $token") } }
  6. class MyA3LMessagingService : A3LMessagingService() { override fun onMessageReceived(context: Context, aMessage:

    RemoteMessage) { // Handle message } override fun onNewToken(context: Context, token: String) { Log.d(TAG, "In onNewDeviceId") Log.d(TAG, "Device token: $token") } }
  7. class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) {

    super.onCreate(savedInstanceState) val onInitCallback: OnInitCallback = object : OnInitCallback() { override fun onReady(initCallbackResponse: InitCallbackResponse) { if (initCallbackResponse.isSuccessful) { } else { } } } A3LMessaging.init(applicationContext, onInitCallback)
  8. class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) {

    super.onCreate(savedInstanceState) val onInitCallback: OnInitCallback = object : OnInitCallback() { override fun onReady(initCallbackResponse: InitCallbackResponse) { if (initCallbackResponse.isSuccessFul) { } else { } } } A3LMessaging.init(applicationContext, onInitCallback)
  9. class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) {

    super.onCreate(savedInstanceState) val onInitCallback: OnInitCallback = object : OnInitCallback() { override fun onReady(initCallbackResponse: InitCallbackResponse) { if (initCallbackResponse.isSuccessFul) { } else { } } } A3LMessaging.init(applicationContext, onInitCallback)
  10. Prerequisites Currently available to customers with Windows 11 and Amazon

    accounts registered in US, Japan, UK, France, Italy, Spain, Germany, Canada and Australia PC Specific Windows 11 requirements (e.g. 8GB RAM, SSD Storage) microsoft.com/en-gb/windows/windows-11-specifications
  11. val windowSize = calculateWindowSizeClass(this).widthSizeClass when (windowSize) { WindowWidthSizeClass.Compact -> {

    // Your Awesome App in a Compact Window } WindowWidthSizeClass.Medium -> { // Reasonable space to have all your app and others together on screen } WindowWidthSizeClass.Expanded -> { // Woaah! Your app UI will be super cool using all the screen! } else -> { } }
  12. class MainActivity : ComponentActivity() { @OptIn(ExperimentalMaterial3WindowSizeClassApi::class) override fun onCreate(savedInstanceState: Bundle?)

    { super.onCreate(savedInstanceState) ... setContent { val widthSizeClass = calculateWindowSizeClass(this).widthSizeClass AADevsApp(widthSizeClass) } } }
  13. Windowing Resizing Handle window resize changes dynamically: DON’T Persistent storage

    to save and restore the UI state of your activity across configuration changes.
  14. Input Devices WSA reports mouse down/move/up events as touch events

    by default Account for keyboard & mouse specific events Include optimizations for actions such as right click & hover effects
  15. fun Modifier.interceptKey(key: Key, onKeyEvent: () -> Unit): Modifier { return

    this.onPreviewKeyEvent { if (it.key == key && it.type == KeyUp) { onKeyEvent() true } else it.key == key } }
  16. private fun Modifier.notifyInput(block: () -> Unit, blockRight: () -> Unit):

    Modifier = composed { val blockState = rememberUpdatedState(block) val blockRightState = rememberUpdatedState(blockRight) pointerInput(Unit) { while (currentCoroutineContext().isActive) { awaitPointerEventScope { val event = awaitPointerEvent(PointerEventPass.Initial) if (event.buttons.isSecondaryPressed) { blockRightState.value() } else { blockState.value() } } } } }
  17. Composable private fun ArticleHeaderImage( article: Article ) { val interactionSource

    = remember { MutableInteractionSource() } val isHovered by interactionSource.collectIsHoveredAsState() val borderColor = if (isHovered) Color.Red else Color.Blue val imageModifier = Modifier .hoverable(interactionSource = interactionSource) .border(BorderStroke(2.dp, borderColor)) Image( ... modifier = imageModifier, ... ) }
  18. APIs and Services Billing Amazon in-app purchasing API (Appstore SDK)

    Cloud Messaging A3L Firebase SDK Firebase Javascript SDKs In-App messaging Amazon Device Messaging (ADM)