寻找与Android Miracast的连接 [英] Finding Miracast connections with Android

查看:1349
本文介绍了寻找与Android Miracast的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个Android应用程序,扫描本地Miracast的连接,并连接到他们自动镜像屏幕。我也想保存之前用户已经连接到连接,并给他们昵称,以便用户可以识别它们更容易的能力。我没有很难与Android开发的经验,但我有多年的Java和其他语言的经验。

I am trying to build an Android app that scans for local Miracast connections and connects to them to mirror the screen automatically. I also want the ability to save connections that the user has already connected to before and give them nicknames so the user can recognize them easier. I don't have hardly any experience with Android development, but I have years of experience with Java and other languages.

现在,这个问题我已经是我的ListView返回一个空指针异常,当我尝试设置适配器在我MainActivity的OnCreate方法。

Right now, the problem I have is my ListView returns a null pointer exception when I try to set the Adapter in the OnCreate method of my MainActivity.

MainActivity.java

import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Collection;

import android.app.Fragment;
import android.app.Presentation;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.hardware.display.DisplayManager;
import android.media.MediaRouter;
import android.net.NetworkInfo;
import android.net.wifi.WpsInfo;
import android.net.wifi.p2p.WifiP2pConfig;
import android.net.wifi.p2p.WifiP2pDevice;
import android.net.wifi.p2p.WifiP2pDeviceList;
import android.net.wifi.p2p.WifiP2pGroup;
import android.net.wifi.p2p.WifiP2pInfo;
import android.net.wifi.p2p.WifiP2pManager;
import android.net.wifi.p2p.WifiP2pManager.ActionListener;
import android.net.wifi.p2p.WifiP2pManager.Channel;
import android.net.wifi.p2p.WifiP2pManager.ChannelListener;
import android.net.wifi.p2p.WifiP2pManager.GroupInfoListener;
import android.net.wifi.p2p.WifiP2pManager.PeerListListener;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends FragmentActivity implements OnSharedPreferenceChangeListener{

public static final String TAG = "MainActivity";
private MediaRouter mMediaRouter;
private WifiP2pManager wifimngr; 
protected Channel channel;
private boolean paused = false;
private boolean connected = false;
private boolean scanning = false;
protected boolean isWifiEnabled;
protected boolean onCharge;
protected boolean onAlways;
protected MyBroadcastReceiver receiver;
protected ArrayList<WifiP2pDevice> connectionList;
protected int listsize;
private DisplayManager mDisplayManager;
protected ConnectionAdapter adapter;
protected ArrayList<WifiP2pDevice> devices;
private final IntentFilter intentFilter = new IntentFilter();

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    connectionList = new ArrayList<WifiP2pDevice>();
    adapter = new ConnectionAdapter(this, devices);
    ListView listview = (ListView) findViewById(R.id.list);
    listview.setAdapter(adapter);

    //Connection newCon = new Connection("My address", "My nickname", false);
    //adapter.add(newCon);
    //newCon = new Connection("My address2", "My nickname2", true);
    //adapter.add(newCon);

    //  Indicates a change in the Wi-Fi P2P status.
    intentFilter.addAction(WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION);

    // Indicates a change in the list of available peers.
    intentFilter.addAction(WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION);

    // Indicates the state of Wi-Fi P2P connectivity has changed.
    intentFilter.addAction(WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION);

    // Indicates this device's details have changed.
    intentFilter.addAction(WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION);


    mDisplayManager = (DisplayManager)this.getSystemService(Context.DISPLAY_SERVICE);
    if (savedInstanceState == null) {
        getFragmentManager().beginTransaction()
                .add(R.id.container, new PlaceholderFragment())
                .commit();
    }

    wifimngr = (WifiP2pManager)getSystemService(Context.WIFI_P2P_SERVICE);
    channel  = wifimngr.initialize(this, getMainLooper(), new ChannelListener() {
        public void onChannelDisconnected() {
            channel = null;
        }
    });

}

PeerListListener myPeerListListener =
           new PeerListListener() {
                @Override
                public void onPeersAvailable(WifiP2pDeviceList peerList) {

                    // Out with the old, in with the new.
                    devices.clear();
                    devices.addAll(peerList.getDeviceList());

                    // If an AdapterView is backed by this data, notify it
                    // of the change.  For instance, if you have a ListView of available
                    // peers, trigger an update.
                    //((ConnectionAdapter) getListAdapter()).notifyDataSetChanged();
                    if (devices.size() == 0) {
                        Log.d("TAG", "No devices found");
                        return;
                    }
                }

        };

