• Learn
    • Code Lab
    • Foldables and Large Screens
    • One UI Beta
    • Samsung Developers Podcasts
  • Develop
    • Mobile/Wearable
    • Galaxy GameDev
    • Galaxy Themes
    • Galaxy Watch
    • Health
    • Samsung Blockchain
    • Samsung DeX
    • Samsung IAP
    • Samsung Internet
    • Samsung Pay
    • Samsung Wallet
    • View All
      • Galaxy AR Emoji
      • Galaxy Accessory
      • Galaxy Edge
      • Galaxy Z
      • Galaxy Performance
      • Galaxy FM Radio
      • Galaxy S Pen Remote
      • Galaxy Sensor Extension
      • PENUP
      • Samsung Automation
      • Samsung Neural
      • Samsung TEEGRIS
      • Samsung eSE SDK
    • Visual Display
    • Smart TV
    • Smart Hospitality Display
    • Smart Signage
    • Digital Appliance
    • Family Hub
    • Platform
    • Bixby
    • Knox
    • SmartThings
    • Tizen.NET
  • Design
    • Design System
    • One UI
    • One UI Watch
    • Smart TV
  • Distribute
    • Galaxy Store
    • TV Seller Office
    • Galaxy Store Games
    • Samsung Podcasts
  • Support
    • Developer Support
    • Remote Test Lab
    • Issues and Bugs Channel
    • Samsung Android USB Driver
    • Galaxy Emulator Skin
  • Connect
    • Blog
    • News
    • Forums
    • Events
    • Samsung Developer Conference
    • SDC22
    • SDC21
    • SDC19 and Previous Events
  • Sign In
Top Global Search Form
Recommendation
  • Blog
  • Code Lab
  • Foldable and Large Screen Optimization
  • Forums
  • Galaxy Emulator Skin
  • Galaxy GameDev
  • Health
  • Remote Test Lab
  • Samsung Developer Conference
  • SDC22
  • Watch Face Studio
