Giter Club home page Giter Club logo

miracast-sample's Introduction

Miracast Sample

Test application of Android using Presentation class which displays something on the remote display like a TV over Miracast technology.

Demo

Demo image

Install this apk to the Nexus4 and display a simple text "Hello world,โ€ฆ" to the remote display which is connected the Miracast receiver(PTV3000 /firmware 2.2.2).

Digest

How to get displays

DisplayManger handles all displays including the local display.

mDisplayManager = (DisplayManager)getSystemService(Context.DISPLAY_SERVICE);

You can get all displays via DisplayManager.

Display[] displays = mDisplayManager.getDisplays();

Show the remote display

Super easy to show something on the remote display. Just call show() method which is implemented in Presentation class provided by Android SDKr17.

private void showPresentation(Display display) {
    RemotePresentation presentation = new RemotePresentation(this, display);
    presentation.show();
}

RemotePresentation class is extended Presentation. Presentation class looks like Activity. You can set up the display overriding the onCreate method.

private final class RemotePresentation extends Presentation {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.remote_display);
    }
}

This demo apk shows only TextView on the remote display. The layout resource is remote_display.xml.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:textSize="22sp"
        android:textStyle="bold"
        android:text="@string/hello_world" />

</RelativeLayout>

How to setup the miracast environment

Test Enviroinment

Nexus4: Currently only Nexus4 supports the Miracast(27 Dec. 2012).

PTV3000: I've tested this apk with PTV3000.

Nexus4

Turn on the "Wireless Display" on the Settings.

Wireless Display

You can find wireless displays and tap an item to connect.

Connecting the wireless display

PTV3000

Check the firmware version. I bought this gadget from Amazon.com and the version is 1.0.13. TOO LOW!! This version does not support Miracast. You need to update the firmware in 2 steps.

STEP1: Download the latest firmware which is on Internet. I could find the version 2.2.2. This might not be official, I guess.

STEP2: Update the firmware. See the Installation Guide (PDF)

miracast-sample's People

Contributors

adamrocker avatar

Watchers

James Cloos avatar Akbar Syed avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.