DeskCast + VB.NET Source - Google Chromecast

this is a little project I have been working on to cast videos from my desktop pc with hard drives mapped from my server
it works much like fling did but built with vb.net not java
you will need .Net Framework 4.6.1 installed to run or compile this application
the VB source was built Visual Studio 2013
the C# source was built Visual Studio 2017
if you have multiple network adapters this might not work for you as it might not resolve your local ip address correctly
ffmpeg is used to transcode videos that are not mp4, when transcoding you cannot seek/select play position
when streaming from harddrive mp4 files should have the ability to seek/select play position
you can drag and drop video files onto application to play them(like Fling)
it also has the option to play files from urls
it should be pretty simple to use for you
just open the program and it should find chromecasts on the network then select the chromecast you want to cast to then click "Connect CC" then drag and drop video onto it and it should start playing
it should work for rooted and non rooted chromecasts
when using a rooted chromecast the receiver is hosted by DeskCast its self
when using a non rooted chromecast the receiver is one of the apps in the google whitelist
the receiver files deskcast sends to the rooted chromecast are in the "data" folder of the application, so you can edit these too
I did play with the idea of the chromecast its self hosting the receiver files but the www folder in the chromecast is locked/read only so that might be something for team eureka to add to the webpanel they have
this works for me very well, but I cant say that it will work for you at all
im really only posting the source so other people can use it for information or ideas to make something better than I ever could
I hope this is useful to someone
VB .NET Source
https://github.com/stooged/DeskCast
C# Source
https://github.com/stooged/DeskCastC

stooged said:
this is a little project I have been working on to cast videos from my desktop pc with hard drives mapped from my server
it works much like fling did but built with vb.net not java
you will need .Net Framework 4.5 installed to run or compile this application
it was built Visual Studio 2012 so you will need that to compile it
if you have multiple network adapters this wont work for you as it wont resolve your local ip address
ffmpeg is used to transcode videos that are not mp4, when transcoding you cannot seek/select play position
when streaming from harddrive mp4 files should have the ability to seek/select play position
you can drag and drop video files onto application to play them(like Fling)
it also has the option to play files from urls
it should be pretty simple to use for you
just open the program and it should find chromecasts on the network then select the chromecast you want to cast to then click "Connect CC" then drag and drop video onto it and it should start playing
it should work for rooted and non rooted chromecasts
when using a rooted chromecast the receiver is hosted by DeskCast its self
when using a non rooted chromecast the receiver is one of the apps in the google whitelist
the receiver files deskcast sends to the rooted chromecast are in the "data" folder of the application, so you can edit these too
I did play with the idea of the chromecast its self hosting the receiver files but the www folder in the chromecast is locked/read only so that might be something for team eureka to add to the webpanel they have
this works for me very well, but I cant say that it will work for you at all
im really only posting the source so other people can use it for information or ideas to make something better than I ever could
I hope this is useful to someone
Click to expand...
Click to collapse
You can start your own webserver if you like. You got one built into /bin/busybox
in shell you can start it with:
/bin/busybox httpd -p 8000 -h /data/www -c /data/httpd.conf
httpd.conf contains:
A:*
/cgi-bin:a:a
echo "It's working!" > /data/www/index.html
open <chromecastip>:8000 and you got your self a webserver =)
if it not working, try a newer busybox binary, the one in /bin is a bit old.
I've been looking a way to use CC as a host for casting so this was fun to see =)

Mape0661 said:
You can start your own webserver if you like. You got one built into /bin/busybox
in shell you can start it with:
/bin/busybox httpd -p 8000 -h /data/www -c /data/httpd.conf
httpd.conf contains:
A:*
/cgi-bin:a:a
echo "It's working!" > /data/www/index.html
open <chromecastip>:8000 and you got your self a webserver =)
if it not working, try a newer busybox binary, the one in /bin is a bit old.
I've been looking a way to use CC as a host for casting so this was fun to see =)
Click to expand...
Click to collapse
yeah I did try that with a new busybox binary installed to the chromecast
the webserver worked and the receiver files were hosted by the chromecast in the /data/www folder but the receiver wouldn't allow a connection to the websocket
I think it had issues with the domain/ip being the same as the chromecast
it might be something that can be changed in the rom by team eureka.
the idea of a whitelist and a receiver being on the chromecast its self might make it possible to use offline when streaming media from your pc or tablet, Netflix and hulu and apps like that we know wont work offline
I guess I will just keep playing around with it to see if I can get it to work

stooged said:
yeah I did try that with a new busybox binary installed to the chromecast
the webserver worked and the receiver files were hosted by the chromecast in the /data/www folder but the receiver wouldn't allow a connection to the websocket
I think it had issues with the domain/ip being the same as the chromecast
it might be something that can be changed in the rom by team eureka.
the idea of a whitelist and a receiver being on the chromecast its self might make it possible to use offline when streaming media from your pc or tablet, Netflix and hulu and apps like that we know wont work offline
I guess I will just keep playing around with it to see if I can get it to work
Click to expand...
Click to collapse
I was experimenting with this few weeks ago, I installed Google CastVideo from github
https://github.com/googlecast/CastVideos-chrome
Got a page working, hosted by chromecast, but I was never able to remove the DEMO text all over the videos. But it worked nicely to stream mp4 files from a samba share.
I travel a lot and my plan was/is to use a travel router and mount a samba share to my linux server with ssh
something like this on chromecast
ssh -C -f -N -p 22 -L 440:127.0.0.1:445 <username>@<serveradress>
sudo mount -t cifs //127.0.0.1/<share> <mountpoint> -o port=440,user="<user>",password="<password>"
you need a new dropbearmulti, got a working one (armv61) from
http://landley.net/aboriginal/downloads/binaries/extras/
Did you try with lighttpd?
-----------------------------------
cp /system/etc/httpd.conf /data (change port and webroot in httpd.conf, 3000 and /data/www worked for me)
mkdir /data/www
lighttpd -m /system/usr/lib -f /data/httpd.conf

Mape0661 said:
Did you try with lighttpd?
-----------------------------------
cp /system/etc/httpd.conf /data (change port and webroot in httpd.conf, 3000 and /data/www worked for me)
mkdir /data/www
lighttpd -m /system/usr/lib -f /data/httpd.conf
Click to expand...
Click to collapse
no I just tried busybox httpd
but I will give lighttpd a go