@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);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        openSettings();
        return true;
    }
    return super.onOptionsItemSelected(item);
}

/**
 * A placeholder fragment containing a simple view.
 */
public static class PlaceholderFragment extends Fragment {

    public PlaceholderFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_main, container, false);
        return rootView;
    }
}

public void updateStatus(String input)
{
    TextView edit = (TextView) findViewById(R.id.statusText);
    edit.setText(input);
}

//What happens when the pause button is clicked
public void pauseConnections(View view)
{
    if(!paused)
    {
        updateStatus("Streaming");
        mMediaRouter = (MediaRouter) this.getSystemService(Context.MEDIA_ROUTER_SERVICE);

         MediaRouter.RouteInfo route = mMediaRouter.getSelectedRoute(mMediaRouter.ROUTE_TYPE_LIVE_VIDEO);
         if (route != null) {
             Display presentationDisplay = route.getPresentationDisplay();
             if (presentationDisplay != null) {
                 Presentation presentation = new Presentation(this, presentationDisplay, 0);
                 presentation.show();
             }
         }
        ProgressBar pg = (ProgressBar) findViewById(R.id.progressBar1);
        pg.setVisibility(View.VISIBLE);
        Button edit = (Button) findViewById(R.id.pauseButton);
        edit.setText("Pause");
        edit = (Button) findViewById(R.id.scanbutton);
        edit.setEnabled(false);
    }else
    {
        updateStatus("Paused");


         MediaRouter.RouteInfo route = mMediaRouter.getSelectedRoute(mMediaRouter.ROUTE_TYPE_LIVE_VIDEO);
         if (route != null) {
             Display presentationDisplay = route.getPresentationDisplay();
             if (presentationDisplay != null) {
                 Presentation presentation = new Presentation(this, presentationDisplay, 0);
                 presentation.show();
             }
         }
        ProgressBar pg = (ProgressBar) findViewById(R.id.progressBar1);
        pg.setVisibility(View.INVISIBLE);
        Button edit = (Button) findViewById(R.id.pauseButton);
        edit.setText("Stream");
        edit = (Button) findViewById(R.id.scanbutton);
        edit.setEnabled(true);
    }
    paused=!paused;


}

//What happens when the scan button is clicked
public void scanConnections(View view)
{

    if(!scanning)
    {

        updateStatus("Scanning...");
        ProgressBar pg = (ProgressBar) findViewById(R.id.progressBar1);
        pg.setVisibility(View.VISIBLE);
        wifimngr.setMiracastMode(1);
        wifimngr.discoverPeers(channel, new WifiP2pManager.ActionListener() {

            @Override
            public void onSuccess() {

            }

            @Override
            public void onFailure(int reason) {
                if(reason == 1)
                {
                    updateStatus("Failed to get devices. Device not supported");

                }else if(reason == 2)
                {
                    updateStatus("Failed to get devices. Busy");
                }else
                {
                    updateStatus("Failed to get devices. Error");
                }
                ProgressBar pg = (ProgressBar) findViewById(R.id.progressBar1);
                pg.setVisibility(View.INVISIBLE);
                Button edit = (Button) findViewById(R.id.scanbutton);
                edit.setText("Scan");
                edit = (Button) findViewById(R.id.pauseButton);
                edit.setEnabled(true);
                scanning=!scanning;

            }
        });

        Button edit = (Button) findViewById(R.id.scanbutton);
        edit.setText("Stop");
        edit = (Button) findViewById(R.id.pauseButton);
        edit.setEnabled(false);
    }else
    {

        ProgressBar pg = (ProgressBar) findViewById(R.id.progressBar1);
        pg.setVisibility(View.INVISIBLE);
        wifimngr.removeGroup(channel, new WifiP2pManager.ActionListener() {

            @Override
            public void onSuccess() {


            }

            @Override
            public void onFailure(int reason) {
                if(reason == 1)
                {
                    updateStatus("Failed to disconnect. Device not supported");

                }else if(reason == 2)
                {
                    updateStatus("Failed to disconnect. Busy");
                }else
                {
                    updateStatus("Failed to disconnect. Error");
                }
                ProgressBar pg = (ProgressBar) findViewById(R.id.progressBar1);
                pg.setVisibility(View.INVISIBLE);

            }
        });         

        updateStatus("Waiting");
        Button edit = (Button) findViewById(R.id.scanbutton);
        edit.setText("Scan");
        edit = (Button) findViewById(R.id.pauseButton);
        edit.setEnabled(true);
    }
    scanning=!scanning;
}

