Filter
-
Content Type
-
Category
Mobile/Wearable
Visual Display
Digital Appliance
Platform
Recommendations
Filter
Learn Code Lab
codelabcreate a smartthings edge driver for an iot bulb objective learn how to create and customize an edge driver for an iot bulb to seamlessly interoperate on the smartthings platform overview smartthings is a platform for iot devices to communicate within its ecosystem, enabling smarter living solutions that simplify everybody else's way of life there are multiple methods to connect an iot device to the smartthings platform, one of which is through a smartthings hub hub connected devices connect to a smartthings-compatible hub using matter, zigbee, z-wave, or lan protocols the smartthings-compatible hub allows devices that utilize these protocols to integrate within the smartthings platform, permitting users to view and control devices from the smartthings app to automate actions and more the connection from a smartthings device to a smartthings hub is made possible with edge drivers smartthings edge drivers serve as translators between the protocols used by the device and the smartthings platform these drivers enable the devices to run locally on the hub, offering many benefits including speed, reliability, and enhanced functionality learn more about edge drivers in the smartthings edge architecture section set up your environment notefor sdc24 attendees, skip this step as it’s already done for you you will need the following host pc running on windows 10 or higher or ubuntu 20 04 x64 visual studio code latest version recommended devices connected on the same network android mobile device with smartthings app installed with android 10 or higher smartthings station or smartthings hub onboarded with samsung account philips hue bulb smartthings connected device sample code here is a sample code for this code lab download it and start your learning experience! edge driver sample code 6 1 kb install smartthings cli you need to install smartthings cli as this is the main tool for developing apps and drivers for smartthings edge drivers to install smartthings cli, open a web browser and download the smartthings msi installer from the latest release open the smartthings cli setup in the downloaded file, then click next accept the license agreement terms, then click next select the destination path for installation and click next to begin the installation process, click install notethe windows installer may display a warning titled windows protected your pc to continue the installation, click more info > run anyway complete the setup by clicking finish to verify if smartthings cli is installed correctly, open the command prompt and run this command smartthings --version view and run available commands for smartthings cli with this command smartthings --help for a full list of commands, visit the smartthings cli commands notethe smartthings cli supports an automatic login flow that launches a browser window, prompting the user to log in with a samsung account and grant the cli permissions to access the user's account start your project after downloading and extracting the sample code containing the project files, click file > open folder in visual studio code to open it locate the sample code directory and click select folder once finished, the project files are seen on the explorer menu set the bulb's color configuration in init lua, under the device_init function, write the code below to set the bulb's colors and its transition time local colorcontrol = clusters colorcontrol local philips_hue_colors = { {0xed, 0xc4}, -- red {0xae, 0xe3}, -- blue {0x2c, 0xc3}, -- yellow {0x53, 0xd3}, -- green {0xca, 0x08}, -- white } local index = 1 local transition_time = 0 --1/10ths of a second -- when sent with a command, these options mask and override bitmaps cause the command -- to take effect when the switch/light is off local options_mask = 0x01 local options_override = 0x01 device send colorcontrol server commands movetohueandsaturation device, philips_hue_colors[5][1], philips_hue_colors[5][2], transition_time, options_mask, options_override local timer = device thread call_on_schedule 1, function local hue = philips_hue_colors[index][1] local sat = philips_hue_colors[index][2] device send colorcontrol server commands movetohueandsaturation device, hue, sat, transition_time, options_mask, options_override index = index + 1 % 6 if index == 0 then index = 1 end end, "color_schedule_timer" save the file and open either the command prompt or terminal notemake sure that the path directory in your cli contains the project file build and upload your edge driver in the terminal, type the following command to build and upload your edge driver package to the smartthings cloud smartthings edge drivers package create a private channel create a new channel for your edge driver and enter the following channel details smartthings edge channels create channel name smartthings edge driver channel channel description channel for sdc2024 channel terms of service url www smartthings com enroll the smartthings hub in your channel enroll your hub in your newly created channel and select the corresponding channel and hub smartthings edge channels enroll assign the edge driver to your channel assign your driver to the created channel smartthings edge channels assign install the edge driver to your hub install the created edge driver from your channel to your own hub smartthings edge drivers install control the bulb via smartthings app on your mobile phone, launch the smartthings app and tap the + icon once you're on the add device page, tap scan nearby make sure that the philips light bulb is turned on wait for the light bulb to be visible once visible, tap done now, observe the blinking and changing colors of your bulb you're done! congratulations! you have successfully achieved the goal of this code lab now, you can create an edge driver for smartthings devices that can be integrated into the smartthings ecosystem! to learn more about smartthings hub connected devices and edge drivers, visit smartthings hub connected devices smartthings edge driver documentation
Learn Code Lab
codelabutilize the add to samsung wallet service for digital cards notescenes in the demo video are simulated and does not represent any real-world conditions or outcomes objective learn how to use the add to samsung wallet service so that users can store digital contents, such as boarding passes, tickets, and coupons, to their samsung wallet app partnership request to create, manage, and monitor performance of wallet cards with the samsung wallet partners site, you must become an official samsung partner once done, you can fully utilize this code lab you can learn more by visiting samsung wallet partner onboarding process, here in samsung developers overview samsung wallet is an application that securely stores essential items such as boarding passes, tickets, and coupons, making them easily accessible from anywhere with this app, users can access various partner wallet cards in one place, simply by swiping up from the bottom of the screen the add to samsung wallet service provides interfaces for users to conveniently add digital content to samsung wallet here are examples of the supported wallet cards boarding pass journey information such as flights, trains, and buses can be provided as notifications, allowing easy retrieval when checking in by configuring server synchronization, updates to journey information such as gate changes, schedule changes, or cancellations can be received by the users ticket notifications about events and additional information, including benefits, can be provided based on real-time utilization of performances, sports games, movies, and admission tickets, status updates related to expiration and availability can be provided gift card gift card, also referred to as a prepaid card, provides real-time balance and transaction history loyalty loyalty cards function as membership credentials, managing membership information through these cards, loyalty points can be administered and redeemed id id cards can fulfill identification verification purposes, such as identity cards, employee cards, and licenses physical documents can be represented through wallet cards, and near field communication nfc -based authentication can be provided reservation reservation cards can contain diverse online booking details, including rental cars, restaurants, and accommodations ongoing reservation information can be managed as a journey pay as you go pay as you go cards allow users to register services that can be charged and utilized according to their preference for convenient use generic card generic cards enable users to create customized cards by selecting preferred card template layouts and designing elements notedepending on your country or region, some card types are not supported if you need assistance, please contact us at developer samsung com/dashboard/support the image below shows the process of managing wallet cards for more information, refer to manage wallet cards set up your environment notefor sdc24 attendees, skip this step as it's already done for you you will need the following latest version of samsung wallet app from galaxy store samsung galaxy device that supports samsung wallet access to samsung wallet partners site internet browser, such as chrome openssl intellij idea or any java ide optional start the onboarding process partners can manage wallet cards and monitor performance with the samsung wallet partners site to join as partner generate a private key and certificate signing request csr using the openssl command you can follow the instructions in security factors notea private key enables encryption and is the most important component of certificates while csr, which is a necessary factor to obtain a signed certificate, includes the public key and additional information like organization and country proceed to register in the samsung wallet partners site using your samsung account follow the samsung wallet partner onboarding process upload the generated csr for data encryption in encryption setting management section after registration, you will receive a welcome email noteupon receiving the certificates via email, be sure to keep the information safe from exposure and only use them for the following purposes signed certificate used along with the private key to sign data samsung certificate used to encrypt card data and validate authentication tokens in server api headers create a wallet card follow the steps below to create a wallet card in samsung wallet partners site click the wallet cards menu and choose create wallet card fill out the general information form with the details of the wallet card in wallet card template, choose a card type and sub type select the design type and click done you can choose from various types of wallet card templates optimized for partners after inputting all necessary details, click save to set the wallet card status to draft launch the wallet card you can launch and request activation of the card by clicking the launch button upon agreeing to proceed, the launch button text changes to launched and the card status becomes verifying add the card to samsung wallet using the test tool open a web browser on your computer or galaxy mobile device, and go to the following link partner walletsvc samsung com/addtowallettest go to add to wallet tab and click choose key file to upload your private key in the select card dropdown menu, select the created card to display the card details and populate sample data navigate to the form tab and modify the card data as desired notethe structure for configuring wallet cards follows the defined specification you can refer to the full list of card-specific attributes specification scroll down to the bottom of the page and click the add to samsung wallet button click done when a preview of the card shows on your mobile screen with a message indicating that the card has been added to your wallet once the card is added to your samsung wallet app, you can check its details by clicking on it noteyou can also go to the playground tab and add cards to the samsung wallet app even without creating a card on the wallet partners site update the status of the added card if a server api info partner get card data and partner send card state is registered in the wallet card, real-time updates of the user's registered cards can be provided notefor more information, see server interaction modify and update the card's status by utilizing the push notification feature of the test tool navigate to the push notification tab ensure that the correct private key is uploaded and the same card as in the add to wallet tab is selected copy the ref id value from the add to wallet tab and paste it into ref id field in the push notification tab in the status field, enter one of the following card states expired, redeemed, held, suspended, or deleted the current state is set to active then, click the request push notification button check the card in the samsung wallet app to confirm the change tokenize card data and implement the add to samsung wallet button to your service optional notethis step is optional, but if you want to learn how to integrate the add to samsung wallet button into your services like an android app, web app, or email, you can follow these steps the samsung wallet partners site provides generated add to samsung wallet scripts for each wallet card you create you can simply copy and paste these scripts into your partner apps web and android or include them in emails/mms messages to implement the add to wallet button, follow these steps go to the [add to wallet script guide] section of the card you created click show to view the available scripts and then copy the appropriate script for your service develop a program that can generate tokenized card data cdata the cdata represents the actual content of the wallet card and comes in different formats depending on the card type you can check the cdata generation sample code for reference the cdata is derived from the card data, which is in json format for testing purposes, you can utilize the generated json from the test tool follow the implementing atw button guide to determine where to incorporate the generated cdata and gain further insights into this process you're done! congratulations! you have successfully achieved the goal of this code lab topic now, you can utilize the add to samsung wallet service by yourself! to learn more about samsung wallet, visit developer samsung com/wallet
Learn Code Lab
codelabdevelop a smartthings find-compatible device objective learn how to create your own smartthings find-compatible device using the smartthings find partnership program device sdk learn how to measure the radio frequency rf performance of a bluetooth low energy ble device using tag toolbox partnership request the smartthings find partnership program is available only to registered partners who wish to commercialize you can only do this code lab and get the resources after a successful partnership to form a partnership, contact partners@smartthings com overview the smartthings find partnership program comprises smartthings find device specification, smartthings find device sdk, test tool, and technical support it facilitates the development of devices operating with smartthings find services and mobile applications the smartthings find device sdk is small enough to work on resource-limited microcontroller unit mcu devices in this code lab, you can learn how to develop your own smartthings find device first, you can know how to set up your project in smartthings using the developer workspace next, you can learn how to build your firmware with smartthings find device sdk lastly, you can know how to check the functionalities of your device's rf performance using the tag toolbox app set up your environment notefor sdc24 attendees, skip this step as it’s already done for you you will need the following host pc running on windows 11 visual studio code as the ide smartthings find device sdk code smartthings find tag toolbox smartthings app toolchain for nrf52833 dk use the ncs nrf connect sdk version 2 6 1 nrf52833 dk with buzzer module and nfc antenna galaxy smarttag2 register and deploy to test your device using the smartthings developer workspace, you can create a device profile, customize the instructions for onboarding the device on the smartthings app, and test the devices by deploying them you can edit the configurations until you submit the device for publication in the smartthings ecosystem sign in to smartthings developers go to smartthings developer workspace and sign in using your samsung account select a project and add a device profile select stfind codelab example and check its device profile under the device profile, specify whether the device operates on ble ble and uwb afterward, you can customize your device's onboarding experience in smartthings by uploading your product images, user instructions, and brand name under device onboarding lastly, you can fill in basic product information in the product info deploy your device to test after you complete all of these, you can go back to the overview tab and press deploy to test you can download the tagonboardingconfig h file which includes your project configuration the sdk code needs this configuration file register your devices you can add the identity of your device in the smartthings cloud for authentication this requires device information like serial number and device public key ed25519 when you reach the maximum number of test devices per user, remove the existing ones this example shows how to create an ed25519 key pair with sdk tools in visual studio code, press the tagkeygen button at the bottom afterward, you can generate the serial number, private key, and public key register it to the smartthings cloud using the smartthings developer workspace and include it in your firmware after checking the created information on visual studio code go to the developer workspace go to test > test devices menu, and click register new device input the generated serial number and public key build the firmware with the sdk open visual studio code and build the firmware for your device open the sdk project in the file explorer of visual studio code, you can find four code lab files here when you click the nrf connect icon, it shows important functions such as build, flash, and serial log check the configuration files ensure that two essential configuration files are applied tagonboardingconfig h tagdeviceinfo h write your code in main c, complete the code to call the taginit and tagstart apis of device sdk you can find code_mission in the source code and follow the instructions in the code by simply removing the comments #include <zephyr/zephyr h> #include <zephyr/sys/printk h> #include "tagsdk h" #include "mbedtls/aes h" static void init_aes_table void { mbedtls_aes_context dump_ctx; unsigned char dump_key[16]; mbedtls_aes_setkey_enc &dump_ctx, dump_key, 128 ; } void main void { int err = 0xff; tagresult_t result = tag_result_not_supported; /** * code_mission * you will check this serial log later in this codelab */ printk "tag demo! %s-%s-%s\n", config_board, __date__,__time__ ; init_aes_table ; /** * code_mission * call taginit api by removing comment // * * by calling this api, tag sdk will load nv, set rtc and * initialize crypto, and so on * you shall initialize bsp before call this api * services and starts ble advertising */ // result = taginit ; if result != tag_result_success { printk "failed to init %d\n", result ; return; } err = bt_enable 0 ; if err { printk "failed to init bt %d\n", err ; return; } /** * code_mission * call tagstart api by removing comment // * * by calling this api, tag sdk will initialize ble gatt * db and services and starts ble advertising * you shall initialize ble stack before call this api */ // result = tagstart ; if result != tag_result_success { printk "failed to start maintask %d\n", result ; return; } } in portnfc c, call the seturl function you can find code_mission in the source code and follow the instructions in the code by simply removing the comments tagerror_t portnfcseturl char *url, size_t urllen { tagerror_t ret = tag_error_none; ret = disablenfc ; if ret != tag_error_none { tag_log_e "failed to disable nfc" ; return ret; } /** * code_mission * remove comment // below to call seturl function */ // ret = seturl url, urllen ; if ret != tag_error_none { tag_log_e "failed to set url message" ; return ret; } ret = enablenfc ; if ret != tag_error_none { tag_log_e "failed to enable nfc" ; return ret; } return tag_error_none; } build go to nrf connect > actions click on build noteit may take some time for the build to finish you can see the progress by checking the popup at the bottom-right corner of the ide you can also select nrf connect build in the terminal to check the detailed status flash connect the nrf52833 dk to your computer go to nrf connect > actions click on flash once completed, you can hear a notification sound from your device check the serial log of your device go to nrf connect > connected devices click the plug icon on the right side of vcom0 comxx at the top of the ide, select the first item in the list under connected devices press the reset button briefly on your device by checking the timestamp from the serial log, you can verify whether your device successfully downloaded the firmware onboard and control your device via smartthings app onboard your device launch the smartthings app tap the + icon at the top right of the screen click on add device select add in the partner devices section select my testing devices then, select stfind codelab example to start onboarding allow the use of location information and press agree verify your device by pressing the button on the board in the success! page, tap on done to finish onboarding your device locate and ring your device tap on view map to show the location of your device select ring and your device produces a sound through its buzzer module you may switch to either high-volume or low-volume ringing press stop to stop the ringing configure the lost mode of your device when lost mode is activated, it allows you to view a lost message showing the owner's contact information and any personalized messages in the smartthings app, tap on view map > more > lost mode in the lost mode page, select next add email, contact, and message information then, tap on turn on test it by placing an nfc device or a mobile device at the nfc antenna of your device a lost message should show on your mobile device test the device's rf performance via tag toolbox smartthings find tag toolbox allows you to measure the rf performance of a ble device and log the results create a new test item launch the tag toolbox app on a mobile device tap on ble performance > add new test to create a new test item select a target device and a reference device to compare rf performance a target device this is your device created through this code lab b reference device this is the smarttag2 as a comparison target conduct rf performance tests press start session and check your device's rf performance once completed, tap on take a picture and capture how far away the mobile device is from both your device and the smarttag2 tap on test result to find out your device's rf performance export test result test reports can be exported as a file either during the test or after completing the test check your device's rf performance in the list of session menu a min rssi minimum value of your device's rf signal b max rssi maximum value of your device's rf signal c packet detection rate if the advertising transmission interval is two seconds, it indicates how many packets were detected during the test duration press export test result and it shows the location of the file on your mobile device you're done! congratulations! you have successfully achieved the goal of this code lab topic now, you can develop your own smartthings find-compatible devices to form a partnership, contact partners@smartthings com
Learn Code Lab
codelabtest edge drivers using smartthings test suite objective learn how to identify and resolve issues when deploying edge drivers using smartthings test suite overview smartthings test suite is a tool for testing iot device integrations within the smartthings platform this solution provides a seamless certification process, allowing developers of smartthings hub connected devices to submit their products for certification without the need for manual testing this accelerates the certification timeline and offers a more cost-effective path to certifying these devices the key feature of this self-testing tool is it contains an automated testing suite that covers critical certification criteria, ranging from functionality to performance tests the tool also provides real-time feedback that gives detailed information on the device's compliance status, allowing for quick identification and resolution of any issues lastly, it has an intuitive and user-friendly interface that ensures a seamless experience for developers of all levels set up your environment notefor sdc24 attendees, skip this step as it’s already done for you you will need the following host pc running on windows 10 or higher or ubuntu 20 04 x64 visual studio code latest version recommended devices connected on the same network android mobile device with smartthings app installed with android 10 or higher smartthings station or smartthings hub onboarded with samsung account smartthings v4 multipurpose sensor or lightify tunable white 60 light bulb notemake sure that your devices are connected to your smartthings app sample code here is a sample code for this code lab download it and start your learning experience! test suite sample code 185 4 kb install smartthings cli you need to install smartthings cli as this is the main tool for developing apps and drivers for smartthings edge drivers to install smartthings cli, open a web browser and download the smartthings msi installer from the latest release notefor other operating systems, download the appropriate zipped binary and install it on your system path open the smartthings cli setup in the downloaded file, then click next accept the license agreement terms, then click next select the destination path for installation and click next to begin the installation process, click install notethe windows installer may display a warning titled windows protected your pc to continue the installation, click more info > run anyway complete the setup by clicking finish to verify if smartthings cli is installed correctly, open the command prompt and run this command smartthings --version view and run available commands for smartthings cli with this command smartthings --help for a full list of commands, visit the smartthings cli commands notethe smartthings cli supports an automatic login flow that launches a browser window, prompting the user to log in with samsung account and grant the cli permissions to access the user's account start your project after downloading and extracting the sample code containing the project files, click file > open folder in visual studio code to open it locate the sample code file directory and click select folder once finished, the project files are seen on the explorer menu configure custom edge drivers open your command prompt or terminal and follow the corresponding instructions depending on your device availability make sure that the path directory in your cli contains the project file smartthings multipurpose sensor in the terminal, type the following command to build and upload your edge driver package to the smartthings cloud smartthings edge drivers package drivers/codelab-zigbee-contact create a new channel for your edge driver and enter the following channel details smartthings edge channels create channel name smartthings test suite demo channel description channel for sdc2024 channel terms of service url www smartthings com enroll your hub in your newly created channel and select the corresponding channel and hub smartthings edge channels enroll assign your driver to the created channel smartthings edge channels assign install the created edge driver from your channel to your own hub smartthings edge drivers install confirm that the correct version of the driver is present in your hub smartthings edge drivers installed select the edge driver for this device smartthings edge drivers switch lightify tunable white 60 bulb in the terminal, type the following command to build and upload your edge driver package to the smartthings cloud smartthings edge drivers package drivers/codelab-zigbee-switch create a new channel for your edge driver and enter the following channel details smartthings edge channels create channel name smartthings test suite demo channel description channel for sdc2024 channel terms of service url www smartthings com enroll your hub in your newly created channel and select the corresponding channel and hub smartthings edge channels enroll assign your driver to the created channel smartthings edge channels assign install the created edge driver from your channel to your own hub smartthings edge drivers install confirm that the correct version of the driver is present in your hub smartthings edge drivers installed select the edge driver for this device smartthings edge drivers switch test your device on your web browser, go to smartthings test suite, login to your samsung account and follow the corresponding instructions depending on your device availability smartthings multipurpose sensor on the test suite, look for your device, click menu icon > prepare new test under the compatible capabilities, select all capabilities except for battery, and click start during the test execution, perform the indicated user actions for every test case if there are any it might cause incorrect test results if user actions are not performed tipyou may view the real-time sensor states of the device in the smartthings mobile app view the test summary after the test it returns a failed test that you are going to resolve in the next step lightify tunable 60 white bulb on the test suite, look for your device, click menu icon > prepare new test under the compatible capabilities, select all capabilities after you've selected the capabilities, click start warningduring the test execution, observe the behavior of the bulb it might cause incorrect test results if automated tests are interrupted view the test summary after the test it returns a failed test that you are going to resolve in the next step resolve test failures smartthings multipurpose sensor the test logs contain basic information about the test results and specific test cases, providing technical context to users for efficient troubleshooting download the test logs by navigating to the bottom page of the test summary > show full test details > download log to understand the test logs, its structure follows this schema {execution timestamp} device node path node type [node state] {execution message} in the downloaded test log, two test cases failed with the following error [failed] initialize states following states were not set correctly [contact any other state than "open" on main contactsensor] [failed] send command and validate some events didn't happen [contact "closed" on main contactsensor] some states aren't final [contact "closed" on main contactsensor] in the first error log, it appears that the test suite cannot change the device's state to anything other than an open state in the second error log, the test suite tries to change its state to closed, but to no avail it is confirmed in the capability definition that the contact sensor has only two states open and closed therefore, the device is constantly in an open state and unable to change to a closed state with these information, you can start troubleshooting by going to drivers > codelab-zigbee-contact > multi-sensor > init lua and look for incorrect code implementation with these keywords open, closed, contactsensor it can be seen in the zone_status_change_handler and zone_status_handler functions that there are code blocks on comment this might be a result of someone developing this code have changed this part of code for debugging and forgot to uncomment this part uncomment this code block from zone_status_change_handler function if not device preferences["certifiedpreferences garagesensor"] then contactsensor_defaults ias_zone_status_change_handler driver, device, zb_rx end uncomment this code block from zone_status_handler function if not device preferences["certifiedpreferences garagesensor"] then contactsensor_defaults ias_zone_status_attr_handler driver, device, zone_status, zb_rx end remove this line of code from zone_status_change_handler and zone_status_handler functions device emit_event_for_endpoint zb_rx address_header src_endpoint_value, capabilities contactsensor contact open save the file and update the driver by invoking the same cli commands that were also used during the configuration of custom edge drivers smartthings edge drivers package drivers/codelab-zigbee-contact smartthings edge channels assign smartthings edge drivers install again, go to smartthings test suite, select your device, click menu > prepare new test ensure that all compatible capabilities are selected, with the exception for battery again, start the test and perform indicated user actions for every test case if there are any now, all tests are passed! lightify tunable white 60 bulb the test logs contain basic information about the test results and specific test cases, providing technical context to users for efficient troubleshooting download the test logs by navigating to the bottom page of the test summary > show full test details > download log to understand the test logs, its structure follows this schema {execution timestamp} device node path node type [node state] {execution message} in the downloaded test log, one test case failed with the following error [failed] send command and validate some events didn't happen [colortemperature maximum 7500k on main colortemperature] some states aren't final [colortemperature maximum 7500k on main colortemperature] in the error log, it directs to an issue for setting an incorrect maximum colortemperature value the configuration on your edge driver is set to 7500k you can start to troubleshoot by looking for the bulb's color temperature rating either from the device packaging or the device manufacturer website with these information, you can start troubleshooting by going to drivers > codelab-zigbee-switch > profiles > rgbw-bulb yml and look for lines that declares the colortemperature value change the colortemperature range declaration range [ 2700, 6500 ] save the file and update the driver by invoking the same cli commands that were also used during the configuration of custom edge drivers smartthings edge drivers package drivers/codelab-zigbee-switch smartthings edge channels assign smartthings edge drivers install again, go to smartthings test suite, select your device, click menu > prepare new test under the compatible capabilities, select all capabilities again, start the test and perform indicated user actions for every test case if there are any now, all tests are passed! you're done! congratulations! you have successfully achieved the goal of this code lab now, you can test your edge driver for smartthings devices using smartthings test suite! to learn more about smartthings test suite, visit smartthings edge architecture smartthings developer console
Learn Code Lab
codelabverify your id with samsung wallet objective learn how to verify a user's identity with the id information registered in their samsung wallet app partnership request to create, manage, and monitor performance of wallet cards with the samsung wallet partners site, you must become an official samsung partner once done, you can fully utilize this code lab you can learn more by visiting samsung wallet partner onboarding process, here in samsung developers notein accordance with the applicable samsung wallet partners agreements, this code lab covers the setup and use of the verify with samsung wallet service for purposes of integrating samsung wallet with partner sites and apps the use cases and corresponding code samples included are representative examples only and should not be considered as either recommended or required overview verify with samsung wallet enables users to utilize the digital id added to their wallets to simplify online transactions that require an identity verification a mobile device with samsung wallet installed is required to verify the user’s identity through this feature this feature uses the relying party card type to verify a user's identity using the id information stored in samsung wallet this feature supports app-to-app app2app and web-to-app web2app integration models the web2app integration supports the partner's mobile web application to request a verification to the samsung wallet app the app2app integration supports the partner’s mobile application to request a verification to the samsung wallet app when the partner site requests the user to verify their identity, the verify with samsung wallet button is displayed the user is redirected to the samsung wallet app where they verify their identity via pin or biometrics once verified, the user's identity information is sent to the partner and the transaction will proceed noteas of 2024, this feature is only available in the united states and can be used by the state government with mobile driver's license mdl support for more information, visit https //developer samsung com/dashboard/support for detailed description, see verify with samsung wallet set up your environment notefor sdc24 attendees, skip this step as it's already done for you proceed to 7 create a verify with samsung wallet button for app2app integration or 9 test the verify with samsung wallet button for web2app integration you will need the following access to samsung wallet partners site samsung galaxy device that supports samsung wallet app samsung wallet app latest version android studio latest version recommended java se development kit jdk 11 or later supported mobile driver's license be added to samsung wallet app internet browser, such as google chrome openssl intellij idea or any java ide optional sample code here is a sample code for you to start coding in this code lab download it and start your learning experience! verify with wallet sample code for app2app integration 802 3 kb start the onboarding process partners can manage wallet cards and monitor performance with the samsung wallet partners site to join as partner generate a private key and certificate signing request csr using the openssl command you can follow the instructions in security factors notea private key enables encryption and is the most important component of certificates while csr, which is a necessary factor to obtain a signed certificate, includes the public key and additional information like organization and country proceed to register in the samsung wallet partners site using your samsung account follow the samsung wallet partner onboarding process upload the generated csr for data encryption in encryption setting management section after registration, you will receive a welcome email noteupon receiving the certificates via email, be sure to keep the information safe from exposure and only use them for the following purposes signed certificate used along with the private key to sign data samsung certificate used to encrypt card data and validate authentication tokens in server api headers create a relying party wallet card follow the steps below to create a wallet card in samsung wallet partners site go to wallet cards > manage wallet card and click add wallet card in wallet card template field, choose [wallet] relying party as wallet card type and relyingparty > others as sub type select the design type and click done in wallet card custom setting, click change, and choose drivers as authentication issuer you can also select specific mdls such as below notethe authentication issuer is a unique property of the relying party card type the identity provider of the authentication issuer is supported depending on the service location set for example, if the service location is in the united states, the authentication issuer field only supports any identity provider in the united states region in main headquarters location, select united states once finished, select save to view all registered information launch wallet cards you can launch and request activation of the cards by clicking the launch button upon agreeing to proceed, the launch button text changes to launched and the card status becomes verifying create a verify with samsung wallet button app2app for the app2app integration, you need to setup the button inside the mobile application in android studio, click open locate the downloaded android project rpclient_codelab from the directory and click ok go to app > kotlin+java > com samsung android sample rpclient > presentation > partners and, in the partnersrequestfragment kt file, add the verify with samsung wallet button inside the oncreateview function glide with this load partner getverifybuttonimage into binding verifybutton set up a click listener for the verifybutton binding verifybutton setonclicklistener { /// add the requestdata variable to prepare the request fields /// add the applink variables to request the card information /// call the applink method to request verification } inside the listener, add the requestdata variable to prepare the request fields for verification val requestdata = demodata requestdata add the applink variables to request the card information val applink = rpclientapis buildapplink partnerid = partner getpartnerid , cardid = partner getcardid , payload = partner buildapp2apppayload , samsungpublickey = partner getsamsungpublickey , partnerpublickey = partner getpartnerpublickey , partnerprivatekey = partner getpartnerprivatekey , isstagingserver = true the data being requested are as follows partnerid = gets the partner id from the identification card used cardid = gets the card id from the identification card used payload = builds the app2app payload samsungpublickey = gets the samsung public key partnerpublickey = gets the partner's public key partnerprivatekey = gets the partner's private key isstagingserver = checks if the application runs on a staging environment noterequested data such as partnerid, public keys, and private keys are generated during the onboarding process, while cardid is generated when you create a wallet card however, in this code lab, these data is already predefined and included in the sample mobile app call the applink method to request verification this method creates a channel between the test app and samsung wallet app to create the request and response data for the verification process applink? let { log i tag, applink rpclientapis request "com samsung android spay", uuid randomuuid tostring , applink, object rpclientapis onresponselistener { override fun ongetmdocrequestdata deviceengagementbytes bytearray bytearray? { log i tag, "deviceengagementbytes=${deviceengagementbytes tohex }" val keypair = securerepository generateeckeypair log i tag, "requestdata=$requestdata" val encryptedsessionestablishmentbytes = securerepository buildsessionestablishment requestdata, deviceengagementbytes, keypair log i tag, "encryptedsessionestablishmentbytes=${encryptedsessionestablishmentbytes? tohex }" return encryptedsessionestablishmentbytes } override fun onmdocresponse encryptedresponsebytes bytearray { log i tag, "encryptedresponsebytes=${encryptedresponsebytes tohex }" try { val plainresponse = securerepository decryptmdocresponse encryptedresponsebytes log i tag, "plainresponse=${plainresponse? toprettyjson }" val responsedata = plainresponse? toprettyjson onresponse postvalue responsedata } catch e exception { e printstacktrace } } override fun onmdocresponsefailed exception exception { log i tag, "onmdocresponsefailed ${exception} " onerror postvalue exception } } } run and test the application app2app go to build > build app bundle s / apk s > build apk s to build the application install the apk file to your mobile device and test the sample app as follows open the sample app and choose sdc code lab press the verify with samsung wallet button once you are redirected to the samsung wallet app, press the verify button the samsung wallet app shows a checkmark to indicate that the identity has already been verified while the sample app displays a verification success screen test the verify with samsung wallet button web2app for the web2app integration, you can use the test tool to test the verify with samsung wallet button open a web browser on your computer or galaxy mobile device and go to the following link partner walletsvc samsung com/addtowallettest go to verify with wallet tab and click choose key file to upload your private key in the select card dropdown menu, select the card you created to display its details navigate to the form tab and modify the data as desired you can change the logo image or provider name press the verify with samsung wallet button once you are redirected to samsung wallet, press the verify button the samsung wallet app shows a checkmark to indicate that the identity has already been verified go back to the test tool, open the mdoc tab, and click the check result button it displays a result success popup when the verification process is successful tokenize card data and implement the verify with wallet button to your service optional notethis step is optional, but if you want to learn how to integrate the verify with wallet button into your services like an android app, web app, or email, you can follow these steps the samsung wallet partners site provides generated verify with samsung wallet scripts for each wallet card you create you can simply copy and paste these scripts into your partner apps web and android or include them in emails/mms messages to implement the verify with wallet button, follow these steps go to the [verify with wallet script guide] section of the card you created click show to view the available scripts and then copy the appropriate script for your service develop a program that can generate tokenized card data cdata the cdata represents the actual content of the wallet card and comes in different formats depending on the card type you can check the cdata generation sample code for reference the cdata is derived from the card data, which is in json format for testing purposes, you can utilize the generated json from the test tool follow the implementing button guide to determine where to incorporate the generated cdata and gain further insights into this process you are redirected back to your app and your identity is verified you're done! congratulations! you have successfully accomplished the topic of this code lab now, you are ready to verify your id with the verify with samsung wallet button into your application on your own! to learn more about samsung wallet, visit developer samsung com/wallet
Learn Code Lab
codelabintegrate samsung pay sdk flutter plugin into merchant apps for in-app payment objective learn how to integrate in-app payment with your flutter-based merchant apps using samsung pay sdk flutter plugin partnership request to use the samsung pay sdk flutter plugin, you must become an official samsung partner once done, you can fully utilize this code lab you can learn more about the partnership process by visiting samsung pay in samsung developers overview the samsung pay sdk flutter plugin allows developers to use samsung wallet features in flutter applications it is the wrapper of samsung pay sdk, which is an application framework for integrating samsung wallet features on galaxy devices the samsung pay sdk flutter plugin offers in-app payment feature that gives customers the opportunity to pay for products and services with samsung wallet set up your environment notefor sdc24 attendees, skip this step as it’s already done for you you will need the following samsung wallet app version 5 6 53, 5 8 0 samsung pay sdk flutter plugin android studio latest version recommended java se development kit jdk 11 or later flutter sdk a compatible galaxy device with android q 10 0 or android api level 29 or later android os versions noteflutter sdk must be installed and set up properly when developing flutter applications after downloading, follow the installation guide appropriate to your operating system after proper installation and setup, configure your android studio to include the flutter plugin for intellij check this editor guide for the detailed steps sample code here is a sample code for you to start coding in this code lab download it and start your learning experience! in-app payment flutter plugin sample code 20 4 mb start your project in android studio, click open to open an existing project locate the flutterinapppayment project from the directory, and click ok go to file > settings > languages & frameworks > flutter to change the flutter sdk path input the directory path where your flutter sdk is installed and click apply install the plugin and configure the api level add samsungpaysdkflutter_v1 01 00 folder in the project go to samsungpaysdkflutter_v1 01 00 > pubspec yaml file and click on pub get in right side of the action ribbon or run flutter pub get in the command line next, go to flutterinapppayment > pubspec yaml and add the samsungpaysdkflutter_v1 01 00 plugin under dependencies samsung_pay_sdk_flutter path /samsungpaysdkflutter_v1 01 00 warningbe careful of line alignment of pubspec yaml file, as the indentations indicate the structure and hierarchy of the data from the terminal, run flutter pub get command or click on pub get in the right side of the action ribbon configure the api level samsung pay sdk flutter plugin supports samsung pay sdk version 2 18 or later hence, we must set a valid api version latest version 2 19 of samsung pay sdk go to android > app > src > main > androidmanifest xml and add the api level in the meta-data of application tag <meta-data android name="spay_sdk_api_level" android value="2 19" /> // most recent sdk version is recommended to leverage the latest apis add the samsung pay button go to the main project, flutterinapppayment project > lib > main dart here, the ui is created using the build widget this widget shows the sample item information such as image, name, and price add a bottomnavigationbar before the end of the body of scaffold to display the samsung pay button bottomnavigationbar visibility visible isspaystatusready, child inkwell ontap { requestpaymentwithsamsungwallet ; }, child image asset 'assets/pay_rectangular_full_screen_black png' , , , check samsung pay status in main dart > myhomepage class, create an instance of samsungpaysdkflutter with valid partnerinfo service id and service type during onboarding, the samsung pay developers site assigns the service id and service type these data are used for partner verification static final samsungpaysdkflutterplugin = samsungpaysdkflutter partnerinfo serviceid service_id, data {spaysdk partner_service_type servicetype inapp_payment name} ; notethe service id is already provided in the sample code for this code lab however, this service id is for test purposes only and cannot be used for an actual application or service to change the service id in your actual application, the value of the variable service_id should be modified to check whether samsung pay is supported on your galaxy device, call the getsamsungpaystatus api and change the samsung pay button visibility accordingly in checksamsungpaystatus method, apply the following code void checksamsungpaystatus { //update ui according to samsung pay status myhomepage samsungpaysdkflutterplugin getsamsungpaystatus statuslistener onsuccess status, bundle async { if status == "2" { setstate { isspaystatusready = true; } ; } else { setstate { isspaystatusready = false; } ; _showtoast context,"spay status not ready" ; } }, onfail errorcode, bundle { setstate { isspaystatusready = false; } ; _showtoast context,"spay status api call failed" ; } ; } inside initstate method, call checksamsungpaystatus to ensure that getsamsungpaystatus api is called before any other api is called checksamsungpaystatus ; notethe getsamsungpaystatus api must be called before using any other feature in the samsung pay sdk flutter plugin create a custom payment sheet samsung pay sdk flutter plugin offers a custom type payment sheet called customsheet to customize the ui with additional payment related data here, create customsheet using the following controls amountboxcontrol it is a mandatory control to build a customsheet it provides the monetary details of the transaction addresscontrol it is used to display the billing and shipping address in makeamountcontrol method, add items and total price to build amountboxcontrol amountboxcontrol additem strings product_item_id, "item", 1199 00, "" ; amountboxcontrol additem strings product_tax_id, "tax", 5 0, "" ; amountboxcontrol additem strings product_shipping_id, "shipping", 1 0, "" ; amountboxcontrol setamounttotal 1205 00, spaysdk format_total_price_only ; in makebillingaddress method, add the following code to create billingaddresscontrol set sheetitemtype as zip_only_address while creating billingaddresscontrol to get the zip code as we are expecting to get the user's billing address from samsung wallet, set sheetupdatedlistener addresscontrol billingaddresscontrol = addresscontrol strings billing_address_id, sheetitemtype zip_only_address name ; billingaddresscontrol setaddresstitle strings billing_address ; billingaddresscontrol sheetupdatedlistener = billinglistener; return billingaddresscontrol; notefrom samsung pay sdk version 2 19 onwards, users can only add zip code as their billing address only the zip code is fetched from the user's samsung wallet instead of the full billing address implement this listener in makeupcustomsheet method to update the custom sheet when the user updates their billing address sheetupdatedlistener sheetupdatedlistener = sheetupdatedlistener onresult string controlid, customsheet sheet { if controlid == strings billing_address_id { var addresscontrol = sheet getsheetcontrol controlid as addresscontrol; setstate { postalcode = addresscontrol address! postalcode; } ; } myhomepage samsungpaysdkflutterplugin updatesheet sheet ; } ; create the shipping address in buildshippingaddressinfo method to add it in shipping addresscontrol this is the shipping address from the merchant app maddress = address addressee "jane smith", addressline1 "123 main st", addressline2 "suite 456", city "anytown", state "st", countrycode "usa", postalcode "12345", phonenumber "+1 555-123-4567", email "example@email com" ; add this address in makeshippingaddress method shippingaddresscontrol address = buildshippingaddressinfo ; finally, complete the makeupcustomsheet method by adding amountboxcontrol, billingaddresscontrol, and shippingaddresscontrol customsheet addcontrol makeamountcontrol ; customsheet addcontrol makebillingaddress sheetupdatedlistener ; customsheet addcontrol makeshippingaddress ; create a transaction request to start the payment process, the merchant app should create a transaction request with payment information in maketransactiondetailswithsheet method, add the merchant name and custom sheet in customsheetpaymentinfo customsheetpaymentinfo customsheetpaymentinfo = customsheetpaymentinfo merchantname "in app payment flutter app", customsheet makeupcustomsheet ; your merchant app must fill the following mandatory fields in customsheetpaymentinfo customsheetpaymentinfo merchantid = "123456"; customsheetpaymentinfo setordernumber "amz007mar" ; customsheetpaymentinfo setmerchantcountrycode "us" ; customsheetpaymentinfo addressinpaymentsheet = addressinpaymentsheet need_billing_send_shipping; request payment with a custom payment sheet the startinapppaywithcustomsheet api is called to request payment using a custom payment sheet in samsung pay this api requires customsheetpaymentinfo and customsheettransactioninfolistener first, implement this listener before starting the payment customsheettransactioninfolistener transactionlistener { customsheettransactioninfolistener customsheettransactioninfolistener = customsheettransactioninfolistener oncardinfoupdated paymentcardinfo paymentcardinfo, customsheet customsheet { myhomepage samsungpaysdkflutterplugin updatesheet customsheet ; }, onsuccess customsheetpaymentinfo customsheetpaymentinfo, string paymentcredential, map<string, dynamic>? extrapaymentdata { print "payment success" ; }, onfail string errorcode, map<string, dynamic> bundle { print "payment failed" ; } ; return customsheettransactioninfolistener; } lastly, call startinapppaywithcustomsheet api to start the payment in the requestpaymentwithsamsungwallet method void requestpaymentwithsamsungwallet { myhomepage samsungpaysdkflutterplugin startinapppaywithcustomsheet maketransactiondetailswithsheet , transactionlistener ; } run the app build the app by running flutter build apk --debug in the command line or going to build > flutter > build apk deploy the app on the device test it by clicking on samsung pay button to proceed with the payment transaction to thoroughly test the sample app, you must add at least one payment card to the samsung wallet app you're done! congratulations! you have successfully achieved the goal of this code lab now, you can integrate in-app payment with your flutter app by yourself! to learn more about developing apps for samsung pay devices, visit developer samsung com/pay
Learn Code Lab
codelabintegrate samsung pay web checkout with merchant sites objective learn how to integrate the samsung pay payment system into your merchant sites using the samsung pay web checkout sdk partnership request to use the samsung pay web checkout sdk, you must become an official samsung pay partner once done, you can fully utilize this code lab you can learn more about the partnership process by visiting the samsung pay page here in samsung developers notein accordance with the applicable samsung pay partners agreements, this code lab covers the setup and use of the samsung pay web checkout sdk for purposes of integrating samsung pay with merchant sites the use cases and corresponding code samples included are representative examples only and should not be considered as either recommended or required overview the samsung pay web checkout service enables users to pay for purchases on your website with payment cards saved in the samsung wallet app on their mobile device it supports browser-based payments on both computers and mobile devices a mobile device with samsung wallet installed is required to make purchases through samsung pay web checkout when the user chooses to pay with samsung pay, they must provide their samsung account id email id or scan the qr code on the screen with their mobile device the user then authorizes the purchase within the samsung wallet application, which generates the payment credential on the device and transmits it to your website through the web checkout for more information, see samsung pay web checkout set up your environment notefor sdc24 attendees, skip this step as it’s already done for you proceed to 5 include the samsung pay web checkout javascript sdk you will need the following access to samsung pay developers site samsung wallet test app from samsung pay developers site samsung galaxy device that supports samsung wallet app internet browser, such as google chrome codesandbox account notein this code lab, you can use the samsung wallet test app to try the functionality of the samsung pay web checkout service in a staging environment you can use the official samsung wallet app from the galaxy store once your service is in the production environment start your project and register your service in your browser, open the link below to access the project file of the sample merchant site https //codesandbox io/s/virtual-store-sample-fnydk5 click the fork button to create an editable copy of the project next, follow the steps below to register your sample merchant site in the samsung pay developers site go to my projects > service management click create new service select web online payment as your service type enter your service name and select your service country select your payment gateway from the list of supported payment gateways pg if your pg uses the network token mode, upload the certificate signing request csr or privacy enhanced mail pem file you obtained from your pg contact your pg for details enter the payment domain name s for your website in the service domain field and click add for example, if your domain is mywebstore com, but the checkout page is hosted on the subdomain payments mywebstore com, you will need to enter payments mywebstore com as the service domain for each additional domain url, click add in this code lab, the generated preview url of the forked project is your service domain click the name of the newly created service to see its details, such as the generated service id that you can use for all the registered service domains include the samsung pay web checkout javascript sdk the samsung pay web checkout sdk uses javascript to integrate the samsung pay payment system to your website this sdk allows users to purchase items via web browser in the <head> section of the index html file of the project, include the samsung pay web checkout javascript sdk file <script src="https //img mpay samsung com/gsmpi/sdk/samsungpay_web_sdk js"></script> initialize the samsung pay client to initiate payments using the samsung pay api, create a new instance of the paymentclient class and pass an argument specifying that the environment as stage write the code below in the <script> tag of the <body> section const samsungpayclient = new samsungpay paymentclient { environment "stage" } ; when the service is still in debug or test mode, you can only use the staging environment to test payment functionality without processing live transactions noteby default, the service is initially set to debug or test mode during creation to switch the service status to release mode, a request must be made through the samsung pay developers site after successfully transitioning to release mode, change the environment to production next, define the service id, security protocol, and card brands that the merchant can support as payment methods the service id is the unique id assigned to your service upon creation in the samsung pay developers site let paymentmethods = { version "2", serviceid "", //input your service id here protocol "protocol_3ds", allowedbrands ["visa", "mastercard"] }; check whether the samsung pay client is ready to pay using the given payment method call the createandaddbutton function if the response indicates that the client is ready samsungpayclient isreadytopay paymentmethods then function response { if response result { createandaddbutton ; } } catch function err { console error err ; } ; create and implement the samsung pay button go to the <body> section and, inside the page-container div, create a container for the samsung pay button <div align="center" id="samsungpay-container"></div> next, go back to the <script> tag and write the createandaddbutton function inside this function, generate the samsung pay button by calling the createbutton method ensure that the button appears on the page by appending it to the container you created function createandaddbutton { const samsungpaybutton = samsungpayclient createbutton { onclick onsamsungpaybuttonclicked, buttonstyle "black"} ; document getelementbyid "samsungpay-container" appendchild samsungpaybutton ; } function onsamsungpaybuttonclicked { // create the transaction information //launch the payment sheet } from the createandaddbutton function, call the onsamsungpaybuttonclicked function when the user clicks the generated button create the transaction information in the onsamsungpaybuttonclicked function, create the transactiondetail object for the user’s purchase input your service domain in the url key let transactiondetail = { ordernumber "sample0n1y123", merchant { name "virtual shop", url "", //input your service domain countrycode "us" }, amount { option "format_total_estimated_amount", currency "usd", total 2019 99 } }; below are the descriptions of the keys included in the transactiondetail object key type description ordernumber string order number of the transaction allowed characters [a-z][a-z][0-9,-] merchant object data structure containing the merchant information merchant name string merchant name merchant url string merchant domain url e g , samsung com the maximum length is 100 characters merchant countrycode string merchant country code e g , us for united states iso-3166-1 alpha-2 amount object data structure containing the payment amount amount option string display format for the total amount on the payment sheet format_total_estimated_amount = displays "total estimated amount " with the total amountformat_total_price_only = displays the total amount only amount currency string currency code e g , usd for us dollar the maximum length is 3 character amount total string total payment amount in the currency specified by amount currencythe amount must be an integer e g , 300 or in a format valid for the currency, such as 2 decimal places after a separator e g , 300 50 notefor the complete list of specifications for the transactiondetail object, see samsung pay web checkout api reference launch the payment sheet after creating the transaction information, call the loadpaymentsheet method to display the web checkout ui the user can either input their email address or scan the generated qr code a timer screen in the web checkout ui is displayed after the user input, while a payment sheet is launched in the user's samsung wallet app the payment sheet contains the payment card option s and the transaction details when the user confirms their payment on their mobile device, you will receive the paymentcredential object generated by the device then, inform the samsung server of the payment result using the notify method the paymentresult object contains the payment result information during transaction processing and after the payment is processed with the pg network notefor real transactions, you need to extract the payment credential information from the 3ds data key within the paymentcredential object and process it through your payment provider however, in this code lab, you only need to print the paymentcredential to the console samsungpayclient loadpaymentsheet paymentmethods, transactiondetail then function paymentcredential { console log "paymentcredential ", paymentcredential ; const paymentresult = { status "charged", provider "test pg" }; samsungpayclient notify paymentresult ; } catch function error { console log "error ", error ; } ; other possible values of the status key are charged - payment was charged successfully canceled - payment was canceled by either the user, merchant, or the acquiring bank rejected - payment was rejected by the acquiring bank erred - an error occurred during the payment process test the samsung pay button after integrating the samsung pay web checkout service into your sample merchant site, follow the steps below to test the functionality of the integrated service open your sample merchant site in a new tab then, click the pay with samsung pay button in the web checkout ui, enter the email address of your samsung account to send a payment request to samsung pay tap the push notification sent to the samsung wallet app installed on your mobile device then, click accept when the payment sheet is loaded, tap on pin and enter your pin to proceed a verified message will display in both the samsung wallet app and web checkout ui to indicate that the payment was processed successfully you're done! congratulations! you have successfully achieved the goal of this code lab topic now, you can integrate the samsung pay web checkout service into your website by yourself to learn more about developing apps for samsung pay devices, visit developer samsung com/pay
Learn Code Lab
codelabcreate an android automotive operating system aaos app with payments via samsung checkout objective create a shopping app for android automotive os aaos , which uses templates from aaos and ignite store, and processes payments via the ignite payment sdk powered by samsung checkout partnership request to use the ignite payment sdk and have access to development tools and resources, such as ignite aaos emulators, you must become an official partner once done, you can fully utilize this code lab you can learn more about the partnership process by visiting the ignite store developer portal overview android automotive os android automotive os aaos is a base android platform that runs directly on the car and is deeply integrated with the underlying vehicle hardware unlike the android auto platform, users can download compatible apps with aaos directly into their cars, without needing a phone, and utilize an interface specifically designed for the car screen aaos can run both system and third-party android applications as aaos is not a fork and shares the same codebase as android for mobile devices, developers can easily adapt existing smartphone apps to function on aaos the diagram below illustrates the architecture of aaos at the hardware abstraction layer hal level, aaos incorporates additional components such as the vehicle hal vhal , exterior view system evs , and broadcast radio br to handle vehicle properties and connectivity at the framework level, car service and webview modules are included at the application level, the main system applications include car system ui, car launcher, and car input method editor ime additionally, car media and automotive host are incorporated as system apps third-party apps are classified into three categories audio media, car templated, and parked car templates the car templated apps use templates specified by the car app library, which are rendered by the automotive host, customized by original equipment manufacturers oem the library consists of approximately 10 templates list, grid, message, pane, navigation and is utilized in both android auto aa and android automotive os aaos apps to target aaos, you must incorporate an additional app-automotive library that injects the carappactivity into the app the carappactivity needs to be included in the manifest and can be set as distractionoptimized upon launching the application, the carappactivity provides a surface that is employed by the automotive host to render the template models additionally, on the harman ignite store, you can optionally integrate the ignite-car-app-lib, which adds supplementary templates such as explore, listdetails, routeoverview, and poistreaming harman ignite store the harman ignite store is a white-labeled and modular aaos-based automotive app store by connecting app developers with car manufacturers, harman creates unique in-vehicle experiences the ignite store has a rich app ecosystem with unique content, growth opportunities, and long-term partnerships it facilitates future-proof monetization with a payments api powered by samsung checkout after registering at the ignite store developer portal, developers can submit their apps for certification and testing by harman upon approval from the oem, the developer can proceed with publishing their app comprehensive developer documentation and tools are available to support app developers throughout the development process payments api the ignite store comes enabled with payment features empowering developers to monetize their apps developers are now able to offer their apps as paid apps the payment sdk exposes apis for goods and services, in-app purchases, and subscriptions developers can also integrate their own payment service providers psps , to sell goods or services, and receive the money directly in their bank account for a frictionless in-car payment experience, ignite provides a dedicated digital wallet app for end-users to securely store their credit card information the payment processor is powered by the industry proven samsung checkout the developer portal provides additional documentation to allow developers to access ignite aaos emulators, vim3, tablet or cuttlefish ignite images, and additional guidelines set up your environment notefor sdc24 attendees, skip this step as it's already done for you proceed to 5 check ignite payment sdk dependency you will need the following ignite aaos system image running on android emulator or on reference devices android studio latest version recommended java se development kit jdk 11 or later sample code here is a sample code for you to start coding in this code lab download it and start your learning experience! aaos ignite shopping app sample code 11 7 mb prepare your ignite aaos emulator add the ignite aaos emulator to your android studio by following the guide provided in the ignite store developer console open the device manager and start the emulator configure the emulator to use fake data for payments, as instructed in the ignite store developer console under the offline mode tab in the payment sdk section the sample app requires navigation from point a starting location to point b destination location the destination addresses are predefined and near san jose mcenery convention center to shorten the distance between two locations, follow the steps below to set the starting location a open the extended controls in the emulator panel b go to location, search for a location near the destination location, and click set location next, in the emulator, go to the ignite navigation app's settings and enable the following enable navigation simulation enable mock location provider go to settings > system > developer options > location and set ignite navigation as mock location app start your project after downloading the sample code containing the project files, open your android studio and click open to open an existing project locate the downloaded android project igniteautomotivepaymentssdc202488 from the directory and click ok check the ignite payment sdk dependency verify that the ignite payment sdk library is included in the dependencies section of the module's build gradle file dependencies { implementation files 'libs/ignite-payment-sdk-3 13 0 24030417-0-snapshot aar' } add payment permission next, go to the manifests folder and, in the androidmanifest xml file, include the payment_request permission to perform in-app purchases <uses-permission android name="com harman ignite permission payment_request" /> this ensures that the app has the necessary permissions to perform transactions and handle sensitive financial data show the payment screen when an item is added to the cart, the shopping cart screen displays the select store button, selected pickup store address, total amount to pay, and details of each item added the screen also includes the pay button go to kotlin + java > com harman ignite pickupstore > screens > shoppingcartscreen kt in the docheckout function, use the car app's screenmanager to navigate to the payment screen from the shopping cart screen after clicking the pay button getscreenmanager push paymentscreen carcontext, session notethe screenmanager class provides a screen stack you can use to push screens that can be popped automatically when the user selects a back button in the car screen or uses the hardware back button available in some cars instantiate the ignite payment client the ignite payment api provides a singleton class called ignitepaymentclientsingleton, which enables performing and tracking transactions navigate to the paymentscreen kt file and instantiate the ignite payment client private val mipc = ignitepaymentclientsingleton getinstance carcontext define the ignite payment transaction callback the ignite payment transaction provides three callback methods onsuccess, oncanceled, and onfailure after each callback, make sure to set the ispaymentfailed variable to track whether a payment is successful or not update the session which owns the shopping cart screen to reflect the status of the payment transaction call the updatetemplate function to invalidate the current template and create a new one with updated information private val mipctcb = object iignitepaymentclienttransactioncallback { override fun onsuccess requestuuid string?, sessionid string?, successmessage string?, paymentadditionalproperties hashmap<string, string>? { log d tag, log_prefix + "onsuccess rid $requestuuid, sid $sessionid, sm $successmessage" cartoast maketext carcontext, "payment successful", cartoast length_short show ispaymentfailed = false session paymentdone requestuuid, sessionid, successmessage updatetemplate } override fun oncanceled requestuuid string?, sessionid string? { log d tag, log_prefix + "oncanceled rid $requestuuid, sid $sessionid" cartoast maketext carcontext, "payment canceled", cartoast length_long show ispaymentfailed = true session paymenterror requestuuid, sessionid, null updatetemplate } override fun onfailure requestuuid string?, sessionid string?, wallererrorcode int, errormessage string { log d tag, log_prefix + "onfailure rid $requestuuid, sid $sessionid, wec $wallererrorcode, em $errormessage" cartoast maketext carcontext, "payment failed", cartoast length_long show ispaymentfailed = true session paymenterror requestuuid, sessionid, errormessage updatetemplate } } define the ignite payment client connection callback the ignite payment client needs to be connected in order to perform a payment request once the client connects successfully, retrieve the names of the shopping cart items and use them to create an order summary afterwards, construct an ignite payment request containing the total amount, currency code, merchant id, and details of the order summary then, initiate the payment process by invoking the readytopay function of the ignite payment client api private val mipccb = iignitepaymentclientconnectioncallback { connected -> log d tag, log_prefix + "onpaymentclientconnected $connected" if connected { val textsummary = session shoppingcart cartitems jointostring ", " { item -> item name } val ipr = ignitepaymentrequest builder setamount session shoppingcart gettotal * 100 setcurrencycode currencycode usd setpaymentoperation paymentoperation purchase setmerchantid constants merchant_id setordersummary ordersummary builder setordersummarybitmapimage bitmapfactory decoderesource carcontext resources, session shoppingcart store largeicon setordersummarylabel1 "${carcontext getstring r string pickupstore_app_title } ${session shoppingcart store title}" setordersummarysublabel1 session shoppingcart store address setordersummarylabel2 textsummary setordersummarysublabel2 carcontext getstring r string pickupstore_payment_sublabel2 build build try { mipc readytopay ipr, mipctcb } catch e exception { log d tag, log_prefix + "payment exception $e" e printstacktrace } catch e error { log d tag, log_prefix + "payment error $e" e printstacktrace } } } start the payment process and go back to previous screen after the transaction next, in the startpayment function, connect the ignite payment client and the connection callback to start the payment process mipc connect mipccb after the transaction is completed, the updatetemplate function refreshes the template used in the payment screen before calling the schedulegoback function modify the schedulegoback function to navigate back to the previous template screen shopping cart you can use the pop method of the screenmanager screenmanager pop start the navigation to the store to collect the paid pickup the shopping cart screen shows the pickup store location, details of the order, and go to store button after a successful payment go to kotlin + java > com harman ignite pickupstore > pickupstoresession kt modify the navigatetostore geofence geofence function to trigger the navigation to the pickup store when the go to store button is clicked you can use the intent carcontext action_navigate with geo schema rfc 5879 data, containing latitude and longitude e g , geo 12 345, 14 8767 to send the intent, use the carcontext startcarapp api call val geouristring = "geo ${geofence latitude},${geofence longitude}" val uri = uri parse geouristring val navintent = intent carcontext action_navigate, uri try { carcontext startcarapp navintent } catch e exception { log e tag, log_prefix + "navigatetostore exception starting navigation" e printstacktrace cartoast maketext carcontext, "failure starting navigation", cartoast length_short show } run the app on ignite aaos emulator run the pickup-store-app on ignite aaos emulator when the app starts for the first time, it requests for user permissions click grant permissions choose allow all the time for location permission and click the return button 4 browse the pickup store catalog and add items to shopping cart open the shopping cart and click pay you can also change the pickup store by clicking select store check the order summary and billing information then, click confirm and pay to process payment after a successful payment, the app returns to shopping cart screen with the updated transaction information click go to store to start the navigation to the store the app displays a notification when the car is near the store click the notification to show a reference qr code to present to the store upon pick up you're done! congratulations! you have successfully achieved the goal of this code lab topic now, you can create an aaos templated app, which supports payments by yourself! learn more by going to the developer console section of the ignite store developer portal
Learn Code Lab
codelabestablish a health research system using samsung health research stack objective learn how to create a health research system that collects data from mobile and wearable devices and visualizes the collected data in a web portal using samsung health research stack overview samsung health research stack is an open-source toolset that helps collect and analyze data from devices in android and wear os environments it provides tools and infrastructure for developing and deploying health studies, ranging from medical research to clinician services and more the framework consists of four components backend services - offers api endpoints to access and interact with a robust data engine web portal - a customizable interface for creating surveys, managing team members, tracking subjects, and analyzing data app sdk - an sdk for building android and wear os apps capable of collecting data from wearable devices starter app - a health research app with mobile and wearable versions created using basic features provided by the app sdk for detailed information, see samsung health research stack set up your environment notefor sdc24 attendees, skip this step as it's already done for you you will need the following android studio latest version recommended samsung galaxy mobile device with updated health connect app and samsung health app installed samsung galaxy watch synced to the mobile device docker desktop sample code to start your learning experience, download the project files of the samsung health research stack starter mobile and wearable app notedepending on your preferred development style, you can either download or clone the repository of the project files to your local computer feel free to edit and customize this project for your own purposes, including this code lab activity set up your galaxy mobile and watch device connect your galaxy mobile device to your pc and enable adb debugging next, connect your galaxy watch to android studio over wi-fi lastly, enable the developer mode of the health platform app on your watch by following these steps a go to settings b tap on apps c select health platform d quickly tap on health platform several times until [dev mode] appears notethe samsung health developer mode is only intended for testing or debugging your application it is not for application users deploy the backend and web portal locally download the backend-config-files zip file and unzip it the folder contains the docker-compose yaml file open the terminal window of docker desktop in the terminal, go to the directory where your docker-compose yaml file is located, and run the following command $ docker compose up –d the script deploys the backend and the web portal to your local computer, and it includes 6 services redis - redis watcher for the backend casbin service mongo - for saving data from the backend postgres - for supertokens database and the backend casbin database supertokens - for username and password authentication backend - backend for the samsung health research stack portal - web portal for the samsung health research stack you can change the port number, username, and password for each database with the default setting, you can access the web portal in your browser at localhost 80 the script file has simple settings for easy deployment to add more features, you can change the environment in the docker-compose yaml file's services > backend > environment part set the aws environment variables optional you can enable uploading and downloading features by setting the following aws environment variables aws_bucket_name aws_region aws_access_key_id aws_secret_access_key aws_session_token you can follow the instructions in using the default credential provider chain for setting up aws credentials set google openid connect optional to enable google openid connect oidc login, you can set the following environment variables oidc_google_oauth2_url default "https //oauth2 googleapis com" oidc_google_client_id oidc_google_client_secret oidc_google_redirect_uri you can refer to openid connect for more information about setting google oidc create a new study the health research system has two user groups investigators - conduct research studies and use the web portal for managing studies and analyzing data subjects - participate in studies by answering surveys and performing tasks through the mobile app, as well as collecting health data from wearable apps to start your research study, as an investigator, follow the steps below create an account and sign in to the web portal page you deployed fill out the form with your information on the study collection page, click the create study button noteall enrolled investigators can create a study the creator becomes the study admin in the basic info tab, input the details of the study 5 for the study scope, choose public noteyou can set the study scope as either public or private if you choose private, you need to input a participation code that subjects must enter into the mobile app to join however, for the ease of testing in this code lab, it is recommended to set the scope as public for the study requirements field, you can input any text and click next go to participation requirements tab and select the data types to collect in wear category for this code lab, choose wear accelerometer wear ecg wear heart rate the logo and title of the created study show on the study collection page connect the mobile app to backend system to connect the starter mobile app to the backend system, follow these steps noteto ensure that the galaxy mobile device can connect to the machine where the backend system is deployed, it is recommended to connect both the machine and the mobile device to the same network open the downloaded project file in android studio and go to samples > starter-mobile-app in the local properties file, set the server_address to the ip address of the machine where the backend system is deployed server_address ="input ip address here" tipyou can check your ip address using the command line windows in command prompt, type ipconfig and find the ip address under ipv4 address mac in terminal, type ifconfig and look for the ip address under inet next to en0 next, set the server_port to 50001 if you used the default values in the provided docker-compose yaml file for deployment if not, use the port number you set server_port=50001 set authentication method the app sdk supports three types of authentication methods for registration samsung utilizes samsung account cognito incorporates amazon cognito authentication super-tokens enables anonymous login to allow research participants to register and log in using their personal emails, set the sign_in_mode as super-tokens in the local properties file sign_in_mode="super-tokens" upload wearable data via grpc when synchronizing wearable device data, the app sdk offers two approaches utilizing grpc for high-performance remote procedure calls or synchronization through files each approach has advantages and disadvantages regarding factors such as battery life and server workload however, it is advisable to utilize grpc during local development to configure the mobile application to upload wearable data via grpc rather than files, add the following code in the local properties file enable_upload_wearble_data_by_file=false show the sync button in starter wearable app after configuring the mobile app, modify the wearable app to meet the requirements of your study go to samples > starter-wearable-app and open the local properties file the wearable app features a sync button, which can be displayed or hidden when this button is pressed, it synchronizes the collected data with the backend system instantly to show the sync button, set the value of enable_instant_sync_button as below enable_instant_sync_button=true notethis instant sync feature can negatively affect the battery consumption of both apps, so it is recommended to remove the sync button when you publish your app the samsung health research stack has an optimized data synchronization process that minimizes battery consumption set data measurement parameters you can customize the data collection and storage process of the wearable app by setting the values of the following data measurement parameters passive_data_insert_interval_in_seconds sets the data measurement buffer the buffer saves data in an in-memory database before the interval expires then, at regular intervals, the data from the buffer is stored in persistent memory data_split_interval_in_millis specifies the size of segmented data in persistent memory if these values are not specified, the wearable app uses its default values to verify that the data is being measured and synchronized instantly, you can set the values as follows passive_data_insert_interval_in_seconds=12 data_split_interval_in_millis=30000 run the starter mobile and wearable app after configuring the local properties of both starter apps, build and run your app in android studio by following these steps run the starter mobile app select your mobile app starter-mobile-app from the run configurations menu in the toolbar choose a connected galaxy mobile device as the target device for running the app click run to install the app after installation, clear the app's data run the starter mobile app follow the same steps as for the starter mobile app but select starter-wearable-app instead choose a connected galaxy watch device for running the app allow the app to access physical activity, sensor data, and send notifications when prompted ensure that the galaxy watch is connected with the galaxy mobile device register and join a study since you have set super-tokens as the authentication method, you can now register and log into the app at once open the starter mobile app and sign up with an unregistered email address after logging in and accepting permissions, the app displays the study you created from the web portal tap on the study card to view its details and click join study noteif a study is set to private and you wish to join it, press enter the study code located at the top of the screen and input the assigned participation code in the study code field agree to data collection and terms of research you can see that the sensor data to be collected are dependent upon the selection made in the web portal while creating the study sign and click next to complete the study onboarding process measure and collect health data in the starter wearable app, you can see a list of on-demand measurements that you can contribute to health research for this code lab, choose ecg and click measure follow the onscreen measurement instruction after measuring successfully, scroll to the bottom of the wearable app and press the sync button to synchronize the data with the mobile app in the mobile app, go to data tab, click the more button, and click sync to transfer the collected data to the web portal visualize the collected data in web portal you can display the collected data as a graph in any way you choose for further analysis of the study from the overview page of the study in the web portal, navigate to the dashboard page click on the add chart button provide a title for the chart and select the desired chart type then, edit the chart source choose the database where the data is stored for this code lab, enter the following query to display only the first ten heart rate data from wearheartrate table select * from wearheartrate limit 10 click run query and save select value and timestamp for the value and category columns respectively check the preview of the graph finally, click save to display the graph into the dashboard you're done! congratulations! you have successfully achieved the goal of this code lab now, you can create your own health research system by yourself! to learn more, see samsung health research stack
Preferences Submitted
You have successfully updated your cookie preferences.