2

I want to use miracast in my app without going to system setting, and find miracast device and connect to them in my app. Two class that was in setting classes that can help me are hidden in android SDK:

import android.hardware.display.WifiDisplay;
import android.hardware.display.WifiDisplayStatus;

so I think to use native source code of them in android media framework on this. I want to know if this is the best way, if so how can I use this native code in my app? Android how to use this native code in android SDK ?

Andrea
  • 11,801
  • 17
  • 65
  • 72
hkh114
  • 162
  • 1
  • 3
  • 15
  • I've written an answer which explains how to do this [here](http://stackoverflow.com/a/34182702/158703). – CalumMcCall Dec 09 '15 at 15:37
  • @CalumMcCall , thanks for your link. after adding modified android.jar , if you have some clear example of using this hide methods to connect to specific dongle , plz post here ! thanks alot ... – hkh114 Dec 10 '15 at 18:34
  • Yeah I still need to get around to adding code to my answer. For now, https://android.googlesource.com/platform/frameworks/base/+/master/media/java/android/media/MediaRouter.java has examples. Search for 'connectWifiDisplay' and then look at where it gets the device address from. – CalumMcCall Dec 14 '15 at 10:50
  • @CalumMcCall , after this example we cant get permission of it ! how can we get system level permission or system key for signing app or set app to system app ? did you have some clear and easy example for it ? is building an AOSP rom is hard or harmfull ? – hkh114 Dec 15 '15 at 18:33
  • I've updated my answer linked to in my first comment here. It should now answer your questions. Building a ROM is fairly straightforward, the cyanogenmod guides are good, but it will invalidate the warranty for your phone. – CalumMcCall Dec 16 '15 at 14:01
  • @CalumMcCall , thanks a lot for your complete guid . did you test it on your device ? if yes , did you have any code example for connecting to specific Mac Address and add it as media router and display on Tv ? – hkh114 Dec 20 '15 at 10:25
  • No, unfortunately I don't have any examples, except the code I linked you to from Google. Using that code I scan for devices and look for a specific display name rather than a mac address. Currently, the miracast connection fails for me the majority of the time. This is due to me not using the API correctly. I'm still working out what I'm doing wrong. Once I have it working, I'll update my question with some sample code. That might take until late January though. – CalumMcCall Dec 21 '15 at 15:12
  • @CalumMcCall , thanks again ... , in AOSP and xda.developer site , dont exist any rom for my tablet ! how can i found it ? i searched in internet, but no rom for it ! my tablet: lenovo Tab2 A7 30 10f – hkh114 Dec 22 '15 at 19:11
  • Hmm, it looks like CM doesn't support your tablet. I'm not sure how much work it would be to get it working on your tablet. Maybe ask on the CM forums. I'd advise you use better supported hardware if possible. Building a custom ROM from AOSP will be much harder than simply building CM for something like a Nexus. – CalumMcCall Dec 23 '15 at 15:59
  • 1
    Were you able to implement this? Do you have any source code available? – Aldrin Joe Mathew Jul 27 '20 at 07:11
  • @AldrinMathew excuse, I dont track this issue ... – hkh114 Jul 28 '20 at 10:25

0 Answers0