The document discusses how to implement Google Cast into Android apps. It covers connecting an Android app to a Cast receiver app, launching the Cast app, and interacting with the Cast app. It provides code examples for initializing the Cast SDK, adding callbacks to handle Cast device selection and deselection, and starting discovery of Cast devices.
Eddystone Beacons - Physical Web - Giving a URL to All ObjectsJeff Prestes
More mobile technologies are empowering people and machines to become more autonomous. In the same way as people, machines need ways to be identified to other sources in a connected environment. This begs the question, why not give a URL to objects? With Eddystone, a new Google specification for Beacon data, this is possible, and it works with both Android and iOS based devices.
With it you can implement what physical-web.org stands
With the introduction of the iPhone 6s and the iPhone 6s Plus, Apple added 3D Touch, a new dimension to the multi-touch user interface. This new technology senses how deeply users press the display and provides a new way to interact with the iPhone.
In iOS 9, Apple introduced several 3D Touch APIs. In this session I will explain in a practical way what is 3D Touch and how you can benefit from it in your app. I will cover home screen quick actions, peek and pop actions and also how to use the force properties of a UITouch event.
Eddystone Beacons - Physical Web - Giving a URL to All ObjectsJeff Prestes
More mobile technologies are empowering people and machines to become more autonomous. In the same way as people, machines need ways to be identified to other sources in a connected environment. This begs the question, why not give a URL to objects? With Eddystone, a new Google specification for Beacon data, this is possible, and it works with both Android and iOS based devices.
With it you can implement what physical-web.org stands
With the introduction of the iPhone 6s and the iPhone 6s Plus, Apple added 3D Touch, a new dimension to the multi-touch user interface. This new technology senses how deeply users press the display and provides a new way to interact with the iPhone.
In iOS 9, Apple introduced several 3D Touch APIs. In this session I will explain in a practical way what is 3D Touch and how you can benefit from it in your app. I will cover home screen quick actions, peek and pop actions and also how to use the force properties of a UITouch event.
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.
Improving android experience for both users and developersPavel Lahoda
Android UI and User Experience has changed dramatically in the recent version(s) and while users generally enjoy the new features, there are still several areas that are left to application-level-DIY-patterns. For developers, this is double challenge, they want to provide users with the bleeding edge UI patterns and at the same time, they have to deal with evolving API, that sometimes changes dramatically.
Presentation covers the gotchas developer might face dealing with ever-moving Android API, and how to utilize Java language and the tools it have to make the experience for developer more pleasant. Typical trends in the API will get analyzed and divided into several areas or "patterns", discussing typical scenarios how these components are designed and implemented.
This talk will propose several such UI patterns, that will compete to become "de facto" standards and details on the implementation, including possible impact on existing API as we have both end users and developers in mind.
The list of patterns/areas discussed in the talk include following :
ActionBar
ListView
TimePicker
KineticGestureComponent
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Ontico
РИТ++ 2017, Frontend Сonf
Зал Мумбаи, 5 июня, 13:00
Тезисы:
http://frontendconf.ru/2017/abstracts/2470.html
Паразитизм — форма взаимоотношений между организмами различных видов, из которых один (паразит — aka Angular 4+) использует другого (хозяина — aka React) в качестве среды обитания и источника питания, нанося ему вред, но при этом не убивая.
Паразитоид — организм, который проводит значительную часть своей жизни (в личиночной стадии), проживая на или внутри своего единственного хозяина, которого он постепенно убивает в процессе.
...
Is your web app drowning in a sea of JavaScript? Has your client-side codebase grown from "a snippet here and there" to "more JavaScript than HTML"? Do you find yourself writing one-off snippets instead of generalized components? You're not the only one. Learn about a handful of strategies you can use to keep your JavaScript codebase lean, modular, and flexible. We'll cover all the major pain points — MVC, templates, persisting state, namespacing, graceful error handling, client/server communication, and separation of concerns. And we'll cover how to do all this incrementally so that you don't have to redo everything from scratch.
Google Cast for iOS and Android using XamarinPeter Major
The slides for the presentation that I gave at the London Mobile Developers meetup on Aug 26, 2015.
Accompanying code is on github at:
https://github.com/petermajor/JustPete.CastReceiver
https://github.com/petermajor/JustPete.Mobile
My personal blog is: https://www.committedcoder.com
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.
Improving android experience for both users and developersPavel Lahoda
Android UI and User Experience has changed dramatically in the recent version(s) and while users generally enjoy the new features, there are still several areas that are left to application-level-DIY-patterns. For developers, this is double challenge, they want to provide users with the bleeding edge UI patterns and at the same time, they have to deal with evolving API, that sometimes changes dramatically.
Presentation covers the gotchas developer might face dealing with ever-moving Android API, and how to utilize Java language and the tools it have to make the experience for developer more pleasant. Typical trends in the API will get analyzed and divided into several areas or "patterns", discussing typical scenarios how these components are designed and implemented.
This talk will propose several such UI patterns, that will compete to become "de facto" standards and details on the implementation, including possible impact on existing API as we have both end users and developers in mind.
The list of patterns/areas discussed in the talk include following :
ActionBar
ListView
TimePicker
KineticGestureComponent
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Ontico
РИТ++ 2017, Frontend Сonf
Зал Мумбаи, 5 июня, 13:00
Тезисы:
http://frontendconf.ru/2017/abstracts/2470.html
Паразитизм — форма взаимоотношений между организмами различных видов, из которых один (паразит — aka Angular 4+) использует другого (хозяина — aka React) в качестве среды обитания и источника питания, нанося ему вред, но при этом не убивая.
Паразитоид — организм, который проводит значительную часть своей жизни (в личиночной стадии), проживая на или внутри своего единственного хозяина, которого он постепенно убивает в процессе.
...
Is your web app drowning in a sea of JavaScript? Has your client-side codebase grown from "a snippet here and there" to "more JavaScript than HTML"? Do you find yourself writing one-off snippets instead of generalized components? You're not the only one. Learn about a handful of strategies you can use to keep your JavaScript codebase lean, modular, and flexible. We'll cover all the major pain points — MVC, templates, persisting state, namespacing, graceful error handling, client/server communication, and separation of concerns. And we'll cover how to do all this incrementally so that you don't have to redo everything from scratch.
Google Cast for iOS and Android using XamarinPeter Major
The slides for the presentation that I gave at the London Mobile Developers meetup on Aug 26, 2015.
Accompanying code is on github at:
https://github.com/petermajor/JustPete.CastReceiver
https://github.com/petermajor/JustPete.Mobile
My personal blog is: https://www.committedcoder.com
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)
Android Workshop for NTU. A getting started guide to android application development.
UPDATE (Oct 2013): An updated slide at http://samwize.com/2013/10/13/android-workshop-2013/
Android accessibility for developers and QATed Drake
This presentation was developed for Intuit's Bangalore Accessibility Week. It borrows heavily from the presentations given by the Google Accessibility Team at Google IO and provides additional resources on functionality.
Android TV: Building apps with Google’s Leanback LibraryJoe Birch
In this class, we'll look at how we can create Android TV apps with the help of Google's leanback library. After a brief introduction to the TV platform and an open-source Vine TV app, we'll move straight into how you can begin building applications for yourself using the leanback library, following best practices along the way. We'll take a look at the different components that are provided by the framework and how you can craft custom components of your own to enhance your application's UX. Seeing as Android TV applications are completely testable, we'll also take a brief look at how this can be done to ensure your app functions as expected!
Design Patterns for Tablets and SmartphonesMichael Galpin
This is a talk I gave at AnDevCon. It talks about ways to take advantage of features introduced in Android 3.0 to create more modular and better looking apps.
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...Ted Chien
My study group slide in 2009 for Google Android Development, describing the following topics:
Designing the Obvious,
Resources and Internationalization,
Orientation,
Adapter,
Android is an open source and Linux-based Operating System for mobile devices such as smartphones and tablet computers.
Android offers a unified approach to application development for mobile devices which means developers need only develop for Android, and their applications should be able to run on different devices powered by Android.
Multiple companies producing Android phones like Samsung, HTC, LG, Motorola,LAVA and many others.
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Democratizing Fuzzing at Scale by Abhishek Aryaabh.arya
Presented at NUS: Fuzzing and Software Security Summer School 2024
This keynote talks about the democratization of fuzzing at scale, highlighting the collaboration between open source communities, academia, and industry to advance the field of fuzzing. It delves into the history of fuzzing, the development of scalable fuzzing platforms, and the empowerment of community-driven research. The talk will further discuss recent advancements leveraging AI/ML and offer insights into the future evolution of the fuzzing landscape.
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSEDuvanRamosGarzon1
AIRCRAFT GENERAL
The Single Aisle is the most advanced family aircraft in service today, with fly-by-wire flight controls.
The A318, A319, A320 and A321 are twin-engine subsonic medium range aircraft.
The family offers a choice of engines
Courier management system project report.pdfKamal Acharya
It is now-a-days very important for the people to send or receive articles like imported furniture, electronic items, gifts, business goods and the like. People depend vastly on different transport systems which mostly use the manual way of receiving and delivering the articles. There is no way to track the articles till they are received and there is no way to let the customer know what happened in transit, once he booked some articles. In such a situation, we need a system which completely computerizes the cargo activities including time to time tracking of the articles sent. This need is fulfilled by Courier Management System software which is online software for the cargo management people that enables them to receive the goods from a source and send them to a required destination and track their status from time to time.
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...Amil Baba Dawood bangali
Contact with Dawood Bhai Just call on +92322-6382012 and we'll help you. We'll solve all your problems within 12 to 24 hours and with 101% guarantee and with astrology systematic. If you want to take any personal or professional advice then also you can call us on +92322-6382012 , ONLINE LOVE PROBLEM & Other all types of Daily Life Problem's.Then CALL or WHATSAPP us on +92322-6382012 and Get all these problems solutions here by Amil Baba DAWOOD BANGALI
#vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore#blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #blackmagicforlove #blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #Amilbabainuk #amilbabainspain #amilbabaindubai #Amilbabainnorway #amilbabainkrachi #amilbabainlahore #amilbabaingujranwalan #amilbabainislamabad
Water scarcity is the lack of fresh water resources to meet the standard water demand. There are two type of water scarcity. One is physical. The other is economic water scarcity.
Event Management System Vb Net Project Report.pdfKamal Acharya
In present era, the scopes of information technology growing with a very fast .We do not see any are untouched from this industry. The scope of information technology has become wider includes: Business and industry. Household Business, Communication, Education, Entertainment, Science, Medicine, Engineering, Distance Learning, Weather Forecasting. Carrier Searching and so on.
My project named “Event Management System” is software that store and maintained all events coordinated in college. It also helpful to print related reports. My project will help to record the events coordinated by faculties with their Name, Event subject, date & details in an efficient & effective ways.
In my system we have to make a system by which a user can record all events coordinated by a particular faculty. In our proposed system some more featured are added which differs it from the existing system such as security.
Quality defects in TMT Bars, Possible causes and Potential Solutions.PrashantGoswami42
Maintaining high-quality standards in the production of TMT bars is crucial for ensuring structural integrity in construction. Addressing common defects through careful monitoring, standardized processes, and advanced technology can significantly improve the quality of TMT bars. Continuous training and adherence to quality control measures will also play a pivotal role in minimizing these defects.
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfKamal Acharya
The College Bus Management system is completely developed by Visual Basic .NET Version. The application is connect with most secured database language MS SQL Server. The application is develop by using best combination of front-end and back-end languages. The application is totally design like flat user interface. This flat user interface is more attractive user interface in 2017. The application is gives more important to the system functionality. The application is to manage the student’s details, driver’s details, bus details, bus route details, bus fees details and more. The application has only one unit for admin. The admin can manage the entire application. The admin can login into the application by using username and password of the admin. The application is develop for big and small colleges. It is more user friendly for non-computer person. Even they can easily learn how to manage the application within hours. The application is more secure by the admin. The system will give an effective output for the VB.Net and SQL Server given as input to the system. The compiled java program given as input to the system, after scanning the program will generate different reports. The application generates the report for users. The admin can view and download the report of the data. The application deliver the excel format reports. Because, excel formatted reports is very easy to understand the income and expense of the college bus. This application is mainly develop for windows operating system users. In 2017, 73% of people enterprises are using windows operating system. So the application will easily install for all the windows operating system users. The application-developed size is very low. The application consumes very low space in disk. Therefore, the user can allocate very minimum local disk space for this application.
1. Google Cast with Android
How to Implement Google Cast into Android Apps
+Angelo Rüggeberg
@s3xy4ngyc
2. agenda
- Introduction to Google Cast
- Connecting an Android App to an
Cast App
- Launching the Cast App
- Interacting with the Cast App
- using the CastCompanionLibrary
for Media
32. Environment:
● Real Device
○ with Google Play Services
Installed
● Cast Device
○ e.g. Chromecast
Prequesites
Dependencies:
play-services-cast
Handles Connection to Cast
'com.google.android.gms:play-services-cast:8.3.0'
support-media-router
Button to Connect to Cast
'com.android.support:mediarouter-v7:23.1.0'
41. Fields - MainActivity.java
private MediaRouteButton mMediaRouteButton;
private MediaRouter mMediaRouter;
private MediaRouteSelector mMediaRouteSelector;
private MediaRouter.Callback mMediaRouterCallback;
private CastDevice mSelectedDevice;
The Button added To the Layout
42. Fields - MainActivity.java
private MediaRouteButton mMediaRouteButton;
private MediaRouter mMediaRouter;
private MediaRouteSelector mMediaRouteSelector;
private MediaRouter.Callback mMediaRouterCallback;
private CastDevice mSelectedDevice;
The Media Router.
This handles the Connection to our Cast Device
43. Fields - MainActivity.java
private MediaRouteButton mMediaRouteButton;
private MediaRouter mMediaRouter;
private MediaRouteSelector mMediaRouteSelector;
private MediaRouter.Callback mMediaRouterCallback;
private CastDevice mSelectedDevice;
The Route Selector.
This is the Configuration for our Connection
e.g the Device to Interact with
44. Fields - MainActivity.java
private MediaRouteButton mMediaRouteButton;
private MediaRouter mMediaRouter;
private MediaRouteSelector mMediaRouteSelector;
private MediaRouter.Callback mMediaRouterCallback;
private CastDevice mSelectedDevice;
The Router Callbacks.
These Callbacks are used to Notify the
Application on Select and Deselction of an
Device Route and enables us to react to
these events e.g by printing the Connected
Device to the User.
45. Fields - MainActivity.java
private MediaRouteButton mMediaRouteButton;
private MediaRouter mMediaRouter;
private MediaRouteSelector mMediaRouteSelector;
private MediaRouter.Callback mMediaRouterCallback;
private CastDevice mSelectedDevice;
The Cast Device we are Connected to.
It contains Informations like Device Name,
Model, Capabilities, etc.
53. Initializing - MainActivity.java
private void initCast() {
// Configure Cast device discovery
mMediaRouter = MediaRouter.getInstance(getApplicationContext());
mMediaRouteSelector = new MediaRouteSelector.Builder()
.addControlCategory(CastMediaControlIntent.categoryForCast(getResources()
.getString(R.string.app_id)))
.build();
// Set the MediaRouteButton selector for device discovery.
mMediaRouteButton.setRouteSelector(mMediaRouteSelector);
}
54. Initializing - MainActivity.java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);
MediaRouteActionProvider mediaRouteActionProvider
= (MediaRouteActionProvider) MenuItemCompat
.getActionProvider(mediaRouteMenuItem);
// Set the MediaRouteActionProvider selector for device discovery.
mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector);
return true;
}
55. Initializing - MainActivity.java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);
MediaRouteActionProvider mediaRouteActionProvider
= (MediaRouteActionProvider) MenuItemCompat
.getActionProvider(mediaRouteMenuItem);
// Set the MediaRouteActionProvider selector for device discovery.
mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector);
return true;
}
56. Initializing - MainActivity.java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);
MediaRouteActionProvider mediaRouteActionProvider
= (MediaRouteActionProvider) MenuItemCompat
.getActionProvider(mediaRouteMenuItem);
// Set the MediaRouteActionProvider selector for device discovery.
mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector);
return true;
}
57. Initializing - MainActivity.java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);
MediaRouteActionProvider mediaRouteActionProvider
= (MediaRouteActionProvider) MenuItemCompat
.getActionProvider(mediaRouteMenuItem);
// Set the MediaRouteActionProvider selector for device discovery.
mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector);
return true;
}
58. Adding Callbacks - MainActivity.java
private void initCast() {
// Configure Cast device discovery
mMediaRouter = MediaRouter.getInstance(getApplicationContext());
mMediaRouteSelector = new MediaRouteSelector.Builder()
.addControlCategory(CastMediaControlIntent.categoryForCast(getResources()
.getString(R.string.app_id)))
.build();
// Set the MediaRouteButton selector for device discovery.
mMediaRouteButton.setRouteSelector(mMediaRouteSelector);
mMediaRouterCallback = new MyMediaRouterCallback();
}
59. Adding Callbacks - MainActivity.java
private class MyMediaRouterCallback extends MediaRouter.Callback {
@Override
public void onRouteSelected(MediaRouter router, MediaRouter.RouteInfo info) {
// Handle the user route selection.
mSelectedDevice = CastDevice.getFromBundle(info.getExtras());
mConnectionStatus.setText("Connected to: " + mSelectedDevice.getFriendlyName());
}
@Override
public void onRouteUnselected(MediaRouter router, MediaRouter.RouteInfo info) {
mSelectedDevice = null;
mConnectionStatus.setText("Not Connected");
}
}
60. Adding Callbacks - MainActivity.java
private class MyMediaRouterCallback extends MediaRouter.Callback {
@Override
public void onRouteSelected(MediaRouter router, MediaRouter.RouteInfo info) {
// Handle the user route selection.
mSelectedDevice = CastDevice.getFromBundle(info.getExtras());
mConnectionStatus.setText("Connected to: " + mSelectedDevice.getFriendlyName());
}
@Override
public void onRouteUnselected(MediaRouter router, MediaRouter.RouteInfo info) {
mSelectedDevice = null;
mConnectionStatus.setText("Not Connected");
}
}
61. Adding Callbacks - MainActivity.java
private class MyMediaRouterCallback extends MediaRouter.Callback {
@Override
public void onRouteSelected(MediaRouter router, MediaRouter.RouteInfo info) {
// Handle the user route selection.
mSelectedDevice = CastDevice.getFromBundle(info.getExtras());
mConnectionStatus.setText("Connected to: " + mSelectedDevice.getFriendlyName());
}
@Override
public void onRouteUnselected(MediaRouter router, MediaRouter.RouteInfo info) {
mSelectedDevice = null;
mConnectionStatus.setText("Not Connected");
}
}
Called after we Selected an
Cast Device we want to
Connect with.
This does not mean we are
Connected to the Cast
Application yet!
62. Adding Callbacks - MainActivity.java
private class MyMediaRouterCallback extends MediaRouter.Callback {
@Override
public void onRouteSelected(MediaRouter router, MediaRouter.RouteInfo info) {
// Handle the user route selection.
mSelectedDevice = CastDevice.getFromBundle(info.getExtras());
mConnectionStatus.setText("Connected to: " + mSelectedDevice.getFriendlyName());
}
@Override
public void onRouteUnselected(MediaRouter router, MediaRouter.RouteInfo info) {
mSelectedDevice = null;
mConnectionStatus.setText("Not Connected");
}
}
Called after we Decided to
Disconnect from an Cast
Device.
This does not mean we are
Disconnected from the
Application yet!
63. Adding Callbacks - MainActivity.java
private class MyMediaRouterCallback extends MediaRouter.Callback {
@Override
public void onRouteSelected(MediaRouter router, MediaRouter.RouteInfo info) {
// Handle the user route selection.
mSelectedDevice = CastDevice.getFromBundle(info.getExtras());
mConnectionStatus.setText("Connected to: " + mSelectedDevice.getFriendlyName());
}
@Override
public void onRouteUnselected(MediaRouter router, MediaRouter.RouteInfo info) {
mSelectedDevice = null;
mConnectionStatus.setText("Not Connected");
}
}
64. Adding Callbacks - MainActivity.java
private class MyMediaRouterCallback extends MediaRouter.Callback {
@Override
public void onRouteSelected(MediaRouter router, MediaRouter.RouteInfo info) {
// Handle the user route selection.
mSelectedDevice = CastDevice.getFromBundle(info.getExtras());
mConnectionStatus.setText("Connected to: " + mSelectedDevice.getFriendlyName());
}
@Override
public void onRouteUnselected(MediaRouter router, MediaRouter.RouteInfo info) {
mSelectedDevice = null;
mConnectionStatus.setText("Not Connected");
}
}
65. Adding Callbacks - MainActivity.java
private class MyMediaRouterCallback extends MediaRouter.Callback {
@Override
public void onRouteSelected(MediaRouter router, MediaRouter.RouteInfo info) {
// Handle the user route selection.
mSelectedDevice = CastDevice.getFromBundle(info.getExtras());
mConnectionStatus.setText("Connected to: " + mSelectedDevice.getFriendlyName());
}
@Override
public void onRouteUnselected(MediaRouter router, MediaRouter.RouteInfo info) {
mSelectedDevice = null;
mConnectionStatus.setText("Not Connected");
}
}
72. New Fields - MainActivity.java
private GoogleApiClient mApiClient;
private Cast.Listener mCastListener;
private ConnectionCallbacks mConnectionCallbacks;
private ConnectionFailedListener mConnectionFailedListener;
private boolean mApplicationStarted;
private boolean mWaitingForReconnect;
private String mSessionId;
The Api Client is used to Interact with The Chromecast
e.g. Sending Messages
73. New Fields - MainActivity.java
private GoogleApiClient mApiClient;
private Cast.Listener mCastListener;
private ConnectionCallbacks mConnectionCallbacks;
private ConnectionFailedListener mConnectionFailedListener;
private boolean mApplicationStarted;
private boolean mWaitingForReconnect;
private String mSessionId;
Our Callbacks to Notify us about Connection Events
e.g. disconnection
74. New Fields - MainActivity.java
private GoogleApiClient mApiClient;
private Cast.Listener mCastListener;
private ConnectionCallbacks mConnectionCallbacks;
private ConnectionFailedListener mConnectionFailedListener;
private boolean mApplicationStarted;
private boolean mWaitingForReconnect;
private String mSessionId;
The Connection Callbacks.
e.G. we get disconnected due to application
errors
76. New Fields - MainActivity.java
private GoogleApiClient mApiClient;
private Cast.Listener mCastListener;
private ConnectionCallbacks mConnectionCallbacks;
private ConnectionFailedListener mConnectionFailedListener;
private boolean mApplicationStarted;
private boolean mWaitingForReconnect;
private String mSessionId;
We keep Some Information for our
Application stored in these Fields
77. Launching the Cast Application - MainActivity.java
private void launchReceiver() {
mCastListener = new Cast.Listener() {
@Override
public void onApplicationDisconnected(int errorCode) {
Log.d(TAG, "application has stopped");
teardown(true);
}
};
}
78. Launching the Cast Application - MainActivity.java
private void launchReceiver() {
mCastListener = new Cast.Listener() { … };
mConnectionCallbacks = new ConnectionCallbacks();
mConnectionFailedListener = new ConnectionFailedListener();
}
79. Launching the Cast Application - MainActivity.java
private void launchReceiver() {
mCastListener = new Cast.Listener() { … };
mConnectionCallbacks = new ConnectionCallbacks();
mConnectionFailedListener = new ConnectionFailedListener();
Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions
.builder(mSelectedDevice, mCastListener);
}
80. Launching the Cast Application - MainActivity.java
private void launchReceiver() {
mCastListener = new Cast.Listener() { … };
mConnectionCallbacks = new ConnectionCallbacks();
mConnectionFailedListener = new ConnectionFailedListener();
Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions
.builder(mSelectedDevice, mCastListener);
}
81. Launching the Cast Application - MainActivity.java
private void launchReceiver() {
mCastListener = new Cast.Listener() { … };
mConnectionCallbacks = new ConnectionCallbacks();
mConnectionFailedListener = new ConnectionFailedListener();
Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions
.builder(mSelectedDevice, mCastListener);
mApiClient = new GoogleApiClient.Builder(this)
.addApi(Cast.API, apiOptionsBuilder.build())
.addConnectionCallbacks(mConnectionCallbacks)
.addOnConnectionFailedListener(mConnectionFailedListener)
.build();
}
82. Launching the Cast Application - MainActivity.java
private void launchReceiver() {
mCastListener = new Cast.Listener() { … };
mConnectionCallbacks = new ConnectionCallbacks();
mConnectionFailedListener = new ConnectionFailedListener();
Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions
.builder(mSelectedDevice, mCastListener);
mApiClient = new GoogleApiClient.Builder(this)
.addApi(Cast.API, apiOptionsBuilder.build())
.addConnectionCallbacks(mConnectionCallbacks)
.addOnConnectionFailedListener(mConnectionFailedListener)
.build();
}
83. Launching the Cast Application - MainActivity.java
private void launchReceiver() {
mCastListener = new Cast.Listener() { … };
mConnectionCallbacks = new ConnectionCallbacks();
mConnectionFailedListener = new ConnectionFailedListener();
Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions
.builder(mSelectedDevice, mCastListener);
mApiClient = new GoogleApiClient.Builder(this)
.addApi(Cast.API, apiOptionsBuilder.build())
.addConnectionCallbacks(mConnectionCallbacks)
.addOnConnectionFailedListener(mConnectionFailedListener)
.build();
}
84. Launching the Cast Application - MainActivity.java
private void launchReceiver() {
mCastListener = new Cast.Listener() { … };
mConnectionCallbacks = new ConnectionCallbacks();
mConnectionFailedListener = new ConnectionFailedListener();
Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions
.builder(mSelectedDevice, mCastListener);
mApiClient = new GoogleApiClient.Builder(this)
.addApi(Cast.API, apiOptionsBuilder.build())
.addConnectionCallbacks(mConnectionCallbacks)
.addOnConnectionFailedListener(mConnectionFailedListener)
.build();
mApiClient.connect();
}
85. Launching the Cast Application - MainActivity.java
private class ConnectionCallbacks implements GoogleApiClient.ConnectionCallbacks {
@Override
public void onConnected(Bundle connectionHint) {
...
// Launch the receiver app
Cast.CastApi.launchApplication(mApiClient, getString(R.string.app_id), false)
.setResultCallback(
new ResultCallback<Cast.ApplicationConnectionResult>() {
@Override
public void onResult(Cast.ApplicationConnectionResult result) {
…
}
}
86. Launching the Cast Application - MainActivity.java
private class ConnectionCallbacks implements GoogleApiClient.ConnectionCallbacks {
@Override
public void onConnected(Bundle connectionHint) {
...
// Launch the receiver app
Cast.CastApi.launchApplication(mApiClient, getString(R.string.app_id), false)
.setResultCallback(
new ResultCallback<Cast.ApplicationConnectionResult>() {
@Override
public void onResult(Cast.ApplicationConnectionResult result) {
…
}
}
87. Launching the Cast Application - MainActivity.java
Status status = result.getStatus();
if (status.isSuccess()) {
ApplicationMetadata applicationMetadata = result .getApplicationMetadata();
mSessionId = result.getSessionId();
mApplicationStarted = true;
} else {
Log.e(TAG, "application could not launch");
teardown(true);
}
88. Launching the Cast Application - MainActivity.java
Status status = result.getStatus();
if (status.isSuccess()) {
ApplicationMetadata applicationMetadata = result .getApplicationMetadata();
mSessionId = result.getSessionId();
mApplicationStarted = true;
} else {
Log.e(TAG, "application could not launch");
teardown(true);
}
89. Launching the Cast Application - MainActivity.java
Status status = result.getStatus();
if (status.isSuccess()) {
ApplicationMetadata applicationMetadata = result .getApplicationMetadata();
mSessionId = result.getSessionId();
mApplicationStarted = true;
} else {
Log.e(TAG, "application could not launch");
teardown(true);
}
90. Launching the Cast Application - MainActivity.java
Status status = result.getStatus();
if (status.isSuccess()) {
ApplicationMetadata applicationMetadata = result .getApplicationMetadata();
mSessionId = result.getSessionId();
mApplicationStarted = true;
} else {
Log.e(TAG, "application could not launch");
teardown(true);
}
97. Sending Messages - MainActivity.java
class HelloWorldChannel implements Cast.MessageReceivedCallback {
public String getNamespace() {
return getString(R.string.namespace);
}
@Override
public void onMessageReceived(CastDevice castDevice, String namespace,
String message) {
}
}
98. Sending Messages - MainActivity.java
class HelloWorldChannel implements Cast.MessageReceivedCallback {
public String getNamespace() {
return getString(R.string.namespace);
}
@Override
public void onMessageReceived(CastDevice castDevice, String namespace,
String message) {
}
}
99. Sending Messages - MainActivity.java
class HelloWorldChannel implements Cast.MessageReceivedCallback {
public String getNamespace() {
return getString(R.string.namespace);
}
@Override
public void onMessageReceived(CastDevice castDevice, String namespace,
String message) {
}
}
Our Custom Namespace. This is defined in our
reciever app.
e.g. urn:x-cast:com.google.cast.sample.helloworld
100. Sending Messages - MainActivity.java
class HelloWorldChannel implements Cast.MessageReceivedCallback {
public String getNamespace() {
return getString(R.string.namespace);
}
@Override
public void onMessageReceived(CastDevice castDevice, String namespace,
String message) {
}
}
This gets Triggered when the Reciever Sends Data
To our Client.
e.g. Updated Scores on Games
113. Wrap up
● Initialize via MediaRouter
● Select Device via MediaRouteSelector
● Connect via GoogleApiClient
● Setup Message Bus
● Send Messages via CastApi through ApiClient
124. Cast Companion - MainActivity.java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
mCastManager.addMediaRouterButton(menu, R.id.media_route_menu_item);
return true;
}
125. Cast Companion - MainActivity.java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
mCastManager.addMediaRouterButton(menu, R.id.media_route_menu_item);
return true;
}