public void openSettings()
{
    Intent intent = new Intent(this, SettingsActivity.class);
    intent.putExtra("onCharge", onCharge);
    intent.putExtra("onAlways", onAlways);
    startActivity(intent);

}

public void onCheckboxClicked(View view)
{
    boolean checked = ((CheckBox) view).isChecked();

}

public void onConnectionClick(View view)
{
    DialogFragment dialog = new ConnDialogFragment();
    dialog.show(getSupportFragmentManager(), "NoticeDialogFragment");

}

public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
        String key) {
        if (key.equals("pref_onCharge")) {

            // Set summary to be the user-description for the selected value
            onCharge = sharedPreferences.getBoolean(key, true);
        }else if (key.equals("pref_onAlways")) {

            // Set summary to be the user-description for the selected value
            onAlways = sharedPreferences.getBoolean(key, false);
        }else if(key.equals("pref_listsize"))
        {
            listsize = sharedPreferences.getInt(key, 0);
        }
    }

private void onPeersChanged(Intent intent)
{
    wifimngr.requestPeers(channel, myPeerListListener);
}

private void onConnectionChanged(Intent intent) {
    WifiP2pInfo p2pInfo = intent.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_INFO);
    NetworkInfo netInfo = intent.getParcelableExtra(WifiP2pManager.EXTRA_NETWORK_INFO);
    if (netInfo.isConnected()) 
    {
        updateInfos();
        useNetwork(p2pInfo);
    } else 
    {
        //resetInfos();
    }
}


public void connect() {
    // Picking the first device found on the network.
    WifiP2pDevice device = devices.get(0);

    WifiP2pConfig config = new WifiP2pConfig();
    config.deviceAddress = device.deviceAddress;
    config.wps.setup = WpsInfo.PBC;

    wifimngr.connect(channel, config, new ActionListener() {

        @Override
        public void onSuccess() {
            // WiFiDirectBroadcastReceiver will notify us. Ignore for now.
        }

        @Override
        public void onFailure(int reason) {
            Toast.makeText(MainActivity.this, "Connect failed. Retry.",
                    Toast.LENGTH_SHORT).show();
        }
    });
}


public void onConnectionInfoAvailable(final WifiP2pInfo info) {

    // InetAddress from WifiP2pInfo struct.
    InetAddress groupOwnerAddress = info.groupOwnerAddress;

    // After the group negotiation, we can determine the group owner.
    if (info.groupFormed && info.isGroupOwner) {
        // Do whatever tasks are specific to the group owner.
        // One common case is creating a server thread and accepting
        // incoming connections.
    } else if (info.groupFormed) {
        // The other device acts as the client. In this case,
        // you'll want to create a client thread that connects to the group
        // owner.
    }
}


private void updateInfos() {
    wifimngr.requestGroupInfo(channel,
       new GroupInfoListener() {
        @Override
        public void onGroupInfoAvailable(WifiP2pGroup group)
       {
            String name = group.getNetworkName();
            String passphrase = group.getPassphrase();
            Collection<WifiP2pDevice> devices = group.getClientList();
                    // do stuff with devices
                    // but ... No way to get their IP addresses :(
        }
    });
}

private void useNetwork(WifiP2pInfo p2pInfo) {
    if (!p2pInfo.isGroupOwner) {
        InetAddress addr  = p2pInfo.groupOwnerAddress;
        try
        {
            Socket s  = new Socket(addr, 1234);
        }catch(IOException e)
        {
            e.printStackTrace();
        }

         //use the socket
    } else {
        try{
             //groupOwnerAddress is our local address
             ServerSocket serverSocket = new ServerSocket(1234);
            Socket s  = serverSocket.accept();
            }catch(IOException e)
            {
                e.printStackTrace();
            }
         //use the socket
    }
}

private void connect(WifiP2pDevice device) {
    WifiP2pConfig config = new WifiP2pConfig();
    config.deviceAddress = device.deviceAddress;
    config.wps.setup = WpsInfo.PBC; // choose between what is available on the device.
    wifimngr.connect(channel, config, new WifiP2pManager.ActionListener() {

        @Override
        public void onSuccess() {

        }

        @Override
        public void onFailure(int reason) {


        }
    });
}

protected void setIsWifiP2pEnabled(boolean isEnabled)
{
    isWifiEnabled = isEnabled;
}