I did find one way to make the chromecast host the receiver or any html content
in the post to the chromecast to loadup the receiver if you use the data uri scheme for the post data you can make the chromecast launch html
so as the url for the receiver you can use something like data:text/html;base64,html_encoded_in_base64
I did a test with the receiver.html file from the Fling source and it worked fine
here is a php script that should allow you to play a mp4 file on the chromecast using this method with a single post
Code:
<?php
$ChromeCastIP = "192.168.1.102";
$ChromeCastApp = "Fling";
$VideoURL = "://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4";
$htmldata = base64_encode("
<html>
<head>
<title></title>
</head>
<body bgcolor=#000000 topmargin=0 leftmargin=0 bottommargin=0 rightmargin=0 marginwidth=0 marginheight=0>
<video width='100%' height='100%' autoplay>
<source src='http$VideoURL' type='video/mp4'>
</video>
</body>
</html>
");
$postdata = "data:text/html;base64,$htmldata";
$fp = fsockopen($ChromeCastIP, 8008, $errno, $errstr, 30);
$out = "POST /apps/$ChromeCastApp/ HTTP/1.1\r\n";
$out .= "Accept-Language: en-us\r\n";
$out .= "Accept: */*\r\n";
$out .= "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36\r\n";
$out .= "Host: $ChromeCastIP:8008\r\n";
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
$out .= "Origin: chrome-extension://boadgeojelhgndaghljhdicfkmllpafd\r\n";
$out .= "Content-Length: ".strlen($postdata)."\r\n";
$out .= "Connection: Close\r\n\r\n$postdata";
fwrite($fp, $out);
sleep(2);
fclose($fp);
?>

stooged said:
I did find one way to make the chromecast host the receiver or any html content
in the post to the chromecast to loadup the receiver if you use the data uri scheme for the post data you can make the chromecast launch html
so as the url for the receiver you can use something like data:text/html;base64,html_encoded_in_base64
I did a test with the receiver.html file from the Fling source and it worked fine
here is a php script that should allow you to play a mp4 file on the chromecast using this method with a single post
Code:
<?php
$ChromeCastIP = "192.168.1.102";
$ChromeCastApp = "Fling";
$VideoURL = "://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4";
$htmldata = base64_encode("
<html>
<head>
<title></title>
</head>
<body bgcolor=#000000 topmargin=0 leftmargin=0 bottommargin=0 rightmargin=0 marginwidth=0 marginheight=0>
<video width='100%' height='100%' autoplay>
<source src='http$VideoURL' type='video/mp4'>
</video>
</body>
</html>
");
$postdata = "data:text/html;base64,$htmldata";
$fp = fsockopen($ChromeCastIP, 8008, $errno, $errstr, 30);
$out = "POST /apps/$ChromeCastApp/ HTTP/1.1\r\n";
$out .= "Accept-Language: en-us\r\n";
$out .= "Accept: */*\r\n";
$out .= "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36\r\n";
$out .= "Host: $ChromeCastIP:8008\r\n";
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
$out .= "Origin: chrome-extension://boadgeojelhgndaghljhdicfkmllpafd\r\n";
$out .= "Content-Length: ".strlen($postdata)."\r\n";
$out .= "Connection: Close\r\n\r\n$postdata";
fwrite($fp, $out);
sleep(2);
fclose($fp);
?>
Click to expand...
Click to collapse
Got it working =), Very cool.
I tryed to make php work on Chromecast. At the moment I only got a test page working with some old php binaries. But the php-cli are working fine!

Can you host this in github? I'd like to contribute to this project

Giswald said:
Can you host this in github? I'd like to contribute to this project
Click to expand...
Click to collapse
I have never used github before but I think this worked
https://github.com/stooged/DeskCast

What's the main difference between the chrome extension "VideoStream for Google Chromecast" ?
Seems it can do the same job.

lancillotto said:
What's the main difference between the chrome extension "VideoStream for Google Chromecast" ?
Seems it can do the same job.
Click to expand...
Click to collapse
you don't need the chrome browser which I don't use, its junk imo.
no ads.
its free.
open source.
the main point of this is to just encourage more people to develop more things for rooted chromecasts, not everyone codes in languages that make chrome browser extensions or android apps etc.
if you look at fling its open source and is a good source of information for anyone that wants to develop standalone applications for the chromecast.
I think things like videostream are great for people who just want something that will play a file, but charging money for things and closed source projects don't really help other developers.
videostream is a good extension it has playlist support, a custom tv part, can be controlled from your phone etc.
but its transcoding is done using ffmpeg and x264 projects which are opensource and free, without those people doing amazing work on those open source projects we wouldn't be able to transcode videos.
without team eureka we wouldn't have rooted chromecasts and thats open source and free.
I made this project for my own personal use to cast media to my projector and TV's around my house, I started using fling but that stopped working so I used the source as a guide to create deskcast in a language I could understand so I could maintain it and keep it working.
I decided to share it here because this is where I found fling and the team eureka rom, its not intended to compete with other projects or extensions its more of a source code dump for anyone out there that uses vb.net.

This app Always crash no Windows 8.1 x64:crying:
---------- Post added at 07:05 AM ---------- Previous post was at 06:40 AM ----------
Play movie for 3 seconds and then crash. Always.

Crash solved
mute_man said:
This app Always crash no Windows 8.1 x64:crying:
---------- Post added at 07:05 AM ---------- Previous post was at 06:40 AM ----------
Play movie for 3 seconds and then crash. Always.
Click to expand...
Click to collapse
Before i was on windows 8 64 bits she was crashing !! Now i am on windows 8.1 64 bits she's crashing again !
I have dl the src and debug and I found where search ask on the web and i solve..
The problème is with french pc, where locale Fr is used.
Because the programme for show us the current_time and de total duration of the cast, receive data and parse them.
The programe receive data in string like "0.145666" or "46.613333" .
And later we try to convert this decimal number in string to double.
But on US pc :
(4.5).ToString() send "4.5"
Convert.ToDouble("4.5") send 4.5
Convert.ToDouble("4,5") send an exception
On FR pc :
(4.5).ToString() send "4,5"
Convert.ToDouble("4.5") send an exception
Convert.ToDouble("4,5") send 4.5
I dont find this alone but i was searching help here http://openclassrooms.com/forum/sujet/la-conversion-de-la-chaine-46-6133-en-type-double
and somebody send me here http://www.developpez.net/forums/d530200/dotnet/langages/csharp/convert-todouble-ne-gere-points/
Where i found the solution.
So you can download the src http://forum.xda-developers.com/attachment.php?attachmentid=2958209&d=1412304466
open in visual studio go to Form1.vb
At the beginning of the file under
Code:
Option Strict Off
Option Explicit On
Imports System.IO
Imports System.Net
Imports System.Threading
add
Code:
Imports System.Globalization
and search for
Code:
If Spl2(0) = "null" Then Spl2(0) = 0
You will find 3 occurance. But only 2 are interesting on line 288 and line 295.
Add before these 2 lines
Code:
If CultureInfo.CurrentCulture.TwoLetterISOLanguageName = "fr" Then Spl2(0) = Spl2(0).Replace(".", ",")
at final you will have
Code:
If InStr(StrMessage, Chr(34) & "duration" & Chr(34) & ":") <> 0 Then
Spl1 = Split(StrMessage, Chr(34) & "duration" & Chr(34) & ":")
Spl2 = Split(Spl1(1), ",")
' If Spl2(0).Contains(".") Then Spl2(0) = Spl2(0).Replace(".", ",")
If CultureInfo.CurrentCulture.TwoLetterISOLanguageName = "fr" Then Spl2(0) = Spl2(0).Replace(".", ",")
If Spl2(0) = "null" Then Spl2(0) = 0
pDuration = Fix(Spl2(0))
End If
If InStr(StrMessage, Chr(34) & "current_time" & Chr(34) & ":") <> 0 Then
Spl1 = Split(StrMessage, Chr(34) & "current_time" & Chr(34) & ":")
Spl2 = Split(Spl1(1), ",")
' If Spl2(0).Contains(".") Then Spl2(0) = Spl2(0).Replace(".", ",")
If CultureInfo.CurrentCulture.TwoLetterISOLanguageName = "fr" Then Spl2(0) = Spl2(0).Replace(".", ",")
If Spl2(0) = "null" Then Spl2(0) = 0
pTime = Fix(Spl2(0))
TrackTime(pDuration, pTime)
End If
Instead of
Code:
If InStr(StrMessage, Chr(34) & "duration" & Chr(34) & ":") <> 0 Then
Spl1 = Split(StrMessage, Chr(34) & "duration" & Chr(34) & ":")
Spl2 = Split(Spl1(1), ",")
If Spl2(0) = "null" Then Spl2(0) = 0
pDuration = Fix(Spl2(0))
End If
If InStr(StrMessage, Chr(34) & "current_time" & Chr(34) & ":") <> 0 Then
Spl1 = Split(StrMessage, Chr(34) & "current_time" & Chr(34) & ":")
Spl2 = Split(Spl1(1), ",")
If Spl2(0) = "null" Then Spl2(0) = 0
pTime = Fix(Spl2(0))
TrackTime(pDuration, pTime)
End If
well compile & run and enjoy !

Great, thanks !
But may I ask to publish somewhere the compiled version because I don't think that everybody has visual studio.
Thanks in advance
Inf3rnus187 said:
Before i was on windows 8 64 bits she was crashing !! Now i am on windows 8.1 64 bits she's crashing again !
I have dl the src and debug and I found where search ask on the web and i solve..
The problème is with french pc, where locale Fr is used.
Because the programme for show us the current_time and de total duration of the cast, receive data and parse them.
The programe receive data in string like "0.145666" or "46.613333" .
And later we try to convert this decimal number in string to double.
But on US pc :
(4.5).ToString() send "4.5"
Convert.ToDouble("4.5") send 4.5
Convert.ToDouble("4,5") send an exception
On FR pc :
(4.5).ToString() send "4,5"
Convert.ToDouble("4.5") send an exception
Convert.ToDouble("4,5") send 4.5
I dont find this alone but i was searching help here http://openclassrooms.com/forum/sujet/la-conversion-de-la-chaine-46-6133-en-type-double
and somebody send me here http://www.developpez.net/forums/d530200/dotnet/langages/csharp/convert-todouble-ne-gere-points/
Where i found the solution.
So you can download the src http://forum.xda-developers.com/attachment.php?attachmentid=2958209&d=1412304466
open in visual studio go to Form1.vb
At the beginning of the file under
Code:
Option Strict Off
Option Explicit On
Imports System.IO
Imports System.Net
Imports System.Threading
add
Code:
Imports System.Globalization
and search for
Code:
If Spl2(0) = "null" Then Spl2(0) = 0
You will find 3 occurance. But only 2 are interesting on line 288 and line 295.
Add before these 2 lines
Code:
If CultureInfo.CurrentCulture.TwoLetterISOLanguageName = "fr" Then Spl2(0) = Spl2(0).Replace(".", ",")
at final you will have
Code:
If InStr(StrMessage, Chr(34) & "duration" & Chr(34) & ":") <> 0 Then
Spl1 = Split(StrMessage, Chr(34) & "duration" & Chr(34) & ":")
Spl2 = Split(Spl1(1), ",")
' If Spl2(0).Contains(".") Then Spl2(0) = Spl2(0).Replace(".", ",")
If CultureInfo.CurrentCulture.TwoLetterISOLanguageName = "fr" Then Spl2(0) = Spl2(0).Replace(".", ",")
If Spl2(0) = "null" Then Spl2(0) = 0
pDuration = Fix(Spl2(0))
End If
If InStr(StrMessage, Chr(34) & "current_time" & Chr(34) & ":") <> 0 Then
Spl1 = Split(StrMessage, Chr(34) & "current_time" & Chr(34) & ":")
Spl2 = Split(Spl1(1), ",")
' If Spl2(0).Contains(".") Then Spl2(0) = Spl2(0).Replace(".", ",")
If CultureInfo.CurrentCulture.TwoLetterISOLanguageName = "fr" Then Spl2(0) = Spl2(0).Replace(".", ",")
If Spl2(0) = "null" Then Spl2(0) = 0
pTime = Fix(Spl2(0))
TrackTime(pDuration, pTime)
End If
Instead of
Code:
If InStr(StrMessage, Chr(34) & "duration" & Chr(34) & ":") <> 0 Then
Spl1 = Split(StrMessage, Chr(34) & "duration" & Chr(34) & ":")
Spl2 = Split(Spl1(1), ",")
If Spl2(0) = "null" Then Spl2(0) = 0
pDuration = Fix(Spl2(0))
End If
If InStr(StrMessage, Chr(34) & "current_time" & Chr(34) & ":") <> 0 Then
Spl1 = Split(StrMessage, Chr(34) & "current_time" & Chr(34) & ":")
Spl2 = Split(Spl1(1), ",")
If Spl2(0) = "null" Then Spl2(0) = 0
pTime = Fix(Spl2(0))
TrackTime(pDuration, pTime)
End If
well compile & run and enjoy !
Click to expand...
Click to collapse

Windows 8.1 x64 NO CRASHES! Finally some good PC software for Chromecast, I don't like using Chrome to cast videos, and TorrentTV app stopped working for me. I'm downloading the source, can I compile using VS 2012? I'll be using it for studying purposes only. But I'll try to add subtitles option (perfect for offline movies).
Absolutely amazing, thanks man!

I know this is an old thread, but I hope someone see's this.
I want to make an app in VB.NET that will send one window to ChromCast and have another window on the desktop. Is this possible? Any guidance or starter tips on how to do it?

started tinkering with my chrome cast again and added C# source for deskcast as I have moved away from vb.net.
https://github.com/stooged/DeskCastC
Visual Studio 2017 RC
Net Framework 4.6.1

Thank @stooged, both project VB and C# work on windows 10 64 bit, but only .mp4 files .

Related

[Q] Nexus one and serial port

Hi,
First, I am new as a poster on this forum, but I read it often for info (specially on CM 6 & 7) !
(And second "first" thing, sorry for my bad English, French is not a good situation for that !)
As an engineer student, I am very interested by two things : Android and µC !
So why not combine them !
So I would like to communicate via the USB/Serial port of my N1 (CM7, Build 33) with µControler (in this case Cortex M3 on mbed plateform or arduino like).
So after some research, I found a few informations and condition for that :
- rooted (no problem for that)
- Serial enable Kernel (no info for the CM7 Kernel...if someone know !)
- Chmod the Serial port (possibly the ttyMSM0 ?)
- Something to control the port !
I decided to use this combo :
SL4A + Python (module for SL4A)
And wrote this piece of code to test :
Code:
import android
import os
import serial
import time
droid = android.Android()
try:
arduino = serial.Serial('/dev/ttyMSM0', 9600)
except:
print "Failed to connect on /dev/ttyttyMSM0"
a = 0
while (a < 10):
arduino.write('e')
os.system("echo 'a' > /dev/ttyMSM0")
a = a + 1
print "ok"
time.sleep(2)
But it doesn't work !
The "arduino" object did not exist, because he cant access the port (and I don't know why !)
The line
Code:
os.system("echo 'a' > /dev/ttyMSM0")
was just something like that, without real hope !
All ideas are welcome ! everything !
Thanks,
Pacemk

XML parsing-best method, general discussion

I am relatively new to programing and have been teaching myself as I go. I am trying to now integrate ESPN's API into my app which outputs XML data. I have done enough research to understand that I need to use an XML parser and that the XML can be displayed as a list view or web view by adding HTML markup.
I would like this thread to become a general discussion for all new developers on what XML parsing is and what it does. How it works, the code behind it etc.
I am currently trying to modify a code snippet from the developer.google.com website.
Android includes built in libraries for XML Parsing.
You can see a minimal use of the library here:
Code:
import java.io.IOException;
import java.io.StringReader;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
public class SimpleXmlPullApp
{
public static void main (String args[])
throws XmlPullParserException, IOException
{
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
XmlPullParser xpp = factory.newPullParser();
xpp.setInput( new StringReader ( "<foo>Hello World!</foo>" ) );
int eventType = xpp.getEventType();
while (eventType != XmlPullParser.END_DOCUMENT) {
if(eventType == XmlPullParser.START_DOCUMENT) {
System.out.println("Start document");
} else if(eventType == XmlPullParser.START_TAG) {
System.out.println("Start tag "+xpp.getName());
} else if(eventType == XmlPullParser.END_TAG) {
System.out.println("End tag "+xpp.getName());
} else if(eventType == XmlPullParser.TEXT) {
System.out.println("Text "+xpp.getText());
}
eventType = xpp.next();
}
System.out.println("End document");
}
}
So essentially, you can grab the xml from ESPN, save it to a file, parse it with that library, and output as desired.
Full details here: http://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html
the fastest way I know is the parser written in c/c++ and compiled with ndk.
bitpushr said:
Android includes built in libraries for XML Parsing.
So essentially, you can grab the xml from ESPN, save it to a file, parse it with that library, and output as desired.
Full details here: http://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html
Click to expand...
Click to collapse
I will have to try out this code. Because I am learning as I go there are many things in java I don't yet understand which ultimately make it a lot harder to accomplish tasks but I am slowly catching on
If you want to do this in a .NET (Windows x86/64, Windows Mobile, Windows Phone) environment, or a Linux MONO environment then the following will carry out the bare minimum of parsing.
Assuming you have the data in an XML file :- PARAMS.XML in the same folder as the program, created similar to this:
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<PARAMS>
<Library>TESTLIB</Library>
<Source>C:\RetData\</Source>
</PARAMS>
Then the following C# code will read and extract the parameters:
Code:
using System.Xml;
string LibName,RetDir;
XmlReader xrdr = XmlReader.Create(Application.StartupPath+"\\PARAMS.xml");
xrdr.ReadToFollowing("Library");
Libname=xrdr.ReadElementContentAsString();
xrdr.ReadToFollowing("Source");
RetDir = xrdr.ReadElementContentAsString();
xrdr.Close();
After executing this code then:
LibName = "TESTLIB"
RetDir = "C:\RetData\"
CAVEAT:
I mentioned that this is the bare minimum. An XmlReader object is a forward only reader. Also, this code has no error checking.
In this case the elements must be read in the order they occur or the reader will encounter a null element and throw an error.

Getting closer to installing Gear Manager on Nexus 7

For anyone who's trying, I've got closer to installing Galaxy Gear Manager on Nexus 7 (4.3 which has BLE). First, I just installed the app, but it would declare that it had to "Installing 0/19 ... 0%" and then just stop trying.
When I clicked "Connect Manually" it would pair and attempt, but I'd get the SsskUnsupportedException - Device Not Supported"
So I tried installing *all* the files here:
http://www.mediafire.com/folder/iej2xisyax63c/GearApp_GalaxyS4(Android43)_All
I tested as I installed more and more, and basically whittled it down to 0/10 and then 0/2 files now that need to be installed when I start up the Gear Manager.
Anyone know what might be missing on that list? I'm hoping that those 2 remaining APKs might make a difference. Hopefully this will open things up to installing on any Android device (that has Bluetooth LE)
I've also been playing around with the various services/and activities via the am start command to try to pair without resetting the device:
Code:
am start com.android.bluetooth/.common.BluetoothPairingDialog
am start com.android.bluetooth/.common.BluetoothConnectActivity
am start com.android.bluetooth/.common.BluetoothSyncingActivity
am startservice com.android.bluetooth/.common.BluetoothAutoConnectService
Bit of a chore, but I got these using smali / dex2jar / JD Gui
Code:
adb pull /system/app/Bluetooth.odex
adb pull /system/framework/ framework (grab all the frameworks for baksmali)
./baksmali -a 15 -x Bluetooth.odex -d framework -o Bluetoot
./smali Bluetoot
d2j-dex2jar.sh out.dex
And then run JD Gui on them to figure out what's going on. I'm not sure, but there is a VendorSpecificCommand in the odex which might be what's causing the reset. If there was a way to avoid that, it might help. Hard to say.
Another idea might be to use bluez or something and do a command line pairing.
Here's a list of things I'm going to try to see if I can get this to work. If anyone has time to try one of these and let us know how it goes, that'd be great.
1. Use bluez or similar utility to pair from the command line
2. See if I can block the VendorSpecific command in Bluetooth.apk from causing us to reset
3. Decompile code and grep for Connection Failed message is exactly appearing when trying to pair between Nexus 7 and Galaxy Gear
4. Compare LogCats from a success case with a failed case and find the diff
Cheers,
Blaze.
I pulled this list form the classes.dex in the gear.apk
com.android.calendar
com.android.email
com.android.incomingcall
com.android.mms
com.android.phone
com.android.settings
com.android.settings.ChooseLockGeneric
com.android.settings.REMOTE_NAME_CHANGED
com.facebook.katana
com.google.android.apps.plus
com.google.android.gm
com.google.android.googlequicksearchbox
com.google.android.talk
com.kddi.android.cmail
com.kddi.android.email
com.samsung.accessory
com.samsung.accessory.ContactsConsumerService.ui.contacts.AllContactsConsumerActivity
com.samsung.accessory.FindMyPhoneProviderService
com.samsung.accessory.ISAFTManager
com.samsung.accessory.action.DATA_RESTORE
com.samsung.accessory.action.FRAMEWORK_DIED2
com.samsung.accessory.adapter.action.STATE_CHANGED
com.samsung.accessory.adapter.extra.ERROR
com.samsung.accessory.adapter.extra.ERROR_ID
com.samsung.accessory.adapter.extra.READ_BYTES
com.samsung.accessory.adapter.extra.READ_LENGHT0
com.samsung.accessory.adapter.extra.SEND_TIMEOUT3
com.samsung.accessory.adapter.extra.SPACE_AVAILABLE
com.samsung.accessory.adapter.extra.STATE
com.samsung.accessory.api.DeathCallback
com.samsung.accessory.api.ISAFrameworkManager
com.samsung.accessory.clocksettingsprovider
com.samsung.accessory.ftconnection
com.samsung.accessory.saalarmprovider
com.samsung.accessory.sacalendarprovider
com.samsung.accessory.sacameratransferservice
com.samsung.accessory.sacontextprovider
com.samsung.accessory.safavsprovider
com.samsung.accessory.safiletransfer
com.samsung.accessory.safiletransfer.core.ISAFTManager
com.samsung.accessory.salogconsumer.ui.ConsumerActivity
com.samsung.accessory.salogprovider
com.samsung.accessory.samusicprovider
com.samsung.accessory.sanotiprovider
com.samsung.accessory.savmprovider
com.samsung.accessory.savmprovider.VRPolicyActivity
com.samsung.android.aidl.ICancelInstallCallback
com.samsung.android.aidl.ICheckAppInstallState
com.samsung.android.aidl.ICheckAppInstallStateCallback
com.samsung.android.app.watchmanager
com.samsung.android.app.watchmanager.BManagerActivity
com.samsung.android.app.watchmanager.PairedWatchActivity
com.samsung.android.app.watchmanager.UpdateAlertDialogActivityInstalled
com.samsung.android.app.watchmanager.UpdateAlertDialogActivityServerSide
com.samsung.android.app.watchmanager.findmywatch.fromfindmywatchwidget.STOP
com.samsung.android.app.watchmanager.setting.WatchSettingsActivity
com.samsung.android.app.watchmanager.setupwizard.SetupWizardConnectActivity
com.samsung.android.app.watchmanager.setupwizard.SetupWizardEULAActivity
com.samsung.android.app.watchmanager.setupwizard.SetupWizardRestoreWatchSettingsActivity
com.samsung.android.app.watchmanager.setupwizard.SetupWizardWelcomeActivity
com.samsung.android.app.watchmanager.widget.SAPDISCONNECT
com.samsung.android.app.watchmanager.widget.START
com.samsung.android.app.watchmanager.widget.STOP
com.samsung.android.app.watchmanager.widget.fromfindmywatchmenu.START
com.samsung.android.app.watchmanager.widget.fromfindmywatchmenu.STOP
com.samsung.android.permission.READ_FINDMYWATCHWIDGET
com.samsung.android.permission.installApp
com.samsung.android.watchsns.provider
com.samsung.appcessory.callhandlerprovider
com.samsung.appcessory.chatonw.provider
com.samsung.bvoice.BVoiceActivity
com.samsung.bvoice
com.samsung.bvoice.BVoiceActivity
com.samsung.notifications
com.samsung.notifications.NotificationsActivity
com.samsung.svoiceprovider
com.samsung.wmanager.APP
com.samsung.wmanager.ENABLE_NOTIFICATION
com.samsung.wmanager.SAP_CHANNEL_CONNECTED
com.sds.mobiledesk
com.sec.android.app.clockpackage
com.sec.android.app.safetyassurance
com.sec.android.app.safetyassurance.SafetyAssuranceGrantedReceiver
com.sec.android.app.safetyassurance.permission.PRIVATE_GRANTED
com.sec.android.app.safetyassurance.settings.SEND_B_OPTION_INFO
com.sec.android.app.safetyassurance.settings.SafetyAssuranceSetting
com.sec.android.app.samsungapps
com.sec.android.app.secwmanagersetupwizard.WSETUPWIZARD_COMPLETE
com.sec.android.app.shortcutclock.WATCH_SHORTCUT_SETTINGINFO
com.sec.android.daemonapp
com.sec.android.fotaprovider
com.sec.android.wallet
com.sec.android.weatherprovider
com.sec.android.widgetapp.ap.hero.accuweather
com.sec.android.widgetapp.watch.weatherclock
com.sec.chaton
com.sec.motions.MOTIONS_SETTINGS_CHANGED
com.twitter.android
Noone has posted 1.4 and it's not available in my store yet, but latest 1.2.131013 is here:
http://www.mediafire.com/folder/e7h23e12rzesi/Gear_Manager
Then to get the other apk files, open the apk in a zip program (ie WinRAR, 7zip) and go to folder \assets\preInstallApks\
Brendo said:
Noone has posted 1.4 and it's not available in my store yet, but latest 1.2.131013 is here:
http://www.mediafire.com/folder/e7h23e12rzesi/Gear_Manager
Then to get the other apk files, open the apk in a zip program (ie WinRAR, 7zip) and go to folder \assets\preInstallApks\
Click to expand...
Click to collapse
That helped. I've narrowed it down to these two suspects:
Code:
73 KB/s (104764 bytes in 0.132s)
pkg: /data/local/tmp/SAMusicProvider_signed.apk
Failure [INSTALL_FAILED_SHARED_USER_INCOMPATIBLE]
1281 KB/s (158158 bytes in 0.120s)
pkg: /data/local/tmp/SAWeatherProvider_signed.apk
Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY]
I believe SAWeatherProvider relies on TouchWiz. The shared user issue could probably be fixed easily enough. Not sure these libraries should be failing the connection.
Here's the logcat for the fail scenario after I click the paired device:
Code:
D/DeviceListActivity(19516): onItemClick()
D/DeviceListActivity(19516): onItemClick() address : D8:90:E8:A1:D1:8A
I/BluetoothAdapterProperties( 959): Callback:discoveryStateChangeCallback with state:0
W/DeviceListActivity(19516): pairing() address:D8:90:E8:A1:D1:8A device.getBondState():12
V/DD/SABtScan(17509): BluetoothAdapter.ACTION_DISCOVERY_FINISHED
V/BluetoothDiscoveryReceiver(19543): Received: android.bluetooth.adapter.action.DISCOVERY_FINISHED
D/DeviceListActivity(19516): pairing() state BOND_BONDED - mAddress is D8:90:E8:A1:D1:8A
D/DeviceListActivity(19516): onReceive() action:android.bluetooth.adapter.action.DISCOVERY_FINISHED
D/DeviceListActivity(19516): onReceive() ACTION_DISCOVERY_FINISHED count:1
V/SetupWizardConnectActivity(19516): onActivityResult()
V/SetupWizardConnectActivity(19516): onActivityResult() RESULT_OK
W/SetupWizardConnectActivity(19516): connectBTHeadset()[D8:90:E8:A1:D1:8A] mBluetoothHeadset = [email protected]
W/SetupWizardConnectActivity(19516): mBluetoothHeadset.connect(device)
D/BluetoothHeadset(19516): connect(D8:90:E8:A1:D1:8A)
W/SetupWizardConnectActivity(19516): SetupWizardConnectActivity onResume()
I/BluetoothHeadsetServiceJni( 959): connectHfpNative: sBluetoothHfpInterface: 0x69151868
D/BluetoothAdapterProperties( 959): CONNECTION_STATE_CHANGE: D8:90:E8:A1:D1:8A: 0 -> 1
D/BluetoothAdapterService(1114653040)( 959): Get Bonded Devices being called
D/BluetoothAdapterProperties( 959): getBondedDevices: length=2
W/ (19516): mBTReceiver action = android.bluetooth.headset.profile.action.CONNECTION_STATE_CHANGED
D/SetupWizardConnectActivity(19516): BT HFP_STATE_CHANGED_ICS / state = 1
D/DeviceListActivity(19516): onReceive() action:android.bluetooth.headset.profile.action.CONNECTION_STATE_CHANGED
D/WManagerReceiver(19516): BManagerConnectionReceiver:android.bluetooth.headset.profile.action.CONNECTION_STATE_CHANGED
D/WManagerReceiver(19516): Bluetooth HFP_STATE_CHANGED ++ State : 1
D/BTHeadSetReceiver(19202): Action = android.bluetooth.headset.profile.action.CONNECTION_STATE_CHANGED
D/BTHeadSetReceiver(19202): mBTConn data = 1
D/DeviceListActivity(19516): onReceive() action:android.bluetooth.adapter.action.CONNECTION_STATE_CHANGED
I/ActivityManager( 434): Displayed com.samsung.android.app.watchmanager/.setupwizard.SetupWizardConnectActivity: +10s714ms
D/DeviceListActivity(19516): onStop() mIsResultOk:true
D/DeviceListActivity(19516): onDestroy() mBtAdapter.isDiscovering():false
I/BluetoothAdapterProperties( 959): Callback:discoveryStateChangeCallback with state:0
V/DD/SABtScan(17509): BluetoothAdapter.ACTION_DISCOVERY_FINISHED
V/BluetoothDiscoveryReceiver(19543): Received: android.bluetooth.adapter.action.DISCOVERY_FINISHED
W/bt-btif ( 959): info:x10
D/ ( 959): remote version info [d8:90:e8:a1:d1:8a]: 6, f, 220e
D/btif_config_util( 959): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
W/DD/SABtScan(17509): unknown event received : android.bluetooth.device.action.ACL_CONNECTED
D/CompanionService(10769): bluetoothStateChangeReceiver action = android.bluetooth.device.action.ACL_CONNECTED
D/CompanionService(10769): device GALAXY Gear (D18A) @ [D8:90:E8:A1:D1:8A] BONDED
D/CompanionService(10769): Bluetooth device GALAXY Gear (D18A) @ [D8:90:E8:A1:D1:8A] BONDED has HSP|HFP.
D/CompanionService(10769): Headset device GALAXY Gear (D18A) @ [D8:90:E8:A1:D1:8A] BONDED connected.
D/HeadsetConnector(10769): Successfully invoked the getConnectedDevices method.
W/bt-sdp ( 959): process_service_search_attr_rsp
I/BluetoothHeadsetServiceJni( 959): connection_state_callback
D/BluetoothAdapterProperties( 959): CONNECTION_STATE_CHANGE: D8:90:E8:A1:D1:8A: 1 -> 0
D/BluetoothAdapterService(1114653040)( 959): Get Bonded Devices being called
D/BluetoothAdapterProperties( 959): getBondedDevices: length=2
W/ (19516): mBTReceiver action = android.bluetooth.headset.profile.action.CONNECTION_STATE_CHANGED
D/SetupWizardConnectActivity(19516): BT HFP_STATE_CHANGED_ICS / state = 0
D/SetupWizardConnectActivity(19516): STATE_DISCONNECTED
D/SetupWizardConnectActivity(19516): HFP_STATE_CHANGED_ICS state : 0 device Addr : D8:90:E8:A1:D1:8A device Name : GALAXY Gear (D18A)
D/SetupWizardConnectActivity(19516): BluetoothHeadset.STATE_DISCONNECTED mBtAddress : D8:90:E8:A1:D1:8A
D/SetupWizardConnectActivity(19516): Send message show connection fail
Galaxy Gear paired with Nexus 4
Hi Blaze,
many thanks for you post!
I followed your steps and was able to manually pair the Gear with Nexus 4.
I've just installed all "com.samsung.accessory" APKs from your link and "com.sec.android.fotaprovider".
Both "music" and "weather" failed by me too but it doesn't matter (I don't think com.sec.android.fotaprovider is needed either).
After that I've just opened the Gear Manager for the second time (at first it said 0/19, second time it said 0/2), and chosen "Connect manually" to already paired device (I've done that earlier with some GearManager_1.2.apk) - and it worked!
Thanks once again,
Oleg
Would be handy to have an idea of which files are required. Am looking through all the files on my s4
Could I ask how you got it paired to nexus 4 is your phone rooted?? I keep getting connection failed. Unable to open gear manager installed all apk apart from 2 that won't install 0/2 but when I tried to connect manual gives me connection failed any help would be appreciated..
Sent from my Nexus 4 using xda app-developers app
Hi beagle,
my Nexus 4 was rooted, but after some Android update it has lost its "su", and I don't think that this could be somehow relevant for the Galaxy Gear.
In fact, with Gear Manager 1.2 simple bluetooth pairing between the watch and the phone was never a problem, the handshake could be made and the watch was added to the phones BT-devices list.
The problem was, that after the handshake Gear Manager has told me: "Device not supported", or "Unsupported Ssdk", or something like that. So I took a look at the "com.samsung.android.app.watchmanager.1.2.131013.apk" decompiled source code and found the following:
Code:
package com.samsung.android.sdk.accessory;
class SA implements SsdkInterface {
//...
public void initialize(Context paramContext) throws SsdkUnsupportedException {
if (!SsdkVendorCheck.isDeviceSupported(paramContext)) {
throw new SsdkUnsupportedException("Device not supported", 1);
}
Log.d("Samsung Accessory SDK", "Samsung Accessory SDK version: " + this.mVersionName);
this.mInitialized = true;
}
//...
}
and here is how the "supported device" was checked:
Code:
package com.samsung.android.sdk.accessory;
public class SsdkVendorCheck
{
private static String FRAMEWORK_PACKAGE_NAME = "com.samsung.accessory";
private static String TAG = "SsdkVendorCheck";
private static String strBrand = Build.BRAND;
private static String strManufacturer = Build.MANUFACTURER;
public static boolean isDeviceSupported(Context paramContext)
{
PackageManager localPackageManager = paramContext.getPackageManager();
try
{
localPackageManager.getPackageInfo(FRAMEWORK_PACKAGE_NAME, 0);
return true;
}
catch (PackageManager.NameNotFoundException localNameNotFoundException)
{
Log.e(TAG, "Samsung Accessory Framework not installed");
localNameNotFoundException.printStackTrace();
}
return false;
}
public static boolean isSamsungDevice()
{
if ((strBrand == null) || (strManufacturer == null));
while ((strBrand.compareToIgnoreCase("Samsung") != 0) && (strManufacturer.compareToIgnoreCase("Samsung") != 0))
return false;
return true;
}
}
So theoretically, in my case all I had to do - was to create my own app, with the package "com.samsung.accessory" - and it would be sufficient to unlock the watch through the Nexus 4.
But I have not tried that out, I have found this thread and decided to install all the "com.samsung.*" apks, just to be sure.
And also they have changed this security check in the version 1.4, at least the GearManager 1.4 won't event start on my Nexus 4, I assume they are also checking the "SsdkVendorCheck.isSamsungDevice()" now in the "SA.initialize()", but I have not looked further into it.
I have also a definitely unrooted Nexus 7, I'll try to connect it with the watch when I have the time.
And I will try to use at first my own app as described above, than just a subset of the SA-apps to find out which of them are really needed. But I probably won't have the time for that till next week.
P.S. could you please upload the screenshot of that "connection failed" message?
Hi mate thanks for the reply..complete novice here! Connection failed message shows up on nexus 4 gear manager screen the watch just says Bluetooth connected then did connected again...I've had the watch paired to a s3 so know it works any help would be appreciated don't want to change my nexus 4 to get gear to work.
Sent from my Nexus 4 using xda app-developers app
beagle1974 said:
Hi mate thanks for the reply..complete novice here! Connection failed message shows up on nexus 4 gear manager screen the watch just says Bluetooth connected then did connected again...I've had the watch paired to a s3 so know it works any help would be appreciated don't want to change my nexus 4 to get gear to work.
Sent from my Nexus 4 using xda app-developers app
Click to expand...
Click to collapse
Interesting, I couldn't find that error message exactly but I think com.samsung.android.sdk.accessory.SAAgent is possibly involved in producing the error state:
Code:
private boolean handleMakeServiceConnectionAtomic(SAPeerAgent paramSAPeerAgent)
throws SAException
{
Log.i(TAG, "handleMakeServiceConnection: Send connection request , Waiting to accept connection");
SAAdapter localSAAdapter = SAAdapterAccessor.getDefault().getDefaultAdapter(getApplicationContext());
SharedPreferences localSharedPreferences = getApplicationContext().getSharedPreferences("AccessoryPreferences", 0);
String str = localSharedPreferences.getString(getClass().getName(), null);
if (str == null)
{
handleReRegisterAfterClearData();
str = localSharedPreferences.getString(getClass().getName(), null);
if (str == null)
{
Log.i(TAG, "handleMakeServiceConnectionAtomic: Even after restoring from Framework registeredKey is null. Nothing can be done");
onServiceConnectionResponse(null, 2048);
}
}
SAServiceDescription localSAServiceDescription = SAConfigUtil.getDefultInstance(getApplicationContext()).fetchServicesDescription(getClass().getName());
try
{
Log.d(TAG, "Is Member class" + String.valueOf(this.mConnHandlerAsImplementedbyCaller.isMemberClass()));
SASocket localSASocket;
if ((this.mConnHandlerAsImplementedbyCaller.getEnclosingClass() != null) && (SAAgent.class.isAssignableFrom(this.mConnHandlerAsImplementedbyCaller.getEnclosingClass())))
{
Log.d(TAG, "Enclosing class for ConnectionHelper:" + this.mConnHandlerAsImplementedbyCaller.getEnclosingClass().getSimpleName());
Class localClass = this.mConnHandlerAsImplementedbyCaller;
Class[] arrayOfClass = new Class[1];
arrayOfClass[0] = this.mConnHandlerAsImplementedbyCaller.getEnclosingClass();
localSASocket = (SASocket)localClass.getDeclaredConstructor(arrayOfClass).newInstance(new Object[] { this });
}
for (boolean bool = localSASocket.setupInitiator(this, str, paramSAPeerAgent, localSAServiceDescription, localSAAdapter); bool == true; bool = localSASocket.setupInitiator(this, str, paramSAPeerAgent, localSAServiceDescription, localSAAdapter))
{
this.mServiceState = 1;
Log.i(TAG, "onServiceConnectionResponse: CONNECTION_SUCCESS for " + getClass().getSimpleName());
this.mSuccessfulConnections.add(localSASocket);
onServiceConnectionResponse(localSASocket, 0);
localSASocket.setReadyToReceive();
return true;
localSASocket = (SASocket)this.mConnHandlerAsImplementedbyCaller.getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
}
this.mServiceState = 0;
int i = resolveConnectionError(SAAdapterAccessor.getDefault().getLastErrorCode(localSAAdapter));
Log.i(TAG, "onServiceConnectionResponse: CONNECTION_FAIL for " + getClass().getSimpleName());
onServiceConnectionResponse(null, i);
return false;
}
catch (InstantiationException localInstantiationException)
{
Log.e(TAG, "Unable to create Connection helper instance", localInstantiationException);
Log.i(TAG, "onServiceConnectionResponse: CONNECTION_FAILED");
onServiceConnectionResponse(null, 1027);
return false;
}
catch (IllegalAccessException localIllegalAccessException)
{
while (true)
Log.e(TAG, "Unable to create Connection helper instance", localIllegalAccessException);
}
catch (IllegalArgumentException localIllegalArgumentException)
{
while (true)
Log.e(TAG, "Unable to create Connection helper instance", localIllegalArgumentException);
}
catch (InvocationTargetException localInvocationTargetException)
{
while (true)
Log.e(TAG, "Unable to create Connection helper instance", localInvocationTargetException);
}
catch (NoSuchMethodException localNoSuchMethodException)
{
while (true)
Log.e(TAG, "Unable to create Connection helper instance", localNoSuchMethodException);
}
}
Interesting, you have dug deeper than anyone has so far.
I would love to get my gear working with CM10.2, ill provide a logcat of the pair up sequence from my i9505.
Ive got the gear working with my Sprint LG G2.
Just the phone, camera, alarm, and find my gear.
Other than that.... No notifications...
But hey.... It works for the most part.
Im on stock rooted
Edit::::: camera transfer also works as well. Pedometer is working too.
Any suggestions to get anything else working
THE SPRINT LG G2
Services I got via the android.os.ServiceManager
Code:
com.orange.authentication.simcard, iphonesubinfo, simphonebook, isms,
sec_analytics, edmnativehelper, dreams, voip, motion_recognition,
commontime_management, samplingprofiler, AtCmdFwd, diskstats,
appwidget, backup, uimode, serial, usb, audio, dropbox, search,
country_detector, location, devicestoragemonitor, notification, updatelock,
throttle, servicediscovery, connectivity, wifi, wifip2p, netpolicy, netstats,
textservices, network_management, clipboardEx, clipboard, statusbar,
harmony_eas_service, enterprise_policy, phone_restriction_policy, wifi_policy,
application_policy, license_log_service, enterprise_license_policy,
log_manager_service, device_policy, lock_settings, mount, accessibility,
input_method, bluetooth_secure_mode_manager, bluetooth_manager, input,
window, scontext, context_aware, alarm, CustomFrequencyManagerService,
vibrator, battery, hardware, DirEncryptService, content, account, user,
permission, cpuinfo, dbinfo, gfxinfo, meminfo, activity, package,
container_service, scheduling_policy, display, usagestats, batteryinfo, power,
entropy, mdm.remotedesktop, sensorservice, media.audio_policy, media.camera,
media.player, media.audio_flinger, drm.drmManager, SurfaceFlinger,
Exynos.IPService, Exynos.HWCService, sensorhubservice
These are the two I'm working with: bluetooth_secure_mode_manager, bluetooth_manager
Inspired by these SO posts:
http://stackoverflow.com/questions/3462968/how-to-unpair-bluetooth-device-using-android-2-1-sdk
http://stackoverflow.com/questions/...s-bluetooth-pairing-notification-when-i-am-do
you can use Media Remote to control music.
it actually works better for me then stock media controller because stock would randomly connect to samsungs music player when i would try to pause google music. looks great and easier to change volume to.
So what else are we missing to get this working?
Looks to me like we could get v1.2 and earlier working if a few days of effort is put into it.
I feel like it'd be smarter to try and get v1.4 and newer working on any/every 4.3 ROM.
Interesting file, /data/misc/bluedroid/bt_config.xml
It seems to have entries for paired devices:
Code:
1|[email protected]:/data/misc/bluedroid # cat bt_config.xml
<Bluedroid>
<N1 Tag="Local">
<N1 Tag="Adapter">
<N1 Tag="BluezMigrationDone" Type="int">1</N1>
<N2 Tag="Address" Type="string">d8:90:e8:a1:d1:8a</N2>
<N3 Tag="LE_LOCAL_KEY_IR" Type="binary">cbecbe53c50e625e2dfae3d9c42ada8c</N3>
<N4 Tag="LE_LOCAL_KEY_IRK" Type="binary">8e440b86e530d829c6d342e4f74b4367</N4>
<N5 Tag="LE_LOCAL_KEY_DHK" Type="binary">96430ff5e6a12d7b384e13f4b66370a3</N5>
<N6 Tag="LE_LOCAL_KEY_ER" Type="binary">ecbe709bdc01402baf495173dcd38009</N6>
<N7 Tag="ScanMode" Type="int">1</N7>
<N8 Tag="DiscoveryTimeout" Type="int">0</N8>
<N9 Tag="Name" Type="string">GALAXY Gear (D18A)</N9>
</N1>
<N2 Tag="AutoPairBlacklist">
<N1 Tag="AddressBlacklist" Type="string">00:02:C7,00:16:FE,00:19:C1,00:1B:FB,00:1E:3D,00:21:4F,00:23:06,00:24:33,00:A0:79,00:0E:6D,00:13:E0,00:21:E8,00:60:57,00:0E:9F,00:12:1C,00:18:91,00:18:96,00:13:04,00:16:FD,00:22:A0,00:0B:4C,00:60:6F,00:23:3D,00:C0:59,00:0A:30,00:1E:AE,00:1C:D7,00:80:F0,00:12:8A,00:09:93,00:80:37,00:26:7E,08:76:95,00:1E:B2
</N1>
<N2 Tag="ExactNameBlacklist" Type="string">Motorola IHF1000,i.TechBlueBAND,X5 Stereo v1.3,KML_CAN
</N2>
<N3 Tag="PartialNameBlacklist" Type="string">BMW,Audi,Parrot,Car,CAR,
</N3>
<N4 Tag="FixedPinZerosKeyboardBlacklist" Type="string">00:0F:F6
</N4>
</N2>
</N1>
<N2 Tag="Remote">
<N1 Tag="d8:90:e8:e2:85:38">
<N1 Tag="Manufacturer" Type="int">15</N1>
<N2 Tag="LmpVer" Type="int">6</N2>
<N3 Tag="LmpSubVer" Type="int">24841</N3>
<N4 Tag="Name" Type="string">hugcdghTest1 hgsd (SM-</N4>
<N5 Tag="DevClass" Type="int">5898764</N5>
<N6 Tag="DevType" Type="int">1</N6>
<N7 Tag="LinkKeyType" Type="int">5</N7>
<N8 Tag="PinLength" Type="int">0</N8>
<N9 Tag="LinkKey" Type="binary">64a080f6e8a49e070cbf796a29273e12</N9>
<N10 Tag="Service" Type="string">0000110a-0000-1000-8000-00805f9b34fb 00001105-0000-1000-8000-00805f9b34fb 00001115-0000-1000-8000-00805f9b34fb 0000112f-0000-1000-8000-00805f9b34fb 00001112-0000-1000-8000-00805f9b34fb 0000111f-0000-1000-8000-00805f9b34fb 00001132-0000-1000-8000-00805f9b34fb a49eb41e-cb06-495c-9f4f-bb80a90cdf00 </N10>
</N1>
<N2 Tag="50:46:5d:7c:ab:58">
<N1 Tag="Name" Type="string">Nexus 7</N1>
<N2 Tag="Manufacturer" Type="int">15</N2>
<N3 Tag="LmpVer" Type="int">6</N3>
<N4 Tag="LmpSubVer" Type="int">16643</N4>
<N5 Tag="DevClass" Type="int">1704212</N5>
<N6 Tag="DevType" Type="int">1</N6>
</N2>
</N2>
</Bluedroid>
[email protected]:/data/misc/bluedroid #
Hi mate I ended up rooting my nexus got the gear manager to load up once but the watch never connected then haven't been able to run gear manager again , any suggestions
Sent from my Nexus 4 using xda app-developers app
beagle1974 said:
Hi mate I ended up rooting my nexus got the gear manager to load up once but the watch never connected then haven't been able to run gear manager again , any suggestions
Sent from my Nexus 4 using xda app-developers app
Click to expand...
Click to collapse
Which APKs did you sideload? All of the accessory ones?
I just got some success, I was able to pair my Nexus 7 with the smartwatch without having to reset. I am not entirely sure how I was able to do this, but I believe it might be by running this app here:
http://stackoverflow.com/questions/14228289/android-device-bluetooth-pairing
And then using that to unpair / removeBond the current device it was paired with. Then when I go to pair with the Nexus, I guess it figures something is better than nothing.
ANyways... progress.
I get to 0/2 but, when I try connecting via manually it fails...can some please explain how to connect manuallly
htc fan89 said:
I get to 0/2 but, when I try connecting via manually it fails...can some please explain how to connect manuallly
Click to expand...
Click to collapse
Try following the instructions here. Make sure you install the shared preferences.
let us know how it goes.
cheers

How to get access to System folders when making a new app?

Does anyone know how to get access to system folders when making a new app? I am trying to create a new Ad Blocking application for windows (Based on AdAway from android) but cannot get permissions to write to C:\Windows\System32\DRIVERS\ETC\HOSTS.
Can anyone help me out super quick?
sandix said:
Does anyone know how to get access to system folders when making a new app? I am trying to create a new Ad Blocking application for windows (Based on AdAway from android) but cannot get permissions to write to C:\Windows\System32\DRIVERS\ETC\HOSTS.
Can anyone help me out super quick?
Click to expand...
Click to collapse
send your code to access that folder + your app CAPABILITIES to make it faster to answer you . .
I think you have to add many Second_Party and First_PARTY capabilities to your app .
ngame said:
send your code to access that folder + your app CAPABILITIES to make it faster to answer you . .
I think you have to add many Second_Party and First_PARTY capabilities to your app .
Click to expand...
Click to collapse
Is that for the AppxManifest.xml file? Where and what do I add?
ngame said:
send your code to access that folder + your app CAPABILITIES to make it faster to answer you . .
I think you have to add many Second_Party and First_PARTY capabilities to your app .
Click to expand...
Click to collapse
I am using this to write to the AppData folder for my app, but can I do something similar to get to the \Windows\System32\DRIVERS\etc folder?
Code:
private async Task WriteToFile(string content)
{
// Get the text data from the textbox.
byte[] fileBytes = System.Text.Encoding.UTF8.GetBytes(content.ToCharArray());
// Get the local folder.
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
// Create a new folder name DataFolder.
var dataFolder = await local.CreateFolderAsync("DataFolder",
CreationCollisionOption.OpenIfExists);
// Create a new file named DataFile.txt.
var file = await dataFolder.CreateFileAsync("hosts.txt",
CreationCollisionOption.ReplaceExisting);
// Write the data from the textbox.
using (var s = await file.OpenStreamForWriteAsync())
{
s.Write(fileBytes, 0, fileBytes.Length);
}
}
sandix said:
I am using this to write to the AppData folder for my app, but can I do something similar to get to the \Windows\System32\DRIVERS\etc folder?
Code:
private async Task WriteToFile(string content)
{
// Get the text data from the textbox.
byte[] fileBytes = System.Text.Encoding.UTF8.GetBytes(content.ToCharArray());
// Get the local folder.
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
// Create a new folder name DataFolder.
var dataFolder = await local.CreateFolderAsync("DataFolder",
CreationCollisionOption.OpenIfExists);
// Create a new file named DataFile.txt.
var file = await dataFolder.CreateFileAsync("hosts.txt",
CreationCollisionOption.ReplaceExisting);
// Write the data from the textbox.
using (var s = await file.OpenStreamForWriteAsync())
{
s.Write(fileBytes, 0, fileBytes.Length);
}
}
Click to expand...
Click to collapse
You have to use
StorageFileFile.GetFilefromPath("c:\\ window\\syste32\\drivers\\etc\\Hosts");
This will let you access this storage file if you use correct capabilities on wmappmanfest
I assume that the proper capabilities need to be manually entered into that file?
If so what ones do I need? Because a lot of the ones I've tried give me errors (invalid capabilities)
CAN A MOD PLEASE CLOSE THIS THREAD, I WAS ABLE TO FIGURE THIS OUT ON MY OWN.
Thanks!

Help enabling downloads through webview (Kotlin)

Good day. I'm new to android development and I'm trying to develop a simple webview application, picked a nice template and went through the steps and made good progress, I managed to load my site fully and enable javascript, that works as intended, however I'm not able to make the app download anything, I host a few pdf files that should open or download through it, but nothing happens.
I looked at a few answers here and it is to my understanding that I need to specifically add a function for that, could you give me a hand? I have tried multiple different code and tweaking them, but I wasn't able to get it to work, here is my base code:
Code:
package com.logista.test.ui.home
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.webkit.WebResourceRequest
import android.webkit.WebView
import android.webkit.WebViewClient
import android.app.DownloadManager
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.logista.test.R
class HomeFragment : Fragment() {
private lateinit var homeViewModel: HomeViewModel
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
homeViewModel =
ViewModelProvider(this).get(HomeViewModel::class.java)
val root = inflater.inflate(R.layout.fragment_home, container, false)
val myWebView: WebView = root.findViewById(R.id.webview)
myWebView.webViewClient = WebViewClient()
myWebView.settings.javaScriptEnabled = true
myWebView.loadUrl("https://www.example.org/")
return root
}
}
I believe I should be adding
Code:
import android.app.DownloadManager
And tweak this
Code:
// Set web view download listener
web_view.setDownloadListener(DownloadListener {
url,
userAgent,
contentDescription,
mimetype,
contentLength ->
// Initialize download request
val request = DownloadManager.Request(Uri.parse(url))
// Get the cookie
val cookies = CookieManager.getInstance().getCookie(url)
// Add the download request header
request.addRequestHeader("Cookie",cookies)
request.addRequestHeader("User-Agent",userAgent)
// Set download request description
request.setDescription("Downloading requested file....")
// Set download request mime tytpe
request.setMimeType(mimetype)
// Allow scanning
request.allowScanningByMediaScanner()
// Download request notification setting
request.setNotificationVisibility(
DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
// Guess the file name
val fileName = URLUtil.guessFileName(url, contentDescription, mimetype)
// Set a destination storage for downloaded file
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName)
// Set request title
request.setTitle(URLUtil.guessFileName(url, contentDescription, mimetype));
// DownloadManager request more settings
request.setAllowedOverMetered(true)
request.setAllowedOverRoaming(false)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
request.setRequiresCharging(false)
request.setRequiresDeviceIdle(false)
}
request.setVisibleInDownloadsUi(true)
// Get the system download service
val dManager = getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
// Finally, request the download to system download service
dManager.enqueue(request)
})
// Load button click listener
button_load.setOnClickListener{
// Load url in a web view
web_view.loadUrl(url)
}
}
Taken from here: https://android--code.blogspot.com/2018/03/android-kotlin-webview-file-download.html
I did the basics, renaming the function accordingly and such, but it gives me quite a few errors when building the app, for instance uri isn't defined, cookiemanager isn't defined, environment isn't defined, build isn't defined, and such, could you give me some guidance?

Categories

Resources