This module explores the integration of ChatGPT into iOS apps, enabling powerful conversational AI capabilities. You’ll learn to leverage the ChatGPT API to create dynamic, context-aware chatbots and intelligent assistants within their mobile apps.
Source link
نویسنده: post bot
-
Common media processing operations with Jetpack Media3 Transformer
Posted by Nevin Mital – Developer Relations Engineer, and Kristina Simakova – Engineering Manager
Android users have demonstrated an increasing desire to create, personalize, and share video content online, whether to preserve their memories or to make people laugh. As such, media editing is a cornerstone of many engaging Android apps, and historically developers have often relied on external libraries to handle operations such as Trimming and Resizing. While these solutions are powerful, integrating and managing external library dependencies can introduce complexity and lead to challenges with managing performance and quality.
The Jetpack Media3 Transformer APIs offer a native Android solution that streamline media editing with fast performance, extensive customizability, and broad device compatibility. In this blog post, we’ll walk through some of the most common editing operations with Transformer and discuss its performance.
Getting set up with Transformer
To get started with Transformer, check out our Getting Started documentation for details on how to add the dependency to your project and a basic understanding of the workflow when using Transformer. In a nutshell, you’ll:
- Create one or many MediaItem instances from your video file(s), then
- Apply item-specific edits to them by building an EditedMediaItem for each MediaItem,
- Create a Transformer instance configured with settings applicable to the whole exported video,
- and finally start the export to save your applied edits to a file.
Aside: You can also use a CompositionPlayer to preview your edits before exporting, but this is out of scope for this blog post, as this API is still a work in progress. Please stay tuned for a future post!
Here’s what this looks like in code:
val mediaItem = MediaItem.Builder().setUri(mediaItemUri).build() val editedMediaItem = EditedMediaItem.Builder(mediaItem).build() val transformer = Transformer.Builder(context) .addListener(/* Add a Transformer.Listener instance here for completion events */) .build() transformer.start(editedMediaItem, outputFilePath)
Transcoding, Trimming, Muting, and Resizing with the Transformer API
Let’s now take a look at four of the most common single-asset media editing operations, starting with Transcoding.
Transcoding is the process of re-encoding an input file into a specified output format. For this example, we’ll request the output to have video in HEVC (H265) and audio in AAC. Starting with the code above, here are the lines that change:
val transformer = Transformer.Builder(context) .addListener(...) .setVideoMimeType(MimeTypes.VIDEO_H265) .setAudioMimeType(MimeTypes.AUDIO_AAC) .build()
Many of you may already be familiar with FFmpeg, a popular open-source library for processing media files, so we’ll also include FFmpeg commands for each example to serve as a helpful reference. Here’s how you can perform the same transcoding with FFmpeg:
$ ffmpeg -i $inputVideoPath -c:v libx265 -c:a aac $outputFilePath
The next operation we’ll try is Trimming.
Specifically, we’ll set Transformer up to trim the input video from the 3 second mark to the 8 second mark, resulting in a 5 second output video. Starting again from the code in the “Getting set up” section above, here are the lines that change:
// Configure the trim operation by adding a ClippingConfiguration to // the media item val clippingConfiguration = MediaItem.ClippingConfiguration.Builder() .setStartPositionMs(3000) .setEndPositionMs(8000) .build() val mediaItem = MediaItem.Builder() .setUri(mediaItemUri) .setClippingConfiguration(clippingConfiguration) .build() // Transformer also has a trim optimization feature we can enable. // This will prioritize Transmuxing over Transcoding where possible. // See more about Transmuxing further down in this post. val transformer = Transformer.Builder(context) .addListener(...) .experimentalSetTrimOptimizationEnabled(true) .build()
With FFmpeg:
$ ffmpeg -ss 00:00:03 -i $inputVideoPath -t 00:00:05 $outputFilePath
Next, we can mute the audio in the exported video file.
val editedMediaItem = EditedMediaItem.Builder(mediaItem) .setRemoveAudio(true) .build()
The corresponding FFmpeg command:
$ ffmpeg -i $inputVideoPath -c copy -an $outputFilePath
And for our final example, we’ll try resizing the input video by scaling it down to half its original height and width.
val scaleEffect = ScaleAndRotateTransformation.Builder() .setScale(0.5f, 0.5f) .build() val editedMediaItem = EditedMediaItem.Builder(mediaItem) .setEffects( /* audio */ Effects(emptyList(), /* video */ listOf(scaleEffect)) ) .build()
An FFmpeg command could look like this:
$ ffmpeg -i $inputVideoPath -filter:v scale=w=trunc(iw/4)*2:h=trunc(ih/4)*2 $outputFilePath
Of course, you can also combine these operations to apply multiple edits on the same video, but hopefully these examples serve to demonstrate that the Transformer APIs make configuring these edits simple.
Transformer API Performance results
Here are some benchmarking measurements for each of the 4 operations taken with the Stopwatch API, running on a Pixel 9 Pro XL device:
(Note that performance for operations like these can depend on a variety of reasons, such as the current load the device is under, so the numbers below should be taken as rough estimates.)
Input video format: 10s 720p H264 video with AAC audio
- Transcoding to H265 video and AAC audio: ~1300ms
- Trimming video to 00:03-00:08: ~2300ms
- Muting audio: ~200ms
- Resizing video to half height and width: ~1200ms
Input video format: 25s 360p VP8 video with Vorbis audio
- Transcoding to H265 video and AAC audio: ~3400ms
- Trimming video to 00:03-00:08: ~1700ms
- Muting audio: ~1600ms
- Resizing video to half height and width: ~4800ms
Input video format: 4s 8k H265 video with AAC audio
- Transcoding to H265 video and AAC audio: ~2300ms
- Trimming video to 00:03-00:08: ~1800ms
- Muting audio: ~2000ms
- Resizing video to half height and width: ~3700ms
One technique Transformer uses to speed up editing operations is by prioritizing transmuxing for basic video edits where possible. Transmuxing refers to the process of repackaging video streams without re-encoding, which ensures high-quality output and significantly faster processing times.
When not possible, Transformer falls back to transcoding, a process that involves first decoding video samples into raw data, then re-encoding them for storage in a new container. Here are some of these differences:
Transmuxing
- Transformer’s preferred approach when possible – a quick transformation that preserves elementary streams.
- Only applicable to basic operations, such as rotating, trimming, or container conversion.
- No quality loss or bitrate change.
Transcoding
- Transformer’s fallback approach in cases when Transmuxing isn’t possible – Involves decoding and re-encoding elementary streams.
- More extensive modifications to the input video are possible.
- Loss in quality due to re-encoding, but can achieve a desired bitrate target.
We are continuously implementing further optimizations, such as the recently introduced experimentalSetTrimOptimizationEnabled setting that we used in the Trimming example above.
A trim is usually performed by re-encoding all the samples in the file, but since encoded media samples are stored chronologically in their container, we can improve efficiency by only re-encoding the group of pictures (GOP) between the start point of the trim and the first keyframes at/after the start point, then stream-copying the rest.
Since we only decode and encode a fixed portion of any file, the encoding latency is roughly constant, regardless of what the input video duration is. For long videos, this improved latency is dramatic. The optimization relies on being able to stitch part of the input file with newly-encoded output, which means that the encoder’s output format and the input format must be compatible.
If the optimization fails, Transformer automatically falls back to normal export.
What’s next?
As part of Media3, Transformer is a native solution with low integration complexity, is tested on and ensures compatibility with a wide variety of devices, and is customizable to fit your specific needs.
To dive deeper, you can explore Media3 Transformer documentation, run our sample apps, or learn how to complement your media editing pipeline with Jetpack Media3. We’ve already seen app developers benefit greatly from adopting Transformer, so we encourage you to try them out yourself to streamline your media editing workflows and enhance your app’s performance!
-
Top Picks for 2024 Yeeply
Developing mobile apps can be a challenging task, especially when it comes to choosing the right tools. Knowing the best software options for Android app development can save you time and effort. In this blog post, you’ll discover ten of the top software solutions that can help you create effective and high-quality apps for Android devices.
With a variety of tools available, it’s crucial to find the ones that suit your needs. From integrated development environments like Android Studio to cross-platform tools like Flutter, each software has unique features that can enhance your development process.
Whether you’re focused on user experience, performance testing, or database management, there’s a software that meets your requirements. By exploring these options, you can make informed decisions and streamline your app development journey.
Best Software for Android App Development
Choosing the right software for Android app development can significantly impact your project’s success. Different tools offer various features and advantages, making some better suited for specific tasks or developer needs.
1. Android Studio
Android Studio is the official Integrated Development Environment (IDE) for Android. It is specifically designed for Android development and offers a robust set of tools.
Pros:
- Comprehensive tools: Superior code editor, code analysis tools, and emulator.
- Built-in support: Offers direct integration with Google services and APIs.
Cons:
- Resource-intensive: Requires a powerful system to run smoothly.
- Steep learning curve: May be challenging for beginners.
2. IntelliJ IDEA
IntelliJ IDEA is known for its powerful code navigation and refactoring tools, making it a favorite among experienced developers.
Pros:
- Smart code completion: Helps write code faster and with fewer errors.
- Strong debugging tools: Excellent support for various programming languages.
Cons:
- Expensive: Can be costly, especially for larger teams.
- Complex: Might be overkill for simple projects.
3. Eclipse
Eclipse is a flexible and open-source IDE used for various programming languages, including Java.
Pros:
- Extensible via plugins: Highly customizable to meet specific needs.
- Free to use: Open-source and easily accessible.
Cons:
- Performance issues: Can be slow and buggy with large projects.
- Outdated UI: Not as modern or user-friendly as other IDEs.
4. Xamarin
Xamarin allows you to create native Android apps using C#. It’s especially useful for developers already familiar with .NET.
Pros:
- Cross-platform capabilities: Share code across Android, iOS, and Windows.
- Strong community support: Backed by Microsoft, with extensive resources.
Cons:
- Large overhead: App sizes can be larger compared to other tools.
- Paid features: Some advanced features require a paid license.
5. Unity
Unity is widely used for game development but can also be used for creating complex Android apps.
Pros:
- High-performance graphic tools: Ideal for games and interactive apps.
- Cross-platform development: Deploy games on Android, iOS, and more.
Cons:
- Complex: Best suited for developers with experience in game development.
- Expensive: Costly licensing for advanced features.
6. React Native
React Native allows you to build mobile apps using JavaScript and React, making it a good choice for web developers.
Pros:
- Single codebase: Use the same code for Android and iOS.
- Large community: Extensive libraries and third-party plugins.
Cons:
- Performance limitations: Not as fast as fully native apps.
- Complex debugging: Debugging can be more challenging compared to native tools.
7. Flutter
Flutter, by Google, uses the Dart language to produce fast and fluid apps for both Android and iOS.
Pros:
- Hot reload: See changes immediately without rebuilding the entire app.
- High performance: Smooth and fast animations.
Cons:
- Learning curve: Dart is less commonly used, requiring extra learning.
- Limited libraries: Fewer third-party libraries compared to other tools.
8. Appy Pie
Appy Pie is a no-code development platform allowing you to create apps through a visual editor.
Pros:
- No coding required: Great for beginners and non-developers.
- Fast development: Create simple apps quickly.
Cons:
- Limited customization: Not suitable for highly complex apps.
- Subscription model: Requires ongoing payments for full features.
9. PhoneGap
PhoneGap uses HTML, CSS, and JavaScript to build cross-platform mobile apps, making it accessible for web developers.
Pros:
- Cross-platform development: Write once, deploy to multiple platforms.
- Open-source: Free to use with a large community.
Cons:
- Performance issues: Slower performance compared to native apps.
- Limited native functionality: Not all native device features are accessible.
10. B4A (Basic4Android)
B4A (Basic4Android) is a streamlined development environment that focuses solely on Android app development using a BASIC-like language.
Pros:
- Easy to learn: Ideal for those who prefer a simpler syntax.
- Direct access to Android APIs: Full control over app features.
Cons:
- Less popular: Smaller community and fewer resources.
- Limited scalability: Not suitable for very large or complex apps.
Optimizing the Development Process
Optimizing the development process involves managing technical aspects and closely coordinating team efforts. Implementing effective workflows and source control is key to ensuring smooth, efficient app development.
Key Development Phases
Understanding the key phases of the development cycle is crucial for improving efficiency. During planning, clearly outline project goals, technical requirements, and critical milestones. Use project management tools like JIRA or Asana to keep track of tasks.
In the development phase, choose the right tech stack. Tools like Android Studio provide integrated environments for coding, debugging, and running tests. Efficient debugging methods help resolve issues faster and ensure your app runs smoothly.
Testing is vital for identifying bugs before deployment. Automated testing tools like Espresso or Robolectric can be integrated into your workflow to streamline this process. During integration and deployment, ensure that your app works across different environments and devices with continuous integration tools, such as Jenkins or GitHub Actions.
Understanding the Role of Source Control
Source control is essential for managing code changes and collaborating effectively. Platforms like GitHub enable you to track version history, making it easier to pinpoint when changes were made and by whom. This is crucial for debugging and understanding your app’s development history.
Implement branching strategies to allow multiple team members to work on different features or fixes without interfering with each other. Merge changes into the main codebase only when they are fully tested and approved.
Integrations with CI/CD tools can automate the process of testing and deploying code changes. This reduces manual errors and speeds up the development cycle. Additionally, advanced features like pull requests and code reviews can enhance team collaboration and ensure high-quality code.
Ensuring Quality and Performance
Creating a high-quality Android app requires a focus on debugging, testing, performance monitoring, and ensuring strong security measures. These aspects are critical for delivering a smooth and secure user experience.
Best Practices for Debugging and Testing
Effective debugging and testing are key to maintaining app quality. Use Android Studio and its emulator to simulate different devices and configurations, helping you catch issues early. Integrate tools like Espresso for UI testing and Appium for automated testing across multiple platforms.
Automation is crucial. Set up continuous integration with Jenkins or GitHub Actions to automate your testing pipeline. This ensures that your app’s tech stack works seamlessly and errors are caught promptly. Effective debugging and thorough testing ensure a stable app, reducing the risk of crashes and poor user experiences.
Monitoring App Performance
Monitoring app performance helps you understand how your app behaves in real-time, especially under different conditions. Utilize performance monitoring tools such as Android Profiler to track CPU, memory, and network usage. This helps identify bottlenecks that could slow down your app.
Analytics platforms like Firebase can provide insights into user behavior and app crashes. This data is invaluable for spotting trends and making informed improvements. Regular performance monitoring ensures that your app remains responsive and efficient, offering a better experience for your users.
Security Measures for Mobile Apps
Security is paramount in mobile app development. Protect user data by implementing encryption for data storage and transmission. Use Android’s built-in security features like KeyStore for secure key management and SafetyNet for device integrity checks.
Ensure proper authentication and authorization mechanisms. Tools like Firebase Authentication simplify integrating strong login systems. Regularly update your app to patch known vulnerabilities and stay compliant with the latest security practices. Strong security measures protect your users and enhance your app’s trustworthiness.
Maximizing App Reach and Revenue
To maximize your app’s reach and revenue, focus on effective monetization strategies and engaging your users consistently. This way, you can ensure a profitable and sustainable app experience.
Strategies for Monetization
Monetizing your app can take various forms. One effective way is through in-app purchases. These purchases allow users to buy items, upgrades, or subscriptions within the app. This can drive significant revenue without charging users upfront.
Advertising is another popular method. Incorporate banner ads, interstitial ads, or video ads. Choose ad networks like Google AdMob or Unity Ads that fit your app’s audience. Proper ad placement is key to avoiding user frustration.
Freemium models are highly effective. Offer a free version with limited features and a paid version with premium features. Give users a taste of the full app’s potential, encouraging them to upgrade.
Use analytics tools like Firebase or Flurry to track user behavior. Understand how users interact with your app to optimize monetization strategies. Adjust your models based on detailed insights to maximize your revenue.
Focusing on User Engagement and Retention
User engagement is crucial for retaining existing users and attracting new ones. Start with a user-friendly interface. A simple, intuitive design keeps users returning and using your app more frequently.
Push notifications are vital for engagement. Use notifications to inform users about new features, updates, or special offers. Ensure the notifications are timely and relevant to avoid irritating your users.
Offer cross-platform compatibility. Allow users to use your app seamlessly across different devices. This feature increases user satisfaction and retention.
Lastly, focus on customer retention strategies. Regular updates, new features, and responsive customer support keep users engaged. Use in-app analytics to identify potential drop-off points and address them proactively.
Conclusion
Choosing the right mobile app development software is crucial for your success. The tools you select should align with your project’s needs, your technical expertise, and your coding experience.
For developers focused on Android app development, options such as Android Studio offer robust features and official support from Google.
Flutter stands out due to its single codebase for multiple platforms, making your work easier and more efficient.
If you need advanced testing, Headspin excels in performance testing. Meanwhile, Firebase offers comprehensive tools like Crashlytics and ML Kit, beneficial for any app development project.
Jetpack Compose, a relatively new tool from Google, is ideal for those familiar with Kotlin, enabling modern and efficient UI development.
Each software offers different levels of customizability and supports diverse aspects of app development, from initial design to final deployment.
By carefully considering what each tool provides, you can make an informed decision that best suits your development needs.
Frequently Asked Questions
This section addresses common questions about tools for developing Android apps, IDE preferences, coding alternatives, free tools, beginner resources, and version control integration.
What are the top Android app development tools currently available?
Some of the most popular tools for Android app development include Android Studio, Flutter, Xamarin, and Visual Studio Code.
Which IDE is most preferred for Android app development?
Android Studio is the official IDE created by Google for Android app development. It is highly favored due to its comprehensive set of tools for building, testing, and debugging applications.
How can I develop Android apps without prior coding experience?
Tools like Jotform Apps and no-code platforms allow you to create Android apps without coding knowledge. These platforms often come with drag-and-drop interfaces that simplify the development process.
Are there any notable Android app development tools that are free to use?
Both Android Studio and Visual Studio Code are free to use. These tools are open-source and provide robust features that cater to both beginners and experienced developers.
What resources are recommended for beginners in Android app development?
For beginners, you can start with official documentation and tutorials from Google’s Android developer site. Online courses on platforms like Coursera, Udemy, and free coding resources on GitHub can also be beneficial.
Can you suggest any Android app development software that integrates well with version control systems such as Git?
Both Android Studio and Visual Studio Code offer excellent integration with Git. These integrations allow for seamless version control and collaboration.
Tags
-
Starbucks Adding New Staff, Says Machines Alone Won’t Cut It
Starbucks has found that removing human labor in favor of machines doesn’t work for the company — so now the coffee chain is hiring old-fashioned human baristas at thousands of stores.
Starbucks CEO Brian Niccol stated in a call with investors earlier this week that the company’s effort to reduce headcount over the past few years and replace humans with machines had backfired: Advanced machinery proved to be an inadequate substitute for human labor.
“Over the last couple of years, we’ve actually been removing labor from the stores, I think with the hope that equipment could offset the removal of the labor,” Niccol said on the call, per The Guardian. “What we’re finding is that wasn’t an accurate assumption with what played out.”
By the time Niccol joined Starbucks in September 2024, the company had been testing out human staff increases at just a handful of locations. Niccol broadened the effort this year to include 3,000 locations of the coffee chain’s 40,000 stores globally.
Niccol stated that new technology alone doesn’t cut it. Starbucks needed to adequately staff stores and allow employees access to new equipment to deliver a better customer experience.
“Equipment doesn’t solve the customer experience that we need to provide, but rather staffing the stores and deploying with this technology behind it does,” Niccol said on the call.
Niccol noted that increasing staff would entail higher costs but asserted that “some growth” for the company would accompany the move.
Starbucks CEO Brian Niccol. Photo by Kevin Sullivan/Digital First Media/Orange County Register via Getty Images
The move to hire new baristas is part of Niccol’s plan to turn Starbucks around after five consecutive quarters of declining sales. Starbucks reported on Tuesday that same-store sales dropped 1% in the first quarter of 2025, falling short of Wall Street expectations.
Related: It’s Pay-to-Stay at Starbucks As the Coffeehouse Reverses Its Open Door Policy
Niccol reassured investors on the call that though the financial results proved “disappointing,” Starbucks was “really showing a lot of signs of progress” internally. For example, the average time to deliver in-store orders had declined by an average of two minutes during the quarter, he said.
Niccol’s plan to turn around Starbucks includes limiting the number of items customers can order through mobile, adding ceramic mugs for in-store orders, cutting 30% of the menu, writing customers’ names down with Sharpies on their cups, and asking baristas to make orders in under four minutes. Starting May 12, Starbucks will also require baristas to dress uniformly in a solid black top and khaki, black, or blue denim bottoms.
Starbucks operates 16,941 stores in the U.S. and has 211,000 U.S. employees. The company’s stock was down about 11% year-to-date at the time of writing.
-
Apple Intelligence | Kodeco
We understand that circumstances can change, and if you need to withdraw from the bootcamp, your options will vary depending on your billing cycle:
– If you enrolled with a monthly plan, you can cancel your future billing with your membership and you will not be renewed on your next billing date OR you can pause your membership for up to three months, then you can pick up your studies again at that time.
– If you enrolled with a one-time payment, you will be eligible for a full refund within the first 14 days of your enrollment into the bootcamp.
*Please note: if you’ve accessed a significant portion of program materials, this might affect your eligibility for a full refund.
Please email support@kodeco.com for further assistance on the withdrawal process.
-
Deal: This Samsung 70-inch Crystal UHD 4K Smart TV is just $399!
This offer is available from Amazon. The price is hidden until you add the unit to your cart, so make sure to do that and check that the deal is still available first.
Are you looking to get a large TV? No longer do you have to pay thousands for a good one. This one is pretty nice and currently only goes for $399.
The Samsung 70-inch Class DU7200B Crystal UHD 4K Smart TV is pretty huge at 70 inches diagonally. It also has a 4K UHD resolution with a 60Hz refresh rate. Not to mention, it gets some nice enhancements like PurColor and Motion Xcelerator, to make colors more vivid and true to life, as well as avoiding lag and blur. You’ll also get HDR support, Object Tracking Sound Lite, and Q-Symphony.
Of course, this is also a smart TV. It is powered by Tizen. You’ll get access to plenty of streaming apps. This includes Netflix, Amazon Prime Video, Hulu, Disney Plus, Apple TV, and more. You’ll also get access to Samsung TV Plus, which can stream live TV channels for free.
As if streaming both on-demand and live TV wasn’t enough, the Samsung 70-inch Class DU7200B Crystal UHD 4K Smart TV, it even gets access to Samsung’s Gaming Hub. This means you can enjoy your free time playing games without the need for a console. You can access cloud gaming services like Xbox Game Pass, NVIDIA GeForce Now, Amazon Luna, and others.
Quite the deal, right? The Samsung 70-inch Class DU7200B Crystal UHD 4K Smart TV is huge, has a 4K resolution, and a full smart TV experience with all the bells and whistles. Catch this deal while you can!
-
Health Connect Jetpack SDK is now in beta and new feature updates
Posted by Brenda Shaw – Health & Home Partner Engineering Technical Writer
At Google, we are committed to empowering developers as they build exceptional health and fitness experiences. Core to that commitment is Health Connect, an Android platform that allows health and fitness apps to store and share the same on-device data. Android devices running Android 14 or that have the pre-installed APK will automatically have Health Connect by default in Settings. For pre-Android 14 devices, Health Connect is available for download from the Play Store.
We’re excited to announce significant Health Connect updates like the Jetpack SDK Beta, new datatypes and new permissions that will enable richer, more insightful app functionalities.
Jetpack SDK is now in Beta
We are excited to announce the beta release of our Jetback SDK! Since its initial release, we’ve dedicated significant effort to improving data completeness, with a particular focus on enriching the metadata associated with each data point.
In the latest SDK, we’re introducing two key changes designed to ensure richer metadata and unlock new possibilities for you and your users:
Make Recording Method Mandatory
To deliver more accurate and insightful data, the Beta introduces a requirement to specify one of four recording methods when writing data to Health Connect. This ensures increased data clarity, enhanced data analysis and improved user experience:
If your app currently does not set metadata when creating a record:
Before
StepsRecord( count = 888, startTime = START_TIME, endTime = END_TIME, ) // error: metadata is not provided
After
StepsRecord( count = 888, startTime = START_TIME, endTime = END_TIME, metadata = Metadata.manualEntry() )
If your app currently calls Metadata constructor when creating a record:
Before
StepsRecord( count = 888, startTime = START_TIME, endTime = END_TIME, metadata = Metadata( clientRecordId = "client id", recordingMethod = RECORDING_METHOD_MANUAL_ENTRY, ), // error: Metadata constructor not found )
After
StepsRecord( count = 888, startTime = START_TIME, endTime = END_TIME, metadata = Metadata.manualEntry(clientRecordId = "client id"), )
Make Device Type Mandatory
You will be required to specify device type when creating a Device object. A device object will be required for Automatically (RECORDING_METHOD_AUTOMATICALLY_RECORDED) or Actively (RECORDING_METHOD_ACTIVELY_RECORDED) recorded data.
Before
Device() // error: type not provided
After
Device(type = Device.Companion.TYPE_PHONE)
We believe these updates will significantly improve the quality of data within your applications and empower you to create more insightful user experiences. We encourage you to explore the Jetpack SDK Beta and review the updated Metadata page and familiarize yourself with these changes.
New background reads permission
To enable richer, background-driven health and fitness experiences while maintaining user trust, Health Connect now features a dedicated background reads permission.
This permission allows your app to access Health Connect data while running in the background, provided the user grants explicit consent. Users retain full control, with the ability to manage or revoke this permission at any time via Health Connect settings.
Let your app read health data even in the background with the new Background Reads permission. Declare the following permission in your manifest file:
<application> <uses-permission android:name="android.permission.health.READ_HEALTH_DATA_IN_BACKGROUND" /> ... </application>
Use the Feature Availability API to check if the user has the background read feature available, according to the version of Health Connect they have on their devices.
Allow your app to read historic data
By default, when granted read permission, your app can access historical data from other apps for the preceding 30 days from the initial permission grant. To enable access to data beyond this 30-day window, Health Connect introduces the PERMISSION_READ_HEALTH_DATA_HISTORY permission. This allows your app to provide new users with a comprehensive overview of their health and wellness history.
Users are in control of their data with both background reads and history reads. Both capabilities require developers to declare the respective permissions, and users must grant the permission before developers can access their data. Even after granting permission, users have the option of revoking access at any time from Health Connect settings.
Additional data access and types
Health Connect now offers expanded data types, enabling developers to build richer user experiences and provide deeper insights. Check out the following new data types:
- Exercise Routes allows users to share exercise routes with other apps for a seamless synchronized workout. By allowing users to share all routes or one route, their associated exercise activities and maps for their workouts will be synced with the fitness apps of their choice.
- The skin temperature data type measures peripheral body temperature unlocking insights around sleep quality, reproductive health, and the potential onset of illness.
- Health Connect also provides a planned exercise data type to enable training apps to write training plans and workout apps to read training plans. Recorded exercises (workouts) can be read back for personalized performance analysis to help users achieve their training goals. Access granular workout data, including sessions, blocks, and steps, for comprehensive performance analysis and personalized feedback.
These new data types empower developers to create more connected and insightful health and fitness applications, providing users with a holistic view of their well-being.
To learn more about all new APIs and bug fixes, check out the full release notes.
Get started with the Health Connect Jetpack SDK
Whether you are just getting started with Health Connect or are looking to implement the latest features, there are many ways to learn more and have your voice heard.
- Subscribe to our newsletter: Stay up-to-date with the latest news, announcements, and resources from Google Health and Fitness. Subscribe to our Health and Fitness Google Developer Newsletter and get the latest updates delivered straight to your inbox.
- Check out our Health Connect developer guide: The Health and Fitness Developer Center is your one-stop-shop for building health and fitness apps on Android – including a robust guide for getting started with Health Connect.
- Report an issue: Encountered a bug or technical issue? Report it directly to our team through the Issue Tracker so we can investigate and resolve it. You can also request a feature or provide feedback with Issue Tracker.
We can’t wait to see what you create!
-
Building Integrated AI Services with LangChain & LangGraph
While the course is designed to accommodate developers with varying levels of experience, the following prerequisites are recommended:
- Basic programming knowledge in any language
- Familiarity with web development concepts and RESTful APIs
- Understanding of basic AI and machine learning concepts (beneficial but not required)
-
Jetpack WindowManager 1.4 is stable
Posted by Xiaodao Wu – Developer Relations Engineer
Jetpack WindowManager keeps getting better. WindowManager gives you tools to build adaptive apps that work seamlessly across all kinds of large screen devices. Version 1.4, which is stable now, introduces new features that make multi-window experiences even more powerful and flexible. While Jetpack Compose is still the best way to create app layouts for different screen sizes, 1.4 makes some big improvements to activity embedding, including activity stack spinning, pane expansion, and dialog full-screen dim. Multi-activity apps can easily take advantage of all these great features.
WindowManager 1.4 introduces a range of enhancements. Here are some of the highlights.
WindowSizeClass
We’ve updated the WindowSizeClass API to support custom values. We changed the API shape to make it easy and extensible to support custom values and add new values in the future. The high level changes are as follows:
- Opened the constructor to take in minWidthDp and minHeightDp parameters so you can create your own window size classes
- Added convenience methods for checking breakpoint validity
- Deprecated WindowWidthSizeClass and WindowHeightSizeClass in favor of WindowSizeClass#isWidthAtLeastBreakpoint() and WindowSizeClass#isHeightAtLeastBreakpoint() respectively
Here’s a migration example:
// old val sizeClass = WindowSizeClass.compute(widthDp, heightDp) when (sizeClass.widthSizeClass) { COMPACT -> doCompact() MEDIUM -> doMedium() EXPANDED -> doExpanded() else -> doDefault() } // new val sizeClass = WindowSizeClass.BREAKPOINTS_V1 .computeWindowSizeClass(widthDp, heightDp) when { sizeClass.isWidthAtLeastBreakpoint(WIDTH_DP_EXPANDED_LOWER_BOUND) -> { doExpanded() } sizeClass.isWidthAtLeastBreakpoint(WIDTH_DP_MEDIUM_LOWER_BOUND) -> { doMedium() } else -> { doCompact() } }
Some things to note in the new API:
- The order of the when branches should go from largest to smallest to support custom values from developers or new values in the future
- The default branch should be treated as the smallest window size class
Activity embedding
Activity stack pinning
Activity stack pinning provides a way to keep an activity stack always on screen, no matter what else is happening in your app. This new feature lets you pin an activity stack to a specific window, so the top activity stays visible even when the user navigates to other parts of the app in a different window. This is perfect for things like live chats or video players that you want to keep on screen while users explore other content.
private fun pinActivityStackExample(taskId: Int) { val splitAttributes: SplitAttributes = SplitAttributes.Builder() .setSplitType(SplitAttributes.SplitType.ratio(0.66f)) .setLayoutDirection(SplitAttributes.LayoutDirection.LEFT_TO_RIGHT) .build() val pinSplitRule = SplitPinRule.Builder() .setDefaultSplitAttributes(splitAttributes) .build() SplitController.getInstance(applicationContext).pinTopActivityStack(taskId, pinSplitRule) }
Pane expansion
The new pane expansion feature, also known as interactive divider, lets you create a visual separation between two activities in split-screen mode. You can make the pane divider draggable so users can resize the panes – and the activities in the panes – on the fly. This gives users control over how they want to view the app’s content.
val splitAttributesBuilder: SplitAttributes.Builder = SplitAttributes.Builder() .setSplitType(SplitAttributes.SplitType.ratio(0.33f)) .setLayoutDirection(SplitAttributes.LayoutDirection.LEFT_TO_RIGHT) if (WindowSdkExtensions.getInstance().extensionVersion >= 6) { splitAttributesBuilder.setDividerAttributes( DividerAttributes.DraggableDividerAttributes.Builder() .setColor(getColor(context, R.color.divider_color)) .setWidthDp(4) .setDragRange( DividerAttributes.DragRange.DRAG_RANGE_SYSTEM_DEFAULT) .build() ) } val splitAttributes: SplitAttributes = splitAttributesBuilder.build()
Dialog full-screen dim
WindowManager 1.4 gives you more control over how dialogs dim the background. With dialog full-screen dim, you can choose to dim just the container where the dialog appears or the entire task window for a unified UI experience. The entire app window dims by default when a dialog opens (see EmbeddingConfiguration.DimAreaBehavior.ON_TASK).To dim only the container of the activity that opened the dialog, use EmbeddingConfiguration.DimAreaBehavior.ON_ACTIVITY_STACK. This gives you more flexibility in designing dialogs and makes for a smoother, more coherent user experience. Temu is among the first developers to integrate this feature, the full-screen dialog dim has reduced screen invalid touches by about 5%.
Customised shopping cart reminder with dialog full-screen dim in Temu. Enhanced posture support
WindowManager 1.4 makes building apps that work flawlessly on foldables straightforward by providing more information about the physical capabilities of the device. The new WindowInfoTracker#supportedPostures API lets you know if a device supports tabletop mode, so you can optimize your app’s layout and features accordingly.
val currentSdkVersion = WindowSdkExtensions.getInstance().extensionVersion val message = if (currentSdkVersion >= 6) { val supportedPostures = WindowInfoTracker.getOrCreate(LocalContext.current).supportedPostures buildString { append(supportedPostures.isNotEmpty()) if (supportedPostures.isNotEmpty()) { append(" ") append( supportedPostures.joinToString( separator = ",", prefix = "(", postfix = ")")) } } } else { "N/A (WindowSDK version 6 is needed, current version is $currentSdkVersion)" }
Other API changes
WindowManager 1.4 includes several API changes and additions to support the new features. Notable changes include:
- Stable and no longer experimental APIs:
- ActivityEmbeddingController#invalidateVisibleActivityStacks
- ActivityEmbeddingController#getActivityStack
- SplitController#updateSplitAttributes
- API added to set activity embedding animation background:
- SplitAttributes.Builder#setAnimationParams
- API to get updated WindowMetrics information:
- ActivityEmbeddingController#embeddedActivityWindowInfo
- API to finish all activities in an activity stack:
- ActivityEmbeddingController#finishActivityStack
How to get started
To start using Jetpack WindowManager 1.4 in your Android projects, update your app dependencies in build.gradle.kts to the latest stable version:
dependencies { implementation("androidx.window:window:1.4.0-rc01") ... // or, if you're using the WindowManager testing library: testImplementation("androidx.window:window-testing:1.4.0-rc01") }
Happy coding!