/** register the BroadcastReceiver with the intent values to be matched */
@Override
public void onResume() {
    super.onResume();
    receiver = new MyBroadcastReceiver(wifimngr, channel, this);
    registerReceiver(receiver, intentFilter);
}

@Override
public void onPause() {
    super.onPause();
    unregisterReceiver(receiver);
}


}

ConnectionAdapter.java

    import java.util.ArrayList;

    import android.content.Context;
    import android.net.wifi.p2p.WifiP2pDevice;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.ArrayAdapter;
    import android.widget.TextView;

    public class ConnectionAdapter extends ArrayAdapter<WifiP2pDevice> {

    public ConnectionAdapter(Context context, ArrayList<WifiP2pDevice> connections)
    {
        super(context, R.layout.connection, connections);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
       // Get the data item for this position
        WifiP2pDevice con = getItem(position);    
       // Check if an existing view is being reused, otherwise inflate the view
       ViewHolder viewHolder; 

       if (convertView == null) {
          viewHolder = new ViewHolder();
          LayoutInflater inflater = LayoutInflater.from(getContext());
          convertView = inflater.inflate(R.layout.connection, parent, false);
          viewHolder.name = (TextView) convertView.findViewById(R.id.conName);
          viewHolder.nickname = (TextView) convertView.findViewById(R.id.conNickname);
          convertView.setTag(viewHolder);
       }else {
           viewHolder = (ViewHolder) convertView.getTag();
       }

       // Populate the data into the template view using the data object
       viewHolder.name.setText(con.deviceName);
       viewHolder.nickname.setText(con.primaryDeviceType);
       // Return the completed view to render on screen
       return convertView;
    }

     private static class ViewHolder {
            TextView name;
            TextView nickname;
        }
    }


**BroadcastReceiver.java**


    import android.content.BroadcastReceiver;
    import android.content.Context;
    import android.content.Intent;
    import android.net.NetworkInfo;
    import android.net.wifi.p2p.WifiP2pDevice;
    import android.net.wifi.p2p.WifiP2pManager;
    import android.net.wifi.p2p.WifiP2pManager.Channel;
    import android.net.wifi.p2p.WifiP2pManager.PeerListListener;
    import android.util.Log;

    public class MyBroadcastReceiver extends BroadcastReceiver{

    protected WifiP2pManager wifimngr;
    protected Channel channel;
    protected MainActivity activity;

    public MyBroadcastReceiver(WifiP2pManager iwifimngr, Channel ichannel, MainActivity iactivity)
    {
        super();
        wifimngr=iwifimngr;
        channel=ichannel;
        activity=iactivity;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION.equals(action)) {
            // Determine if Wifi P2P mode is enabled or not, alert
            // the Activity.
            int state = intent.getIntExtra(WifiP2pManager.EXTRA_WIFI_STATE, -1);
            if (state == WifiP2pManager.WIFI_P2P_STATE_ENABLED) {
                activity.setIsWifiP2pEnabled(true);
            } else {
                activity.setIsWifiP2pEnabled(false);
            }
        } else if (WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION.equals(action)) {

            // Request available peers from the wifi p2p manager. This is an
            // asynchronous call and the calling activity is notified with a
            // callback on PeerListListener.onPeersAvailable()
            if (wifimngr != null) {
                wifimngr.requestPeers(channel, (PeerListListener) activity.getFragmentManager()
                         .findFragmentById(R.id.list));
            }
            Log.d(MainActivity.TAG, "P2P peers changed");


        } else if (WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION.equals(action)) {

            if (wifimngr == null) {
                return;
            }

            NetworkInfo networkInfo = (NetworkInfo) intent
                    .getParcelableExtra(WifiP2pManager.EXTRA_NETWORK_INFO);

            if (networkInfo.isConnected()) {

                // we are connected with the other device, request connection
                // info to find group owner IP

               //DeviceDetailFragment fragment = (DeviceDetailFragment) activity
                //        .getFragmentManager().findFragmentById(R.id.frag_detail);
                //wifimngr.requestConnectionInfo(channel, fragment);
            } else {
                // It's a disconnect
                //activity.resetData();
            }

        } else if (WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION.equals(action)) {
            DeviceListFragment fragment = (DeviceListFragment) activity.getFragmentManager()
                    .findFragmentById(R.id.list);
            fragment.updateThisDevice((WifiP2pDevice) intent.getParcelableExtra(
                    WifiP2pManager.EXTRA_WIFI_P2P_DEVICE));

        }
    }



    }

