Everything About Bluetooth (淺談藍牙 4.0) - Peripheral 篇Johnny Sung
2016.01.22 @ Android Taipei
講解 Bluetooth 的 GATT 的概念,並以 Android 實作
Example code:
Peripheral - BLE CPU Temp
https://github.com/j796160836/Ble-CPUTemp-Android
Central - BLE Temperature Receiver
https://github.com/j796160836/BleTemperatureReceiver-Android
Demystifying Android's Bluetooth Low Energy at MCE^3 ConfPawel Urban
Presentation by Paweł Urban & Dariusz Seweryn.
Programming with a hardware in mind is fun. IoT is no longer a future but it's around us and Bluetooth programming became our reality. We'll tell you how to play with it without having a headache, using reactive concepts.
MCE^3 - Dariusz Seweryn, Paweł Urban - Demystifying Android's Bluetooth Low ...PROIDEA
Programming with a hardware in mind is fun. IoT is no longer a future but it's around us and Bluetooth programming became our reality. We'll tell you how to play with it without having a headache, using reactive concepts.
Systems and methods for visual presentation and selection of ivr menuTal Lavian Ph.D.
Embodiments of the invention provide a system for generating an Interactive Voice Response (IVR) database, the system comprising a processor and a memory coupled to the processor. The memory comprising a list of telephone numbers associated with one or more destinations implementing IVR menus, wherein the one or more destinations are grouped based on a plurality of categories of the IVR menus. Further the memory includes instructions executable by said processor for automatically communicating with the one of more destinations, and receiving at least one customization record from said at least one destination to store in the IVR database.
https://www.google.com/patents/US20130022183?dq=US+20130022183&hl=en&sa=X&ei=WbZXVJWvCI2iugScpYKYAg&ved=0CB8Q6AEwAA
Systems and methods for electronic communicationsTal Lavian Ph.D.
Embodiments of the invention provide a system for enhancing user interaction with objects connected to a network. The system includes a processor, a display screen, a memory coupled to the processor. The memory comprises a database including a list of two or more objects and instructions executable by the processor to display a menu. The menu is associated with at least two independent objects. And the two independent objects are produced by two independent vendors.
https://www.google.com/patents/US20130080898?dq=US+20130080898&hl=en&sa=X&ei=M7ZXVNbEH9GGuASY54CgAg&ved=0CB8Q6AEwAA
Everything About Bluetooth (淺談藍牙 4.0) - Peripheral 篇Johnny Sung
2016.01.22 @ Android Taipei
講解 Bluetooth 的 GATT 的概念,並以 Android 實作
Example code:
Peripheral - BLE CPU Temp
https://github.com/j796160836/Ble-CPUTemp-Android
Central - BLE Temperature Receiver
https://github.com/j796160836/BleTemperatureReceiver-Android
Demystifying Android's Bluetooth Low Energy at MCE^3 ConfPawel Urban
Presentation by Paweł Urban & Dariusz Seweryn.
Programming with a hardware in mind is fun. IoT is no longer a future but it's around us and Bluetooth programming became our reality. We'll tell you how to play with it without having a headache, using reactive concepts.
MCE^3 - Dariusz Seweryn, Paweł Urban - Demystifying Android's Bluetooth Low ...PROIDEA
Programming with a hardware in mind is fun. IoT is no longer a future but it's around us and Bluetooth programming became our reality. We'll tell you how to play with it without having a headache, using reactive concepts.
Systems and methods for visual presentation and selection of ivr menuTal Lavian Ph.D.
Embodiments of the invention provide a system for generating an Interactive Voice Response (IVR) database, the system comprising a processor and a memory coupled to the processor. The memory comprising a list of telephone numbers associated with one or more destinations implementing IVR menus, wherein the one or more destinations are grouped based on a plurality of categories of the IVR menus. Further the memory includes instructions executable by said processor for automatically communicating with the one of more destinations, and receiving at least one customization record from said at least one destination to store in the IVR database.
https://www.google.com/patents/US20130022183?dq=US+20130022183&hl=en&sa=X&ei=WbZXVJWvCI2iugScpYKYAg&ved=0CB8Q6AEwAA
Systems and methods for electronic communicationsTal Lavian Ph.D.
Embodiments of the invention provide a system for enhancing user interaction with objects connected to a network. The system includes a processor, a display screen, a memory coupled to the processor. The memory comprises a database including a list of two or more objects and instructions executable by the processor to display a menu. The menu is associated with at least two independent objects. And the two independent objects are produced by two independent vendors.
https://www.google.com/patents/US20130080898?dq=US+20130080898&hl=en&sa=X&ei=M7ZXVNbEH9GGuASY54CgAg&ved=0CB8Q6AEwAA
It's not about dagger. It's about putting your source code to an Android binary. Yes the compiled dex code! During the presentation I will show in steps how to inject aar to apk without having original source code nor resources.
How One Article Changed the Way we Create our Product RoadmapNick Peasant
The deck was presented to the whole Old St Labs team on how we are going to start to change the way we build out our product roadmap and how we can leverage the knowledge in the company and our users.
A big thank you to @tconrad for his article here - http://bit.ly/1JiUFep that inspired the whole presentation. We used all of his thoughts and made them work in our current process.
Google's I/O 2016 annual developer conference is scheduled to kick off in San Francisco on 18 May, with a main keynote that begins at 10am PST. Here are all the keynotes that has been expected from Google’s big event.
Agenda for the Google’s Big Event
• Android N
• Chrome OS
• Android Wear
• Android Auto
• Virtual reality or “Andriod VR”
• Self-driving Cars
• Project Ara
• Project Tango
• Project Fi
• Smarthome
These are some of the questions this PPT will answer for you:
1. Google I/O 2016: What events are scheduled?
2. What all to Expect from the Google's big Event?
IMPLEMENTING VOICE CONTROL WITH THE ANDROID MEDIA SESSION API ON AMAZON FIRE ...Amazon Appstore Developers
The powerful combination of voice and Amazon Fire TV allows your customers to use speech to interact with their living room environment and enjoy a new level of convenience. In this workshop, we’ll see how you can use the Android Media Session API to enable voice control on media streaming apps on Fire TV.
In this workshop you will learn:
· How to integrate Android MediaSession API in your app
· How your customers can play, pause, skip forward, or rewind content with their voice on Amazon Fire TV
· How to quickly build a voice-enabled, high quality media streaming app using the Amazon Fire App Builder (FAB)
It's not about dagger. It's about putting your source code to an Android binary. Yes the compiled dex code! During the presentation I will show in steps how to inject aar to apk without having original source code nor resources.
How One Article Changed the Way we Create our Product RoadmapNick Peasant
The deck was presented to the whole Old St Labs team on how we are going to start to change the way we build out our product roadmap and how we can leverage the knowledge in the company and our users.
A big thank you to @tconrad for his article here - http://bit.ly/1JiUFep that inspired the whole presentation. We used all of his thoughts and made them work in our current process.
Google's I/O 2016 annual developer conference is scheduled to kick off in San Francisco on 18 May, with a main keynote that begins at 10am PST. Here are all the keynotes that has been expected from Google’s big event.
Agenda for the Google’s Big Event
• Android N
• Chrome OS
• Android Wear
• Android Auto
• Virtual reality or “Andriod VR”
• Self-driving Cars
• Project Ara
• Project Tango
• Project Fi
• Smarthome
These are some of the questions this PPT will answer for you:
1. Google I/O 2016: What events are scheduled?
2. What all to Expect from the Google's big Event?
IMPLEMENTING VOICE CONTROL WITH THE ANDROID MEDIA SESSION API ON AMAZON FIRE ...Amazon Appstore Developers
The powerful combination of voice and Amazon Fire TV allows your customers to use speech to interact with their living room environment and enjoy a new level of convenience. In this workshop, we’ll see how you can use the Android Media Session API to enable voice control on media streaming apps on Fire TV.
In this workshop you will learn:
· How to integrate Android MediaSession API in your app
· How your customers can play, pause, skip forward, or rewind content with their voice on Amazon Fire TV
· How to quickly build a voice-enabled, high quality media streaming app using the Amazon Fire App Builder (FAB)
CocoaConf Chicago 2017: Media Frameworks and Swift: This Is FineChris Adamson
Swift is great for writing iOS and Mac apps, and its creators also mean for it to be used as a systems programming language. However, certain traits about Swift make it officially off-limits for use in some audio/video-processing scenarios. What's the deal, is it not fast enough or what? We'll look at what media apps can and can't do in Swift, and what you're supposed to do instead. We'll also look at strategies for knowing what responsibilities to dole out to Swift and to C, and how to make those parts of your code play nicely with each other.
(This is a longer version of a talk previously presented at Forward Swift 2017)
The new build mechanism replacing Ant for Android development is based on Gradle, the popular build tool from the Groovy ecosystem. Ken Kousen introduces you to Gradle for Android developers and shows how easy it is to integrate Gradle into Android projects. We’ll show the latest version of the Android Studio IDE to develop applications. Join Ken to discuss using the Android plugin for Gradle; adding dependencies and alternate repositories; creating custom tasks; implementing both unit and integration tests; using alternative build types, product flavors, and variants; and more. Leave with an appreciation and understanding of Gradle and how to use it in your development environment.
Minicurso sobre desenvolvimento de aplicações com android. Passo a passo do desenvolvimento de uma App de TODO. Utilizando Android Studio. CRUD + Banco de dados (SQLite)
與 Sign in with Apple 的愛恨情仇 @ iPlayground2020Johnny Sung
注重用戶隱私的 Apple 在開發者大會 WWDC 2019 發表了 Sign in with Apple 的功能,iOS 13 後皆支援。今年(2020 年) 4 月之後強制要求所有新上架的 App(包含更新)皆要支援這個服務。
Sign in with Apple 怎麼接?跟其他第三方服務有什麼不同?
App 端、網站前端、後端要如何因應?會有什麼樣的雷?
讓我來跟你娓娓到來...
#iPlayground2020
Speaker: Young Fang, Johnny Sung
---
How visually impaired people use their phone?
How mobile developer fix their problems they encountered?
Here is the small tips for that.
Everything About Bluetooth (淺談藍牙 4.0) - Central 篇Johnny Sung
講解 Bluetooth 的 GATT 的概念,並以 Android 實作
Example code:
Peripheral - BLE CPU Temp
https://github.com/j796160836/Ble-CPUTemp-Android
Central - BLE Temperature Receiver
https://github.com/j796160836/BleTemperatureReceiver-Android
uPresenter, new way to control keynote.
Wear on your Glass or Smart Watch, and have a nice presentation.
---
Available on Google Play
https://play.google.com/store/apps/details?id=com.johnnyworks.presenter
Android workshop - 02. Glass development 101Johnny Sung
Glass development 101
All example sources are in Github:
Example 00: Hello, World
https://github.com/j796160836/GlassWorkshop-Exercise00_HelloWorld
Example 01: New Hello, World
https://github.com/j796160836/GlassWorkshop-Exercise01_NewHelloWorld
Example 02: MyVoiceCommand
https://github.com/j796160836/GlassWorkshop-Exercise02_MyVoiceCommand
Example 03: UseCardBuilder
https://github.com/j796160836/GlassWorkshop-Exercise03_CardBuilder
Android workshop - 01. Getting started on android phoneJohnny Sung
All example sources are in Github:
Example 00: Hello, World
https://github.com/j796160836/PetStar-Exercise00_HelloWorld
Example 01: Show pet’s name
https://github.com/j796160836/PetStar-Exercise01_PetsName
Example 02: Pet’s name card
https://github.com/j796160836/PetStar-Exercise02_PetsNameCard
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
I have heard many times that architecture is not important for the front-end. Also, many times I have seen how developers implement features on the front-end just following the standard rules for a framework and think that this is enough to successfully launch the project, and then the project fails. How to prevent this and what approach to choose? I have launched dozens of complex projects and during the talk we will analyze which approaches have worked for me and which have not.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
17. ***The Android Auto app is currently available in the following countries:
Ecuador
France
Germany
Guatemala
India
Ireland
Italy
Mexico
New Zealand
Panama
Argentina
Australia
Austria
Bolivia
Brazil
Canada
Chile
Colombia
Costa Rica
Dominican Republic
Paraguay
Peru
Puerto Rico
Russia
Spain
Switzerland
United Kingdom
United States
Uruguay
Venezuela
https://www.android.com/auto/
19. EMULATOR SETUP
1. Install Auto Desktop Head Unit emulator from
the SDK Manager
2. Install Android Auto app on phone
A. Tapping the Android Auto toolbar title 10
times to enable developer mode
B. Select Start head unit server from the
Android Auto menu.
20. 1. Install Auto Desktop Head Unit emulator from the
SDK Manager
35. Create MediaBrowserService
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public class MyMediaBrowserService extends MediaBrowserService {
@Nullable
@Override
public BrowserRoot onGetRoot(String packageName, int uid, Bundle root) {
return new BrowserRoot(Const.MEDIA_ID_ROOT, null);
}
@Override
public void onLoadChildren(String parentId,
Result<List<MediaBrowser.MediaItem>> result) {
// ...
}
}
MyMediaBrowserService.java
(3/3)
36. Working with MediaSession
public class MyMediaBrowserService extends MediaBrowserService {
private MediaSession mSession;
@Override
public void onCreate() {
super.onCreate();
mSession = new MediaSession(this, "MyMediaBrowserService");
setSessionToken(mSession.getSessionToken());
mSession.setCallback(new MediaSessionCallback());
mSession.setFlags(MediaSession.FLAG_HANDLES_MEDIA_BUTTONS |
MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS);
}
@Override
public void onDestroy() {
mSession.release();
}
private final class MediaSessionCallback extends MediaSession.Callback {
// ...
}
}
MyMediaBrowserService.java
37. private final class MediaSessionCallback extends MediaSession.Callback {
@Override
public void onPlay() {
}
@Override
public void onPause() {
}
@Override
public void onStop() {
}
@Override
public void onSeekTo(long position) {
}
@Override
public void onSkipToNext() {
}
@Override
public void onSkipToPrevious() {
}
// ...
}
38. private final class MediaSessionCallback extends MediaSession.Callback {
// ...
@Override
public void onPlayFromMediaId(String mediaId, Bundle extras) {
}
@Override
public void onSkipToQueueItem(long queueId) {
}
@Override
public void onCustomAction(String action, Bundle extras) {
}
@Override
public void onPlayFromSearch(final String query, final Bundle extras) {
}
}
39. Validate caller package
@Override
public BrowserRoot onGetRoot(String packageName, int uid, Bundle rootHints) {
LogHelper.d(TAG, "OnGetRoot: clientPackageName=" + packageName,
"; clientUid=" + uid + " ; rootHints=", rootHints);
// To ensure you are not allowing any arbitrary app to browse your app's
contents, you need to check the origin:
if (!mPackageValidator.isCallerAllowed(this, packageName, uid)) {
// If the request comes from an untrusted package, return null.
LogHelper.w(TAG, "OnGetRoot: IGNORING request from untrusted package "
+ packageName);
return null;
}
return new BrowserRoot(Const.MEDIA_ID_ROOT, null);
}
MyMediaBrowserService.java
40. Create Sliding Menus
@Override
public void onLoadChildren(final String pId, final Result<List<MediaItem>> result) {
List<MediaItem> mediaItems = new ArrayList<>();
if ("__ROOT__".equals(pId)) {
mediaItems.add(new MediaItem(
new MediaDescription.Builder()
.setMediaId(Const.MEDIA_ID_ITEM1)
.setTitle("Item 01")
.setSubtitle("Some descriptions")
.setIconUri(Uri.parse(
"android.resource://my.package.name/drawable/icon"))
.build(), MediaItem.FLAG_BROWSABLE
));
mediaItems.add(new MediaItem(
new MediaDescription.Builder()
.setMediaId(Const.MEDIA_ID_ITEM2)
.setTitle("Item 02")
.setIconUri(Uri.parse(
"android.resource://my.package.name/drawable/icon"))
.build(), MediaItem.FLAG_PLAYABLE
));
result.sendResult(mediaItems);
}
}
MyMediaBrowserService.java
(1/2)
41. Create Sliding Menus
private final class MediaSessionCallback extends MediaSession.Callback {
@Override
public void onPlayFromMediaId(String mediaId, Bundle extras) {
if (Const.MEDIA_ID_ITEM2.equals(mediaId)) {
// ...
// Play media
// ...
}
}
// ...
}
MyMediaBrowserService.java
(2/2)
42.
43. Create Sliding Menus (Async)
@Override
public void onLoadChildren(final String parentMediaId, final
Result<List<MediaItem>> result) {
result.detach();
mMusicProvider.retrieveMediaAsync(new MusicProvider.Callback() {
@Override
public void onMusicCatalogReady() {
List<MediaItem> mediaItems = new ArrayList<>();
// ...
// Prepare to create items
// ...
result.sendResult(mediaItems);
}
});
}
MyMediaBrowserService.java
44. Setting Playback State
PlaybackState.Builder stateBuilder = new PlaybackState.Builder();
int playbackState = PlaybackState.STATE_PLAYING;
long action = PlaybackState.ACTION_PAUSE;
action |= PlaybackState.ACTION_SKIP_TO_NEXT;
action |= PlaybackState.ACTION_SKIP_TO_PREVIOUS;
stateBuilder.setActions(action);
stateBuilder.setState(playbackState, -1, 1.0f);
mSession.setPlaybackState(stateBuilder.build());
MediaMetadata.Builder metaBuilder = new MediaMetadata.Builder();
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
metaBuilder.putBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART, bitmap);
metaBuilder.putString(MediaMetadata.METADATA_KEY_ARTIST, "Great Artist");
metaBuilder.putString(MediaMetadata.METADATA_KEY_TITLE, "Song 1");
mSession.setMetadata(metaBuilder.build());
mSession.setActive(true);
MyMediaBrowserService.java
45.
46. Show Error Message
PlaybackState.Builder stateBuilder = new PlaybackState.Builder();
int playbackState = PlaybackState.STATE_ERROR;
stateBuilder.setState(playbackState, -1, 1.0f);
stateBuilder.setErrorMessage("Oh no! Something has gone wrong.");
mSession.setPlaybackState(stateBuilder.build());
MyMediaBrowserService.java
47. Playing Queue
ArrayList<MediaMetadata> mediaMetadatas = new ArrayList<>();
for (int i = 0; i < 5; i++) {
String coverUrl = "android.resource://my.package.name/drawable/icon";
MediaMetadata.Builder builder = new MediaMetadata.Builder();
builder.putString(MediaMetadata.METADATA_KEY_ALBUM_ART_URI, coverUrl);
builder.putString(MediaMetadata.METADATA_KEY_ARTIST, "Great artist");
builder.putString(MediaMetadata.METADATA_KEY_TITLE, "Song " + (i + 1));
MediaMetadata metadata = builder.build();
mediaMetadatas.add(metadata);
}
MyMediaBrowserService.java
(1/2)
48. Playing Queue
List<MediaSession.QueueItem> queue = convertToQueue(mediaMetadatas);
mSession.setQueue(queue);
mSession.setQueueTitle("Now Playing");
private static List<MediaSession.QueueItem> convertToQueue(
Iterable<MediaMetadata> tracks) {
List<MediaSession.QueueItem> queue = new ArrayList<>();
int count = 0;
for (MediaMetadata track : tracks) {
String hierarchyAwareMediaID = "";
MediaMetadata trackCopy = new MediaMetadata.Builder(track)
.putString(MediaMetadata.METADATA_KEY_MEDIA_ID, hierarchyAwareMediaID)
.build();
MediaSession.QueueItem item = new MediaSession.QueueItem(
trackCopy.getDescription(), count++);
queue.add(item);
}
return queue;
}
MyMediaBrowserService.java
(2/2)
62. MessageReadReceiver
public class MessageReadReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
int conversationId = intent.getIntExtra(Const.CONVERSATION_ID, -1);
if (conversationId != -1) {
// Actions with conversation was read
}
}
}
MessageReadReceiver.java
63. MessageReplyReceiver
public class MessageReplyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (Const.REPLY_ACTION.equals(intent.getAction())) {
int conversationId = intent.getIntExtra(Const.CONVERSATION_ID, -1);
Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
CharSequence reply = "";
if (remoteInput != null) {
reply = remoteInput.getCharSequence(
Const.EXTRA_REMOTE_REPLY);
}
if (conversationId != -1) {
// Actions for receive reply message
}
}
}
}
MessageReplyReceiver.java
64. Prepare PendingIntent
int conversationId = 1;
String name = "Johnny";
String message = "Hello, World!";
// A pending Intent for reads
Intent readIntent = new Intent()
.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
.setAction(Const.READ_ACTION)
.putExtra(Const.CONVERSATION_ID, conversationId);
PendingIntent readPendingIntent = PendingIntent.getBroadcast(this,
conversationId,
readIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
MainActivity.java
(1/2)
65. Prepare PendingIntent
// Build a RemoteInput for receiving voice input in a Car Notification
RemoteInput remoteInput = new RemoteInput.Builder(Const.EXTRA_REMOTE_REPLY)
.setLabel(getString(R.string.reply))
.build();
// Building a Pending Intent for the reply action to trigger
Intent replyIntent = new Intent()
.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
.setAction(Const.REPLY_ACTION)
.putExtra(Const.CONVERSATION_ID, conversationId);
PendingIntent replyPendingIntent = PendingIntent.getBroadcast(this,
conversationId,
replyIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
MainActivity.java
(2/2)
66. Build CarExtender & UnreadConversion
// Create the UnreadConversation and populate it with the participant name,
// read and reply intents.
NotificationCompat.CarExtender.UnreadConversation.Builder unreadConvBuilder =
new NotificationCompat.CarExtender.UnreadConversation.Builder(name)
.setLatestTimestamp(System.currentTimeMillis())
.setReadPendingIntent(readPendingIntent)
.setReplyAction(replyPendingIntent, remoteInput)
.addMessage(message);
NotificationCompat.CarExtender carExtender =
new NotificationCompat.CarExtender()
.setUnreadConversation(unreadConvBuilder.build());
MainActivity.java
67. Make a Notification
NotificationCompat.Action replyAction =
new NotificationCompat.Action.Builder(
R.drawable.icon, getString(R.string.reply), replyPendingIntent)
.addRemoteInput(remoteInput)
.build();
NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.icon)
.setLargeIcon(BitmapFactory.decodeResource(
getResources(), R.drawable.icon_big))
.setContentText(message)
.setWhen(System.currentTimeMillis())
.setContentTitle(name)
.setContentIntent(readPendingIntent)
.extend(carExtender)
.addAction(replyAction);
NotificationManagerCompat manager = NotificationManagerCompat.from(this);
manager.notify(conversationId, builder.build());
MainActivity.java