All Search Form
Recommendation
    Suggestion
      All Search Form
      Filter
      Filter
      Filter
      • ALL
      • DOCS
      • SDK
      • API REFERENCE
      • CODE LAB
      • BLOG (24)
      • NEWS/EVENTS
      • BLOG
        api reference code lab blog news/events
      1. tutorials | mobile, health, game, blockchain, galaxy watch, foldable, iot

      blog

      Start Your Learning Journey with Code Lab

      if you are looking for an opportunity to boost your skills and learn how to use samsung sdks and tools through various hands-on learning experiences, code lab is the right place for you. code lab is a learning platform where you can get started with the latest technologies and services in samsung. through its series of tutorials, it introduces you to the use cases or scenarios for a specific technology. it engages anyone through the step-by-step process of building a sample application or adding a new feature to an existing one. with that, you can integrate your learnings from code lab into your individual or business needs. you can start, by trying out one topic or use case that interests you, and get to know how to easily use a service or tool. it covers topics related to mobile, ai, iot, health, game, security, blockchain, web, or wearables. new topics have been published in code lab for you to learn about samsung’s latest cutting-edge technologies, enabling you to use them to your advantage. with the advent of foldable smartphones, contents like camera web app on foldables, flex mode, app continuity, and multi-window will help you create or modify your applications to adapt seamlessly with different form factors. code lab also provides tutorials on designing your watch face and tracking exercises for the newly released galaxy watch4, operating on wear os powered by samsung. to enhance your hands-on learning experience with code lab, you can simply test sample applications in remote test lab even if you don’t have any physical galaxy devices. it’s a service that allows you to test your apps virtually and remotely, on thousands of samsung galaxy mobile and watch devices. flagship devices are widely available like the galaxy s21 series and the latest galaxy z fold3 and z flip3. not only can you learn with code lab, but you can also test anytime, anywhere. now, are you ready to start your learning journey? visit: https://developer.samsung.com/codelab

      Christopher Marquez

      https://developer.samsung.com/sdp/blog/en-us/2021/12/10/start-your-learning-journey-with-code-lab
      1. events | iot

      blog

      Samsung Developer Conference 2019

      registration is now open for the samsung developer conference 2019 in san jose, california! join over 5,000 developers, creators and technologists as smartthings will announce some new developments in our smartthings platform. our 2 day conference will consist of code labs, technical sessions and keynotes. access to the conference includes: updates on the latest sdc news, technical session details and speaker lineup. a full pass that includes entry into all keynotes, sessions and code labs. access to our exhibition area and smartthings developer code labs. meetings with our smartthings engineering teams! we have limited tickets, so sign up today!

      SmartThings Developers

      https://developer.samsung.com/smartthings/blog/en-us/2019/08/01/samsung-developer-conference-2019
      1. events | mobile, foldable

      blog

      Unpacked August 2022: Developing an Unfolding World

      yes, samsung's unpacked august 2022 is happening! livestream the event wed, aug 10th at 9am et/6am pt on samsung.com and samsung's youtube channel. here's what to expect: announcements about the samsung galaxy z fold4, galaxy z flip4, and galaxy watch5. plus, reserve yours before august 10th and get a $100 samsung credit for a galaxy smartphone or a $200 samsung credit for a galaxy smartphone bundle. last year, samsung shipped nearly 10m foldable smartphones worldwide, which was a 300%+ increase from 2020. foldables are definitely going mainstream and gaining a larger share of the overall smartphone market. according to dr. tm roh, president and head of mx business, samsung electronics, the foldable form factor is now the preferred choice for millions. this unpacked announcement will focus on foldables being the optimal tool for productivity and creative expression. mark your calendar to be part of unpacked aug 10, 2022; livestream the event at 9am et/6am pt, on samsung.com and samsung's youtube channel. developer content we've also been busy creating technical content about foldables for developers. foldables podcast with guests from microsoft, google, and samsung (season 3, episode 7) guy merin (microsoft), ade oshineye (google), and søren lambæk (samsung) discuss foldable trends and how companies are working together to help developers create for this new and innovative technology. follow along in our code labs and tutorials about foldables. boost your apps' value with foldable and large screen optimization discover more about implementing, optimizing, and testing your apps on galaxy z devices. this foldables and large screens page is a collection of code labs, blogs, and docs that you can review at your own pace. how to use jetpack windowmanager in android game dev - code lab with the increasing popularity of foldable phones such as the galaxy z fold3 and galaxy z flip3, apps on these devices are adopting foldable features. in this blog, you can get started on how to use foldable features on android game apps. develop a camera web app on foldables - code lab learn to develop a camera web application that detects partially folded postures and adjusts its layout accordingly to improve the user's experience on samsung foldable devices. companion blog to the camera web - tutorial (spanish version here) follow along with laura morinigo, web developer advocate, samsung, as she guides you step-by-step on how to create a web app for a foldable device when the device changes postures. she also gives a tech talk: unfolding the future of response web design (from sdc 21). how to test your mobile apps through a web browser -- video tutorial don't have a foldable device to do your development and testing? you can use the remote test lab, it's free! additional resources on the samsung developers site the samsung developers site has many resources for developers looking to build for and integrate with samsung devices and services. stay in touch with the latest news by creating a free account and subscribing to our monthly newsletter. visit the galaxy store games page for information on bringing your game to galaxy store and visit the marketing resources page for information on promoting and distributing your android apps. finally, our developer forum is an excellent way to stay up-to-date on all things related to the galaxy ecosystem.

      Jeanne Hsu

      https://developer.samsung.com/sdp/blog/en-us/2022/08/03/unpacked-august-2022-developing-an-unfolding-world
      1. events | advertisement

      blog

      Samsung Developer Conference 2019 Presale Tickets Available Now

      registration for samsung developer conference 2019 is now open! join more than 5,000 innovators, developers, technologists, and content creators to explore the next wave of intelligent tech. if you enjoy meeting and collaborating with industry leaders and world-renowned speakers, then sdc19 is for you. the two-day conference will be packed with code labs, demos, technical sessions, and keynotes from samsung executives and the industry’s most-innovative thinkers. you’ll get hands-on experience with our latest hardware, software, and services with the help of samsung engineers and tech partners from around the globe. for a limited-time only, register for #sdc19 with an exclusive presale discount that includes: sdc19 tickets at the lowest possible price – $120! updates on the latest sdc news, technical session details, and speaker lineup a two-day pass that includes admission to all keynotes, sessions, code labs, as well as devs + drinks entrance to our samsung exhibition area 1:1 training with samsung experts and more! space for this select group is limited, so sign up today! register now! we look forward to seeing you on october 29 - 30 at the san jose convention center. in the meantime, check out the highlights from sdc18.

      Samsung Developer Program

      https://developer.samsung.com/sdp/blog/en-us/2019/07/16/samsung-developer-conference-2019-presale-tickets-available-now
      1. announcement | mobile, galaxy watch

      blog

      Unpacking Galaxy Unpacked for Developers

      galaxy unpacked brought exciting new product announcements for galaxy watch4, galaxy z fold3, and galaxy z flip3. in this post, we'll go into more detail on how you can create delightful experiences for these devices in your own apps and watch faces. galaxy watch4 / one ui watch the new galaxy watch4 announcement shines the spotlight on the new collaborative wearable platform from samsung and google. this change from tizen to wear os opens doors for developers and designers to create exciting new designs. as with earlier generations of galaxy watch models, designers can create beautiful work without coding. for galaxy watch4, we've introduced watch face studio. designers who built for tizen-based devices using galaxy watch studio will recognize how this new tool works. for creators with existing designs built with galaxy watch studio, there is also a tool to convert from the tizen .tpk format to the wear os .aab format. this tool is called galaxy watch studio converter. as there are differences between tizen and wear os, some functions are not supported in the conversion process. for support on these tools, please visit the samsung developer forums for watch face studio and watch face studio converter. developers who are interested in creating applications for the new wearable platform can find more information at the android developers site. galaxy z series galaxy unpacked brought news of two exciting evolutions of samsung phones with the galaxy z fold3 and the galaxy z flip3. for mobile developers, these devices provide opportunities to bring a first-class experience to users of their apps by utilizing unique features of the z series hardware and software. possibly the most notable addition to the galaxy z fold3 is the s pen, which had previously been available to owners of galaxy note and galaxy tab devices. developers can integrate the s pen remote and air actions into their apps. code labs with samples are available to get you started. to check if s pen is available on a device, this block of code can be used. spenremote spenremote = spenremote.getinstance(); if (!spenremote.isconnected()) { spenremote.connect(getcontext(), new spenremote.connectionresultcallback() { @override public void onsuccess(spenunitmanager manager) { } @override public void onfailure(int error) { } }); } another feature of the galaxy z fold3 that developers can access is the inner display, activated when the device is opened. developers who want to provide a premium experience for these devices should ensure their apps provide continuity across the displays while interrupting their users as little as possible. samsung provides a code lab and sample code to ensure that your apps provide the best experience possible. the galaxy z fold3 and galaxy z flip3 also provide a unique featured called flex mode. flex mode is activated when a user opens the z fold3 or z flip3 screen half-way. in this configuration, apps are notified to alter their appearance to give the best experience. as with other new features, a code lab with samples is available on this site. follow up even though galaxy unpacked could not be experienced live, it brought new and exciting product announcements that improve our lives. we hope you enjoyed galaxy unpacked and use this information to make incredible experiences for your users. this site has many resources for developers looking to build for and integrate with samsung devices and services. stay in touch with the latest news by creating a free account or by subscribing to our monthly newsletter. visit the marketing resources page for information on promoting and distributing your apps. finally, our developer forum is an excellent way to stay up-to-date on all things related to the galaxy ecosystem.

      Samsung Developers

      https://developer.samsung.com/sdp/blog/en-us/2021/08/25/unpacking-galaxy-unpacked-for-developers
      1. events

      blog

      See What's Happening At SDC19

      samsung developer conference is where now meets next. it’s two days of learning and inspiration where samsung introduces new technology for the now and a greater vision for what’s next. join fellow developers to imagine future possibilities and master the skills to realize them. at last year’s conference, samsung broke barriers and redefined technology with announcements on one ui, bixby developer studio, and more. plus, devs learned about the latest sdks directly from samsung engineers during hands-on code labs. technical sessions provided more updates on a range of topics, including bixby and the new exponential frontier of intelligent assistants, which was one of the most attended sessions in 2018. key leaders from the samsung team broke down what bixby was, why it was different, how to capitalize on it, tips for integration, and more. sdc19 will be one for the books sdc19 will once again operate at the intersection of now and next with two days of exciting code labs, demos, technical sessions, and keynotes with the industry’s leading experts. discover the latest in tech with groundbreaking sessions on bixby, ai, blockchain, wearables, and more. every element of this year's conference is about the developer experience, including the brand identity. for sdc19, emoticons were created out of programming code — a playful representation of the developers, creators, technologists, and samsung pros that make up the conference’s diverse audience. emoticons symbolize what tiny bits of code can create when thoughtfully assembled. get early bird pricing grab your spot today for samsung developer conference and save $150! don't miss your chance to experience cutting-edge technology, network with tech leaders, and learn samsung's latest dev tools first-hand. see you there on october 29–30 at the san jose convention center. already registered? we can’t wait to see you! in the meantime, follow us on facebook, twitter, linkedin, and instagram for the latest updates on sessions, speakers, and more.

      Samsung Developer Program

      https://developer.samsung.com/sdp/blog/en-us/2019/08/02/see-whats-happening-at-sdc19
      1. events | mobile

      blog

      And That's a Wrap! Check Out Highlights from SDC19.

      thanks to everyone who came to samsung developer conference last week or tuned in to the livestream! here were some of our favorite moments that weren't covered in the day 1 and day 2 recaps. code lab code lab sat in the center of tech square and allowed devs to get hands-on experience with the latest sdks and developer tools. samsung engineers were there for support and fun coding challenges gave attendees the chance to win exclusive prizes. penup the penup app is a social network for designers on the galaxy smartphone. you can learn how to draw digitally by tracing on top of a video clip or background image – it's a cool way to turn photos into masterpieces! the penup team secured two digital artists for sdc19. the artists roamed around and used a tab s6 and s pen to sketch attendees and capture the action at sdc19. there were also great tutorials on the s pen and s pen sdk in tech square! laugh and learn senior developer evangelist tony morelan and comedian corey rosen had a high-energy comedy and improv presentation on day 1 called galaxy watch face design from concept to completion. attendees and designers collaborated in real time to create an interactive galaxy watch face. it was a fun experiment that demonstrated how easy it is to design without coding. the audience was able to quickly create a playful watch face. fit @ sdc one theme of sdc19 was collaboration. samsung is forging new partnerships with brands to help devs have more tools at their disposal and reach a wider audience. two such partners are under armour and skimble, and each morning they put together a wellness activity that featured their new galaxy store apps. day 1: yoga-centric exercise class with skimble this class was led by a trainer from made for samsung partner skimble. yoga mats and samsung galaxy watch active2s were available for attendees, and they could download the workout trainer by skimble app to follow along with a samsung-specific workout. everyone was able to monitor their heart rate on the watch while getting their move on! day 2: fun run/walk with under armour under armour organized a two-mile walk or three-mile run for attendees before the conference. samsung galaxy watch active2s were given to participants and synced with the map my run app to track their distance, pace, and calorie burn. devs, we hope that sdc19 inspired you to continue innovating. from troubleshooting to new platform training, the samsung developer program is always here to help. check out our post-event site with more highlights, photos, and videos of sdc19. we hope to see you next year!

      Samsung Developer Program

      https://developer.samsung.com/sdp/blog/en-us/2019/11/04/and-thats-a-wrap-check-out-highlights-from-sdc19
      1. tutorials | health, galaxy watch

      blog

      Tracking Exercises with Galaxy Watch

      galaxy watch offers a convenient way of measuring exercise progress. modern sensors designed specifically for health services provide the most precise readings. after connecting to health services, you can measure certain exercises and track their values. this blog describes all the important steps to build an exercise tracking app using the health services api. we use example code introduced in health code lab for tracking exercise. you can download the source code from this code lab. health services defines a variety of exercise types. for a full exercise type list, take a look at exercisetype. on galaxy watch4 and galaxy watch4 classic, a repetition counter is available for the following exercises: back_extension barbell_shoulder_press bench_press bench_sit_up burpee crunch deadlift forward_twist dumbbell_curl_right_arm dumbbell_front_raise dumbbell_lateral_raise dumbbell_triceps_extension_left_arm dumbbell_triceps_extension_right_arm dumbbell_triceps_extension_two_arm dumbbell_curl_left_arm jump_rope jumping_jack lat_pull_down lunge squat upper_twist in this application, we are going to use deadlift. the example code used for deadlift can be easily adapted to track all repetition-based exercises. the basics of connecting to health services are covered in the blog using health services on galaxy watch. setting up an exercise once connected to the health services api, we are ready to set up the exercise. in this case we use deadlift as a sample exercise. first, we need to get the exercise client: exerciseclient exerciseclient = client.getexerciseclient(); after that, we need to set the exercise type in the configuration builder: exercisetype exercisetype = exercisetype.deadlift exerciseconfigbuilder exerciseconfigbuilder = exerciseconfig.builder() .setexercisetype(exercisetype); to see what can be tracked for our exercise, we need to check its capabilities. we do this by using a listenablefuture object and listening for a callback from health services. listenablefuture<exercisecapabilities> capabilitieslistenablefuture = exerciseclient.getcapabilities(); when we receive a callback, we can receive a set with capabilities: futurecallback<exercisecapabilities>() { @override public void onsuccess(@nullable exercisecapabilities result) { try { exercisetypecapabilities exercisetypecapabilities = result.getexercisetypecapabilities(exercisetype); set<datatype> exercisecapabilitiesset = exercisetypecapabilities.getexercisecapabilities(result); } if you do not want to track some of these values, at this point, you can remove them from a set. by default, all datatypes that a certain exercise can measure are being stored as a set. by removing them before setting up a configuration builder, you can exclude tracking unnecessary values. once we are ready, we can finish configuring an exercise: exerciseconfigbuilder = exerciseconfig.builder() .setexercisetype(exercisetype) .setdatatypes(exercisecapabilitiesset); setting up exercise listener an exercise listener is an object that allows us to get exercise updates from health services, whenever they are available. to set up the listener, we need to override three methods: exerciseupdatelistener exerciseupdatelistener = new exerciseupdatelistener() { @override public void onexerciseupdate(exerciseupdate update) { //processing your update } @override public void onavailabilitychanged(datatype datatype, availability availability) { //processing availability } @override public void onlapsummary(exerciselapsummary summary) { //processing lap summary } }; starting and stopping the exercise we are ready to start tracking our exercise. to do that, we use the listenablefuture object that gets callbacks from the healthservices api whenever an update is available. to build this object, we send our configuration to the exercise client while starting measurement: listenablefuture<void> startexerciselistenablefuture = exerciseclient.startexercise(exerciseconfigbuilder.build()); when we get a callback from the healthservices api, we start our listener: listenablefuture<void> updatelistenablefuture = exerciseclient.setupdatelistener(exerciseupdatelistener); we finish exercise in a similar way, by creating a listenablefuture object that asks the health services api to stop tracking exercise: listenablefuture<void> endexerciselistenablefuture = exerciseclient.endexercise() processing exercise update data exercise update data contains various information about the performed exercise. after setting up a listener, we retrieve it in a callback: public void onexerciseupdate(@nonnull exerciseupdate update) { try { updaterepcount(update); } catch (deadliftexception exception) { log.e(tag, "error getting exercise update: ", exception); } } in this example, we focus on one of most important readings—latest metrics. we store them in a map: map<datatype, list<datapoint>> map = update.getlatestmetrics(); now we can read particular values by looking for their key: list<datapoint> reppoints = map.get(datatype.rep_count); list<datapoint> caloriespoints = map.get(datatype.total_calories); the last value on the list is the latest reading in the current update. we can use it in our application, for example, when updating a label: string repvalue = string.format("%d", iterables.getlast(reppoints).getvalue().aslong()); txtreps.settext(string.format("reps count: %s", repvalue)); this is how exercise data can be accessed and processed using health services on galaxy watch. it’s a quick and convenient way to track its progress that everybody can implement into a watch application.

      https://developer.samsung.com/health/blog/en-us/2022/02/16/tracking-exercises-with-galaxy-watch
      1. tutorials | game, mobile

      blog

      How to Use Jetpack WindowManager in Android Game Dev

      with the increasing popularity of foldable phones such as the galaxy z fold3 and galaxy z flip3, apps on these devices are adopting its foldable features. in this blog, you can get started on how to utilize these foldable features on android game apps. we focus on creating a java file containing an implementation of the android jetpack windowmanager library that can be imported into game engines like unity or unreal engine. this creates an interface allowing developers to retrieve information about the folding feature on the device. at the end of this blog, you can go deeper in learning by going to code lab. android jetpack windowmanager android jetpack, in their own words, is "a suite of libraries to help developers follow best practices, reduce boilerplate code, and write code that works consistently across android versions and devices so that developers can focus on the code they care about." windowmanager is one of these libraries, and is intended to help application developers support new device form factors and multi-window environments. the library had its 1.0.0 release in january 2022 for targeted foldable devices. according to its documentation, future versions will be extended to more display types and window features. creating the android jetpack windowmanager setup as previously mentioned, we are creating a java file that can be imported into either unity or unreal engine 4, to create an interface for retrieving information on the folding feature and pass it over to the native or engine side of your applications. set up the foldablehelper class and data storage class create a file called foldablehelper.java in visual studio or any source code editor. let's start off by giving it a package name of package com.samsung.android.gamedev.foldable; next, let's import all the necessary libraries and classes in this file: //android imports import android.app.activity; import android.graphics.rect; import android.os.handler; import android.os.looper; import android.util.log; //android jetpack windowmanager imports import androidx.annotation.nonnull; import androidx.core.util.consumer; import androidx.window.java.layout.windowinfotrackercallbackadapter; import androidx.window.layout.displayfeature; import androidx.window.layout.foldingfeature; import androidx.window.layout.windowinfotracker; import androidx.window.layout.windowlayoutinfo; import androidx.window.layout.windowmetrics; import androidx.window.layout.windowmetricscalculator; //java imports import java.util.list; import java.util.concurrent.executor; start by creating a class, foldablehelper, that is going to contain all of our helper functions. let's then create variables to store a callback object as well as windowinfotrackercallbackadapter and windowmetricscalculator. let's also create a temporary declaration of the native function to pass the data from java to the native side of application once we start working in the game engines. public class foldablehelper { private static layoutstatechangecallback layoutstatechangecallback; private static windowinfotrackercallbackadapter wit; private static windowmetricscalculator wmc; public static native void onlayoutchanged(foldablelayoutinfo resultinfo); } let's create a storage class to hold the data received from the windowmanager library. an instance of this class will also be passed to the native code to transfer the data. public static class foldablelayoutinfo { public static int undefined = -1; // hinge orientation public static int hinge_orientation_horizontal = 0; public static int hinge_orientation_vertical = 1; // state public static int state_flat = 0; public static int state_half_opened = 1; // occlusion type public static int occlusion_type_none = 0; public static int occlusion_type_full = 1; rect currentmetrics = new rect(); rect maxmetrics = new rect(); int hingeorientation = undefined; int state = undefined; int occlusiontype = undefined; boolean isseparating = false; rect bounds = new rect(); } initialize the windowinfotracker since we are working in java and the windowmanager library is written in kotlin, we have to use the windowinfotrackercallbackadapter. this is an interface provided by android to enable the use of the windowinfotracker from java. the window info tracker is how we receive information about any foldable features inside the window's bounds. next is to create windowmetricscalculator, which lets us retrieve the window metrics of an activity. window metrics consists of the windows' current and maximum bounds. we also create a new layoutstatechangecallback object. this object is passed into the window info tracker as a listener object and is called every time the layout of the device changes (for our purposes this is when the foldable state changes). public static void init(activity activity) { //create window info tracker wit = new windowinfotrackercallbackadapter(windowinfotracker.companion.getorcreate(activity)); //create window metrics calculator wmc = windowmetricscalculator.companion.getorcreate(); //create callback object layoutstatechangecallback = new layoutstatechangecallback(activity); } set up and attach the callback listener in this step, let's attach the layoutstatechangecallback to the windowinfotrackercallbackadapter as a listener. the addwindowlayoutinfolistener function takes three parameters: the activity to attach the listener to, an executor, and a consumer of windowlayoutinfo. we will set up the executor and consumer in a moment. the adding of the listener is kept separate from the initialization, since the first windowlayoutinfo is not emitted until activity.onstart has been called. as such, we'll likely not be needing to attach the listener until during or after onstart, but we can still set up the windowinfotracker and windowmetricscalculator ahead of time. public static void start(activity activity) { wit.addwindowlayoutinfolistener(activity, runonuithreadexecutor(), layoutstatechangecallback); } now, let's create the executor for the listener. this executor is straightforward and simply runs the command on the mainlooper of our activity. it is possible to set this up to run on a custom thread, however this is not going to be covered in this blog. for more information, we recommend checking the official documentation for the jetpack windowmanager. static executor runonuithreadexecutor() { return new myexecutor(); } static class myexecutor implements executor { handler handler = new handler(looper.getmainlooper()); @override public void execute(runnable command) { handler.post(command); } } we're going to create the basic layout of our layoutstatechangecallback. this consumes windowlayoutinfo and implements consumer<windowlayoutinfo>. for now, let's simply lay out the class and give it some functionality a little bit later. static class layoutstatechangecallback implements consumer<windowlayoutinfo> { private final activity activity; public layoutstatechangecallback(activity activity) { this.activity = activity; } } if the use of the listener is no longer needed, we want a way to remove it and the windowinfotrackercallbackadapter contains a function to do just that. public static void stop() { wit.removewindowlayoutinfolistener(layoutstatechangecallback); } this just tidies things up for us and ensures that the listener is cleaned up when we no longer need it. next, we're going to add some functionality to the layoutstatechangecallback class. we are going to process windowlayoutinfo into foldablelayoutinfo we created previously. using java native interface (jni), we are going to send that information over to the native side using the function onlayoutchanged. note: this doesn't actually do anything yet, but we cover how to set this up in unreal engine and in unity through code lab tutorials. static class layoutstatechangecallback implements consumer<windowlayoutinfo> { @override public void accept(windowlayoutinfo windowlayoutinfo) { foldablelayoutinfo resultinfo = updatelayout(windowlayoutinfo, activity); onlayoutchanged(resultinfo); } } let's implement the updatelayout function to process windowlayoutinfo and return a foldablelayoutinfo. firstly, create a foldablelayoutinfo that contains the processed information. follow this up by getting the window metrics, both maximum metrics and current metrics. private static foldablelayoutinfo updatelayout(windowlayoutinfo windowlayoutinfo, activity activity) { foldablelayoutinfo retlayoutinfo = new foldablelayoutinfo(); windowmetrics wm = wmc.computecurrentwindowmetrics(activity); retlayoutinfo.currentmetrics = wm.getbounds(); wm = wmc.computemaximumwindowmetrics(activity); retlayoutinfo.maxmetrics = wm.getbounds(); } get the displayfeatures present in the current window bounds using windowlayoutinfo.getdisplayfeatures. currently, the api only has one type of displayfeature: foldingfeatures, however in the future there will likely be more as screen types evolve. at this point, let's use a for loop to iterate through the resulting list until it finds a foldingfeature. once it detects a folding feature, it starts processing its data: orientation, state, seperation type, and its bounds. then, store these data in foldablelayoutinfo we've created at the start of the function call. you can learn more about these data by going to the jetpack windowmanager documentation. private static foldablelayoutinfo updatelayout(windowlayoutinfo windowlayoutinfo, activity activity) { foldablelayoutinfo retlayoutinfo = new foldablelayoutinfo(); windowmetrics wm = wmc.computecurrentwindowmetrics(activity); retlayoutinfo.currentmetrics = wm.getbounds(); wm = wmc.computemaximumwindowmetrics(activity); retlayoutinfo.maxmetrics = wm.getbounds(); list<displayfeature> displayfeatures = windowlayoutinfo.getdisplayfeatures(); if (!displayfeatures.isempty()) { for (displayfeature displayfeature : displayfeatures) { foldingfeature foldingfeature = (foldingfeature) displayfeature; if (foldingfeature != null) { if (foldingfeature.getorientation() == foldingfeature.orientation.horizontal) { retlayoutinfo.hingeorientation = foldablelayoutinfo.hinge_orientation_horizontal; } else { retlayoutinfo.hingeorientation = foldablelayoutinfo.hinge_orientation_vertical; } if (foldingfeature.getstate() == foldingfeature.state.flat) { retlayoutinfo.state = foldablelayoutinfo.state_flat; } else { retlayoutinfo.state = foldablelayoutinfo.state_half_opened; } if (foldingfeature.getocclusiontype() == foldingfeature.occlusiontype.none) { retlayoutinfo.occlusiontype = foldablelayoutinfo.occlusion_type_none; } else { retlayoutinfo.occlusiontype = foldablelayoutinfo.occlusion_type_full; } retlayoutinfo.isseparating = foldingfeature.isseparating(); retlayoutinfo.bounds = foldingfeature.getbounds(); return retlayoutinfo; } } } return retlayoutinfo; } if there's no folding feature detected, it simply returns the foldablelayoutinfo without setting its data leaving it with undefined (-1) values. conclusion the java file you have now created should be usable in new or existing unity and unreal engine projects, to provide access to the information on the folding feature. continue learning about it by going to the code lab tutorials showing how to use the file created here, to implement flex mode detection and usage in game applications. additional resources on the samsung developers site the samsung developers site has many resources for developers looking to build for and integrate with samsung devices and services. stay in touch with the latest news by creating a free account and subscribing to our monthly newsletter. visit the marketing resources page for information on promoting and distributing your apps. finally, our developer forum is an excellent way to stay up-to-date on all things related to the galaxy ecosystem.

      Lochlann Henry Ramsay-Edwards

      https://developer.samsung.com/galaxy-gamedev/blog/en-us/2022/07/20/how-to-use-jetpack-window-manager-in-android-game-dev
      1. tutorials | game, mobile

      blog

      Foldable Device Features with Unity and Unreal Engine 4

      intro foldable technology for mobile is a ground-breaking experience not only for users, but also for developers. the presence of many form factors, like immersive display, app continuity, flex mode, and ux optimization, challenge developers to think outside of the box to adapt to this technology. there are already a large number of blogs talking about general application considerations, but what about gaming on a foldable device? in this blog, we look at the challenges and new opportunities foldable devices present for mobile game development. this blog focuses on unity and unreal engine as they are the most common game engines for mobile development. however, a lot of the information applies to other engines as well. app continuity and multi-window mode firstly, let's establish that the large internal display is called the main display whilst the smaller external display is called the cover display. app continuity and multi-window mode are two key features of foldable smartphones. with app continuity, you can seamlessly transition between the cover display to the main display without needing to reopen the app. with multi-window, you can run multiple apps at once and multitask like never before. app continuity moving an app between the two displays affects the size, density, and aspect ratio of the display it can use. app continuity is enabled and disabled from the android manifest of the app: the <activity> element has a new attribute called resizeableactivity. if not set, this attribute defaults to true, thus enabling app continuity and assuming the app fully supports both app continuity and multi-window mode. if set to true then the application automatically attempts to resize when moving between displays, as shown in the video below. if set to false then the system still allows you to transition from the cover display to the main display but does not attempt to resize the application. instead, a new button appears, allowing the user to restart the application at a time of their choosing, as shown below. when the app transitions between the two displays, the activity is destroyed and recreated. as such, the app data needs to be stored and then used to restore the previous state. from testing, both unity and unreal engine appear to handle this process already. however, if you are developing on a custom engine, it is worth confirming that your engine/app can handle this. continue on cover screen by default, foldable devices simply lock the device when closing the main display. however, it is possible for users to disable this functionality for certain apps. in the device's display settings, there is an option called "continue on cover screen" that has to be enabled by the user. entering this menu displays a list of all applications on the device and enables users to set specific applications to not lock the device when closing the main display. if an application has resizeableactivity set to false then the option to enable this functionality is greyed out and is not available. if your application supports resizing and app continuity then you should make sure to test that this works as users may wish to enable this functionality on their device. multi-window mode multi-window mode can allow up to three apps to run at the same time in a split-screen arrangement (see left image) or for two apps to run in pop-up mode which keeps one app full-screen but creates another app in a smaller pop-up window (see right image). just like app continuity, this is enabled using the attribute resizeableactivity in the android manifest. if resizeableactivity is not set then it defaults to true. so again, it is recommended that you set this yourself to ensure that your app works as intended. app continuity without multi-window mode if you would like your app to support app continuity but don't want it to be used by the multi-window mode, then this is possible. first, you should set the resizableactivity attribute to false to disable both app continuity and multi-window mode. next use the following <meta-data> element in your <activity> element: <meta-data android:name="android.supports_size_changes" android:value="true" /> this re-enables the app continuity feature without enabling multi-window mode. game engine features to use if using existing game engines then there are several existing features that are useful if developing for foldable devices. this section provides a high-level look at these features. for more in-depth information, i recommend visiting the engine's documentation. unity unity is a very good engine for developing on foldable devices, requiring little to no setup to enable features for foldable devices. the engine automatically handles resizing of the application without any modifications required. the resizeableactivity attribute is controlled by an option in the player settings: resizable window. when enabled, resizeableactivity appears to be set to true; when disabled, resizeableactivity appears to be set to false. note this option is not available in older versions of unity. if this option is not present then you have to set the resizeableactivity manually. the engine also provides a very robust ui scaling system that helps to reduce the amount of work required to create a ui that works across both the cover display and main display. the canvas scaler and anchor system work very well with foldable devices and work to resize and position elements consistently across the two displays, thus preventing developers from having to create two ui designs (one for cover display and one for main display). unreal engine 4 unreal engine 4 is another good engine for developing on foldable devices, although it requires a little more work to get it set up for foldable devices. first of all, unreal engine 4 by default disables the resize event on android devices, however, it is possible to re-enable it in device profiles using the console variable: r.enablenativeresizeevent = 1 unreal engine 4 by default also has a max aspect ratio of 2.1. this is, however, too small for the cover display of some foldable devices which can result in black bars on either side of the image. fortunately, unreal engine makes this value easily changeable in the project settings: platform -> android -> max aspect ratio from my testing, 2.8 is a good value. however, i recommend users experiment to find the best value. unreal engine's umg (unreal motion graphics ui designer) has a comprehensive set of tools for creating responsive ui designs. this system automatically scales ui elements to fit the screen size, and the anchor system is also very useful for ensuring the ui elements are positioned correctly between the two displays. samsung remote test lab no matter what engine you use, the best way to ensure your app works well on a foldable device is to test it on a foldable device. samsung remote test lab has a range of foldable devices available for developers to test their applications on if getting hold of a physical device is too difficult or expensive. all you need to do is create a samsung account and you can start using these devices for testing. android jetpack windowmanager despite being very good engines for foldable game development, neither unity nor unreal currently provide information about the current state of the foldable device (that is, is it open/closed/halfway?, where is the fold positioned?, what is the fold's orientation? and so forth). however, android has recently created a new library as a part of their android jetpack libraries that enables developers to access this information and make use of it in their apps. android jetpack in their own words is "a suite of libraries to help developers follow best practices, reduce boilerplate code, and write code that works consistently across android versions and devices so that developers can focus on the code they care about." windowmanager is a new library from the android jetpack suite, intended to help application developers support new device form factors and multi-window environments. the library had its 1.0.0 release in january 2022, and targeted foldable devices but—according to the documentation—future versions will extend to more display types and window features. more technical resources this blogpost has an accompanying technical blogpost and code lab tutorial, demonstrating how to use the android jetpack windowmanager with both unity and unreal to take advantage of the flex mode feature of samsung's foldable devices. i recommend starting with the jetpack windowmanager blogpost to learn how to set up the windowmanager in java: https://developer.samsung.com/galaxy-gamedev/blog/en-us/2022/07/20/how-to-use-jetpack-window-manager-in-android-game-dev then, follow it up with the code labs to learn how to make use of the windowmanager to implement a simple flex mode setup in either unreal or unity: https://developer.samsung.com/codelab/gamedev/flex-mode-unreal.html https://developer.samsung.com/codelab/gamedev/flex-mode-unity.html also, visit our game developer community to join the discussion around mobile gaming and foldable devices. click here to find out more about other design considerations when designing apps for foldable devices and large screens. final thoughts foldable devices provide a richer experience than regular phones. hopefully, this blogpost and accompanying tutorial have provided you with the necessary information to begin taking advantage of these new form factors and start providing users a richer foldable experience. additional resources on the samsung developers site the samsung developers site has many resources for developers looking to build for and integrate with samsung devices and services. stay in touch with the latest news by creating a free account and subscribing to our monthly newsletter. visit the galaxy store games page for information on bringing your game to galaxy store and visit the marketing resources page for information on promoting and distributing your android apps. finally, our developer forum is an excellent way to stay up-to-date on all things related to the galaxy ecosystem.

      Lochlann Henry Ramsay-Edwards

      https://developer.samsung.com/galaxy-gamedev/blog/en-us/2022/09/16/foldable-device-features-with-unity-and-unreal-engine-4
      No Search Results
      No Search results. Try using another keyword.
      • <<
      • <
      • 1
      • 2
      • 3
      • >
      • >>
      Samsung Developers
      Samsung Developers
      Quick Link
      • Android USB Driver
      • Code Lab
      • Galaxy Emulator Skin
      • Foldables and Large Screens
      • One UI Beta
      • Remote Test Lab
      • Samsung Developers Podcast
      Family Site
      • Bixby
      • Knox
      • Samsung Pay
      • SmartThings
      • Tizen
      • Samsung Research
      • Samsung Open Source
      • Samsung Dev Spain
      • Samsung Dev Brazil
      Legal
      • Terms
      • Privacy
      • Open Source License
      • Cookie Policy
      Social Communications
      • Facebook
      • Instagram
      • Twitter
      • YouTube
      • Buzzsprout
      • Rss
      • Linkedin
      • System Status
      • Site Map
      • System Status
      • Site Map
      • facebook
      • instagram
      • twitter
      • youtube
      • buzzsprout
      • rss
      • linkedin

      Copyright © 2023 SAMSUNG. All rights reserved.