activity_main.xml中

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.hpconcept.miracastconnector.MainActivity"
    tools:ignore="MergeRootFrame" >

    <ListView
        android:id="@+id/list"
        android:layout_width="wrap_content"
        android:layout_height="250dp"
        android:layout_marginTop="0dp"
        android:layout_marginBottom="0dp"
        android:paddingTop="0dp"
        android:textSize="20sp" >
    </ListView>

    <View android:id="@+id/strut"
        android:layout_width="0dp"
        android:layout_height="0dp" 
        android:layout_marginTop="200dp"
        android:layout_below="@android:id/list"
        android:layout_centerHorizontal="true"/>

    <Button
        android:id="@+id/scanbutton"
        android:text="@string/scan_string"
        android:layout_height="wrap_content"
        android:layout_below="@android:id/list"
        android:layout_width="0dp"
        android:layout_alignParentBottom="true"
        android:onClick="scanConnections"
        android:layout_alignRight="@id/strut"
        android:layout_alignParentLeft="true"
         />

    <Button
        android:id="@+id/pauseButton"
        android:text="@string/stream_string"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:onClick="pauseConnections"
        android:layout_gravity="bottom"
        android:layout_alignLeft="@id/strut"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:layout_below="@android:id/list"
        android:layout_toRightOf="@+id/scanbutton" />

    <TextView
        android:id="@+id/statusText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/pauseButton"
        android:layout_alignLeft="@+id/pauseButton"
        android:layout_marginLeft="42dp"
        android:gravity="center"
        android:text="@string/waiting_string" />

    <ProgressBar
        android:id="@+id/progressBar1"
        style="?android:attr/progressBarStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/statusText"
        android:layout_alignLeft="@+id/pauseButton"
        android:layout_marginLeft="24dp"
        android:visibility="invisible" />

    </RelativeLayout>

所以整个项目基本上变成我试图管磁带一起各件样品code从互联网附近。我真的可以使用一些帮助。我尝试使用谷歌的Andr​​oid开发页面,但我总是不知道往哪里放他们的code的片段。我努力使自己的Connection类,这将持有WifiP2pDevice在与昵称和其他数据的ArrayList,但我无法得到它出于某种原因。所以,现在我的首要任务是刚开的程序运行,并找到连接。我没有完成的图形用户界面,以我的知识。我可能需要去改变它或东西虽然。
这还不是全部我的code的。如果我张贴这一切,这个问题将是巨大的。哈哈如果你想看到这一切,让我知道。

So this whole project is basically turning into me trying to duct-tape together various pieces of sample code from around the internet. I could really use some help. I'm trying to use Google's Android development pages, but I don't always know where to put their snippets of code. I was trying to make my own Connection class, that would hold the WifiP2pDevice's in an arraylist along with the nicknames and other data, but I couldn't get it to work for some reason. So now my priority is just getting the program to run and find connections. I did finish the GUI to the best of my knowledge. I might need to change it or something though. This is not all of my code. If I posted it all, this question would be huge. lol If you want to see it all, let me know.

推荐答案

所以,我发现这个code有兴趣的人士,这完美的作品:

So I found this code for anyone interested and this works perfectly:

try 
{
    Log.d("DEBUG", "open WiFi display settings in HTC");
    startActivity(new Intent("com.htc.wifidisplay.CONFIGURE_MODE_NORMAL"));
} catch (Exception e) 
{
    try 
    {
        Log.d("DEBUG", "open WiFi display settings in Samsung");
        startActivity(new Intent("com.samsung.wfd.LAUNCH_WFD_PICKER_DLG"));
    }catch (Exception e2) 
    {
        Log.d("DEBUG", "open WiFi display settings in stock Android");
        startActivity(new Intent("android.settings.WIFI_DISPLAY_SETTINGS"));
    }
}

我摆脱了列表视图的现在,因为我不需要扫描与WifiP2p设备了。当此设置打开时,它会自动连接到附近的显示屏。

I got rid of the listview for now since I don't need to scan for devices with WifiP2p anymore. When this setting opens, it will connect to a nearby display automatically.

我唯一需要的是找出一种方式,设置窗口关闭它连接到显示器后。我试图模拟一个返回按钮preSS,但只有当用户返回到应用程序自己被效仿。然后从备份的应用程序。

The only thing I need is to figure out a way for the settings screen to close after it has connected to a display. I have tried emulating a back button press but it only gets emulated when the user returns to the app himself. Then it backs out of the app.

这篇关于寻找与Android Miracast的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