TrackMe's web development and user plugins. Developers welcome!! - Windows Mobile Development and Hacking General

As some people suggested I'm creating an specific thread for TrackMe's web development.
TrackMe is a free GPS/WiFi/Cell ID tracking tool. You can watch your tracks (saved or live) with Google Earth, Google Maps (or any tool that accepts KML or GPX files). It also includes many other options and features.
You can also watch your tracks from the web. This thread is focused on that part.
TrackMe is available for Android, Windows Mobile and Windows Phone 7. Check my signature for support for each version.
Visit TrackMe's main thread
If you are interested you can contribute working on one of the existing viewers or creating one of your own.
OFFICIAL RELEASE
Authors
OpitZle, pammetje, mcross, jcleek and _LEM_ (only TrackMe client<->server communication)
Database
MySQL
Language
PHP
Download
Press here to download the latest version
Screenshots
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}

Here is some description for the TrackMe-Server communication
Requests.xxx file
Code:
All requests
------------
Result:1 User correct, invalid password.
Result:2 User did not exist but after being created couldn't be found.
Result:3 User or password not specified.
Result:4 Unable to connect database.
Result:5 Incompatible database.
Action="delete"
---------------
Result:0 OK
Action="deletetrip"
-------------------
Result:0 OK
Result:6 Trip not specified.
Result:7 Trip not found
Action="addtrip"
----------------
Result:0 OK
Result:6 Trip not specified.
Action="renametrip"
------------------
Result:0 OK
Result:6 Trip not specified.
Result:7 New name not specified.
Action="findclosestbuddy"
-------------------------
Result:0|DISTANCE|DATEOCCURRED|USERID
Result:6 User has no positions.
Result:7 No positions from other users found.
Action="gettriplist"
------------------
Result:0|NAME1|DATE2\nNAME2\DATE2\n ...
Result:6 Trip not specified.
Result:7 New name not specified.
Action="geticonlist"
------------------
Result:0|ICON1|ICON2|ICON3 ...
Action="upload"
------------------
Result:0 OK
Result:6 Trip didn't exist and system was unable to create it.
Result:7|SQLERROR Insert statement failed.
Action="sendemail"
------------------
Result:0 OK
Action="updateimageurl"
------------------
Result:0 OK
Action="findclosestpositionbytime"
----------------------------------
Result:0|POSITIONID|DATEOCCURRED
Result:6 Date not specified
Result:7 No position for user found.
Action="findclosestpositionbyposition"
--------------------------------------
Result:0|POSITIONID|DATEOCCURRED|DISTANCE
Result:6 Position not specified
Result:7 No position for user found.
Action="gettripinfo"
--------------------
Result:0|totalmiles|startdate|enddate|totaltime|totalpositions|maxspeed|avgspeed|maxaltitude|avgaltitude|minaltitude
Result:6 Trip not specified
Result:7 Trip not found
Action="gettriphighlights"
--------------------------
Result:0|Latitude1|Longitude1|ImageURL1|Comments1|IconURL1\nLatitude2|Longitude2|ImageURL2|Comments2|IconURL2\n ...
Result:6 Trip not specified
Result:7 Trip not found
I will be adding the rest of the files later...

Plugins
1. TrackMe (NMEA records) to OziExplorer (.plt) converter by tahdor
Description:
Simple perl script which takes the TrackMe (NMEA records) and put them as OziExplorer (.plt) format. Then you can open the .plf record in GpsVp to view the track.
Code:
# TrackMe.To.GpsVp.pl
#
$pll_ifname = "/Program Files/TrackMe/gpspositions.txt";
$pll_ofpath = "/Storage Card/Maps gpxVPTracks/";
#$pll_ifname = "gpspositions.txt";
#$pll_ofpath = "";
$pll_ofname = "gpspositions.plt";
$pll_ofname_date = "";
$maxtrack = 12;
sub pls_open_infile {
local ($pll_ifname, *PLL_F_IN_FPTR) = @_;
if (! open (PLL_F_IN_FPTR, "$pll_ifname")) {
warn "$pll_ifname: $!\n";
return -1;
}
return 0;
}
sub pls_open_outfile_overwrite {
local ($pll_outfname, *PLL_F_OUT_FPTR) = @_;
if (!open (PLL_F_OUT_FPTR, ">$pll_outfname")) {
warn "$pll_outfname: $!\n";
# die "$pll_outfname: $!\n";
return -1;
}
return 0;
}
sub pls_open_outfile_append {
local ($pll_outfname, *PLL_F_OUT_FPTR) = @_;
if (!open (PLL_F_OUT_FPTR, ">>$pll_outfname")) {
warn "$pll_outfname: $!\n";
# die "$pll_outfname: $!\n";
return -1;
}
return 0;
}
if (&pls_open_infile($pll_ifname, PLL_F_IN_FPTR) < 0) {
die "couldn't open output file $pll_ifname\n";
}
if (&pls_open_outfile_overwrite($pll_ofname, PLL_F_OUT_FPTR) < 0) {
die "couldn't open output file $pll_ofname\n";
}
sub output {
if ("$lat_rmc" ne "0") {
print PLL_F_OUT_FPTR sprintf ("%2.7f,%2.7f,0,%3.1f,%d,%s,%s\n", $lat_rmc,
$long_rmc, $alt_gga * 3.2808399, 0, $date, $time_rmc);
}
}
sub latitude {
my ($deg, $min) = unpack "a2a*", $_[0];
my $lat = $deg + $min / 60;
$lat = - $lat if $_[1] =~ /[Ss]/;
return $lat;
}
sub longitude {
my ($deg, $min) = unpack "a3a*", $_[0];
my $long = $deg + $min / 60;
$long = - $long if $_[1] =~ /[Ww]/;
return $long;
}
while ($line = <PLL_F_IN_FPTR>) {
chomp($line);
@field = split /[,*]/, $line;
SWITCH: {
# recommended minimum specific GPS/Transit data
if ($field[0] =~ /GPRMC/) {
# $time_rmc = join ':', unpack "a2" x 3, $field[1];
$time_rmc = join '.', unpack "a2" x 3, $field[1];
$ok_rmc = $field[2];
$lat_rmc = latitude(@field[3..4]);
$long_rmc = longitude(@field[5..6]);
$speed = $field[7];
$cmg = $field[8];
#$date = join '-', unpack "a2" x 3, $field[9];
$date = substr($field[9],4,2) .'-'. substr($field[9],2,2) .'-'. substr($field[9],0,2);
$mvar = $field[10] . $field[11];
# field[12] is checksum
if ($date ne $pll_ofname_date) {
$pll_ofname = $pll_ofpath . "Tm.$date.$time_rmc.plt";
$pll_ofname_date = $date;
if (&pls_open_outfile_overwrite($pll_ofname, PLL_F_OUT_FPTR) < 0) {
die "couldn't open output file $pll_ofname\n";
}
print PLL_F_OUT_FPTR "OziExplorer Track Point File Version 2.1\n";
print PLL_F_OUT_FPTR "WGS 84\n";
print PLL_F_OUT_FPTR "Altitude is in Feet\n";
print PLL_F_OUT_FPTR "Reserved\n";
print PLL_F_OUT_FPTR "0,2,128,,0,0,2,0\n";
print PLL_F_OUT_FPTR "1\n";
}
output();
last SWITCH;
}
# GPS fix data
if ($field[0] =~ /GPGGA/) {
$time_gga = join ':', unpack "a2" x 3, $field[1];
$lat_gga = latitude(@field[2..3]);
$long_gga = longitude(@field[4..5]);
$fixqual = $field[6];
$nsat = $field[7];
$hdop_gga = $field[8];
$alt_gga = $field[9];
# $field[10] is altitude units (always M)
$gheight = $field[11];
# $field[12] is geoid height units (always M)
$DGPS_age = $field[13];
$DGPS_ID = $field[14];
# field[15] is checksum;
last SWITCH;
}
}
}
2. User limitation for web viewer access by Real_Justus
Description:
Limit access to Web viewer for servers running in public mode
I was wondering how I could limit the access to my server. I wanted a group of users to be able to track all TrackMe clients via GoogleMaps.
The attached three files will enable a simple authorization for users. The server has to be installed accessable for everyone (public).
To create the authorziation, you have to edit .htaccess and htpasswd from the ZIP attached as follows:
1: Open .htaccess with the texteditor.
2: In the line "AuthUserFile" you have to add the WHOLE path to .htpasswd.
3: .htpasswd contains the users. The username is just plain text. The password is ht-encrypted. You can encrypt passwords here.
4: When both files are modifyed for your needs, upload them to the TrackMe directory on your server. If this is done correctly, a simple authorization is required for opening the webinterface for your TrackMe-server. All valid users can Track all clients.
If you don´t know the exactly path, upload phpinfo.php from the ZIP attached to the TrackMe directory on your server and open the file in your browser. (http://www.yourserver.com/TrackMe/phpinfo.php). Search for "Document_ Root" The path might be something like: /var/www/user/html/YourTrackMe/Directory. Insert the path in .htaccess
!!!Make sure to delete the phpinfo.php after use!!!
Files: Download
3. Plugin that allows you to assign multiple pictures to a single position by ElHozo
Description:
I've made a change in tod files of the server to allow view of multiple pictures in on dialog ballon. This (at least for me) is very usefull when you want to take many pictures from one place (no position change)
You have to edit to files
in request.php make this change to allow having multiples images in one single position record
Code:
if($action=="updateimageurl")
{
$imageurl = urldecode($_GET["imageurl"]);
$id = urldecode($_GET["id"]);
$iconid='null';
$result=mysql_query("Select ID FROM icons WHERE name = 'Camera'");
if ( $row=mysql_fetch_array($result) )
$iconid=$row['ID'];
/* HOZO 20/Jun/2009 : Esta es la modficacion que permite poner mas de una
* imagen en un solo punto, pone las url una atras de otra saparadas por un
* espacio. la linea que queda comentada es la original.
* Ver en index.php el cambio que las muestra en el globo del dialogo */
// BEGIN ORIGINAL CODE - MUST BE COMMENTED
//mysql_query("update positions set imageurl='$imageurl',fk_icons_id=$iconid where id=$id");
// END ORIGINAL CODE
// BEGIN NEW CODE
mysql_query("update positions set imageurl=CONCAT_WS(' ', imageurl, TRIM('".$imageurl."')), fk_icons_id='".$iconid."' where id='".$id."'");
// END NEW CODE
echo "Result:0";
die();
}
in index.php change this to show multiple images in one dialog balloon
Code:
if($row['ImageURL'])
{
/* HOZO 20/Jul/2009 : Agregar este pedazo de codigo en reemplazo del orginal,
* la ultima linea que esta comentada es la orgiinal.*/
// BEGIN NEW CODE
// Por las dudas me aseguro de eliminar espacios duplicados
$row['ImageURL'] = eregi_replace (" ", " ", $row['ImageURL']);
$row['ImageURL'] = eregi_replace (" ", " ", $row['ImageURL']);
$stFotos = explode (" ", trim($row['ImageURL']));
// Armo la cantidad de columnas y tamaño de la imagen del globo
// de acuerdo a la cantidad de fotos que haya para mostrar
if (count ($stFotos) == 1)
{
$inFotosCols = 1;
$inImgWidth = 200;
}
else
{
$inFotosCols = count ($stFotos);
if ($inFotosCols > 16)
$inFotosCols = 5;
else if ($inFotosCols > 9)
$inFotosCols = 4;
else if ($inFotosCols > 3)
$inFotosCols = 3;
$inImgWidth = ( 400 / $inFotosCols ) - 5;
}
$html .= "<tr><td>";
$html .= "<table>";
$inFotoIndex = 0;
while (list ($inKey, $szData) = each ($stFotos))
{
if ( ($inFotoIndex % $inFotosCols) == 0)
$html .= "<tr>";
$inFotoIndex++;
$html .= "<td><a><img></a></td>";
if ( ($inFotoIndex % $inF";
}
$html .= "</tr>";
$html .= "</table>";
$html .= "</td>";
$html .= "</tr>";
// END NEW CODE
// La que sigue es la linea orignal de codigo
// BEGIN ORIGINAL CODE - MUST BE COMMENTED
//$html .= " <tr><td><a><img></a></td></tr>";
// END ORIGINAL CODE
}
Know issues : The filed imgeurl in DB is limited to 255 chars, is better if you change this value to something bigger to fit more images urls.
I have included a ZIP with the two modified files
Files: Download

Great new thread!
Let the development begin!

With the advice of timoline I'm playing (and I'm trying to understand) with open-flash-chart.
Here is my first try :
When you move the mouse on the graphic, there is a sticker with the speed.
I'm trying to add the altitude on red with the Y axis right. But It doesn't works for now.
Thanks for your advice Timoline .

Is there some sort of ocumentation about the TrackMe <-> Webserver communication? It would be nice if you can write a little about this.
I point as I browsed the source I saw that the password was transmit unencrypted maybe you can change that to md5 or somthing similar?
Btw. Trackme is a great App

Diggen said:
Is there some sort of ocumentation about the TrackMe <-> Webserver communication? It would be nice if you can write a little about this.
I point as I browsed the source I saw that the password was transmit unencrypted maybe you can change that to md5 or somthing similar?
Btw. Trackme is a great App
Click to expand...
Click to collapse
Thanks.
Unfortunately there is not doc about the server-client communication.
However, feel free to ask any questions about that here.
Regarding the encrypted pass... yes, that's in the to-do list (actually it has been there for a long time) but there is something that I want to ask.
Let's suppose that from the client I do $encrypted = encode_md5(password)
And now that's what I send to the server.
On the server side, should I do $pass = decode_md5 ($encrypted) ?
or it's not necessary because I am going to store the pass already encrypted in the database?
And one more thing, what's really the purpose of that encoding? If somebody has access to the encrypted password, wouldn't he be able to do the same things than if it is not encrypted?
I mean if I my password is role392 and the encryped one is sadj2jkfDk43j54... what's really the difference? Both are like regular passwords.
I hope it makes sense.

It makes more or less sense
Normal a webapp stores the password 'encrypted' with md5 in its Database. From the Login it gets clearly send per Post and the server will 'encrypt' it. Then it verfy it against the md5 hash in the db. You will be still able to sniff it but if the DB gets hacked you will only have the md5 values which can't be decoded. Also because of the Post-Method the Pass is not clearly visible in the URL.
Thats not much secruity but a little more. Maybe you can XOR the md5 with the actuall hour/minute at the client side and send it. At server-side you will do the same with the saved md5 an look if they are the same. This is a little more secure but not much.
I hope you understand me and my 'broken' Englisch
For the Docs I will have a look at the code when there is Time because I'am on a tenancy changeover(?).

Language Update
I've updated the dutch part in the language.php from jcleek's web viewer.
See attachment:

I've been working on my own server development, at the moment I have:
1. Weather at the persons current or last postion.
2. Address of the persons current or last position (I think US only)
3. Geofence option that texts whoever the user wants to text when the user has entered a predefined area.
4. Ability to place markers on the map for whatever purpose the user chooses, business, personal or otherwise.
5. The server stores the mileage driven in each state or country if the user chooses for fuel tax or other reasons.
6. Server is not just limited to Trackme, it can also be an alturl for Mologogo, and a custom server for GPSGate. Server still retains all Trackme functionality.
http://fleettracking.fleettrack.net/maps.php
The frontend is still a little "raw", as I am concentrating on the back end for the moment.

Diggen said:
It makes more or less sense
Normal a webapp stores the password 'encrypted' with md5 in its Database. From the Login it gets clearly send per Post and the server will 'encrypt' it. Then it verfy it against the md5 hash in the db. You will be still able to sniff it but if the DB gets hacked you will only have the md5 values which can't be decoded. Also because of the Post-Method the Pass is not clearly visible in the URL.
Thats not much secruity but a little more. Maybe you can XOR the md5 with the actuall hour/minute at the client side and send it. At server-side you will do the same with the saved md5 an look if they are the same. This is a little more secure but not much.
I hope you understand me and my 'broken' Englisch
For the Docs I will have a look at the code when there is Time because I'am on a tenancy changeover(?).
Click to expand...
Click to collapse
Thanks a lot for the detailed explanation!!
I think I will start by encoding it in MD5 only in the database. I may add the XOR later.
Regards

WatskeBart said:
I've updated the dutch part in the language.php from jcleek's web viewer.
See attachment:
Click to expand...
Click to collapse
Thanks for that but I think you forgot to include that attachment.

Go3Team said:
I've been working on my own server development, at the moment I have:
1. Weather at the persons current or last postion.
2. Address of the persons current or last position (I think US only)
3. Geofence option that texts whoever the user wants to text when the user has entered a predefined area.
4. Ability to place markers on the map for whatever purpose the user chooses, business, personal or otherwise.
5. The server stores the mileage driven in each state or country if the user chooses for fuel tax or other reasons.
6. Server is not just limited to Trackme, it can also be an alturl for Mologogo, and a custom server for GPSGate. Server still retains all Trackme functionality.
http://fleettracking.fleettrack.net/maps.php
The frontend is still a little "raw", as I am concentrating on the back end for the moment.
Click to expand...
Click to collapse
hey looks good!! Let me know when you have something to release so I can add your viewer in the first post.
Thanks a lot for your contribution.
and please keep us updated!

Not so detailed but some basics maybe you will have a look at http://en.wikipedia.org/wiki/Md5 or http://en.wikipedia.org/wiki/Sha-1
Another thing, is it possible to have the server running on an selfsigned ssl server ?
The next point is. I've made a list of functions/ requests required by TrackMe on the Serverside.
Can you have a look at it staryon? The other aswell
I hope I made no mistake and all is there also its not very well layouted but better than nothing. Some function doesn't have an errorcode is this right? or not implentet a serverside?

Diggen said:
Not so detailed but some basics maybe you will have a look at http://en.wikipedia.org/wiki/Md5 or http://en.wikipedia.org/wiki/Sha-1
Another thing, is it possible to have the server running on an selfsigned ssl server ?
The next point is. I've made a list of functions/ requests required by TrackMe on the Serverside.
Can you have a look at it staryon? The other aswell
I hope I made no mistake and all is there also its not very well layouted but better than nothing. Some function doesn't have an errorcode is this right? or not implentet a serverside?
Click to expand...
Click to collapse
Unless I missed something it looks ok to me.
I just updated the second post inside this thread with information about the server-client communication.
Please let me know if you need information about a specific parameter.
Cheers

staryon said:
Unless I missed something it looks ok to me.
I just updated the second post inside this thread with information about the server-client communication.
Please let me know if you need information about a specific parameter.
Cheers
Click to expand...
Click to collapse
The only things which are from interest as well are the Date / Long / Lat / .... dataformats, but they are all in the DB like they transmited, if I am right?
Maybe one last thing have you some testing app or something else to test the communication without Trackme and the Phone because my Dataplan is not unlimited. Else I will make manual Request iin the webbrowser.
thanks for your quick responses
EDIT:
Ok found out some Formats
Date - YYYY-MM-DD HH:MM:SS
lon/lat - xx.XXXXXX -
WGS48 ? - but then the dot is moved 2 left and there are no East,West,Nord,South data? Can you help me here with the format?
BatteryStatus in % 0-100
Singalstrengh in dB ? -xxx
CID - X-X-XXX-XXXXX
For these I've no Data because there are no Trips with GPS in the DB, waiting for my X1.
Speed
Angle
Altitude

Diggen said:
Maybe one last thing have you some testing app or something else to test the communication without Trackme and the Phone because my Dataplan is not unlimited. Else I will make manual Request iin the webbrowser.
Click to expand...
Click to collapse
No, I don't have anything. Actually when I was developing the program I used the web browser as well.
Diggen said:
lon/lat - xx.XXXXXX -
WGS48 ? - but then the dot is moved 2 left and there are no East,West,Nord,South data? Can you help me here with the format?
Click to expand...
Click to collapse
The format is in decimal degrees.
Where 32.30642° N = 32.30642
or 122.61458° W = -122.61458
(I mean W and S are negative)
Diggen said:
BatteryStatus in % 0-100
Click to expand...
Click to collapse
Yes
Diggen said:
Singalstrengh in dB ? -xxx
Click to expand...
Click to collapse
yes, dBm.
Diggen said:
CID - X-X-XXX-XXXXX
Click to expand...
Click to collapse
MobileCountryCode-MobileNetworkCode-LocationAreaCode-CellID
Hope it helps!

Diggen said:
EDIT:
Ok found out some Formats
Date - YYYY-MM-DD HH:MM:SS
lon/lat - xx.XXXXXX -
WGS48 ? - but then the dot is moved 2 left and there are no East,West,Nord,South data? Can you help me here with the format?
BatteryStatus in % 0-100
Singalstrengh in dB ? -xxx
CID - X-X-XXX-XXXXX
For these I've no Data because there are no Trips with GPS in the DB, waiting for my X1.
Speed
Angle
Altitude
Click to expand...
Click to collapse
Here is how the GET is given to the server (this is an actual one pulled from my logs). I use CDMA, so I can't use CELLID:
requests.php?a=upload&u=xxxxxxxx&p=xxxxxxx&lat=37.54446&long=-76.8039466666667&do=2009-2-2%209:18:19&tn=02-01-09&alt=-31.4&sp=&ang=77.2&bs=100&db=8
I round the lat and lon to 5 places after the decimal as anything more is just wasted db usage.

Go3Team said:
I round the lat and lon to 5 places after the decimal as anything more is just wasted db usage.
Click to expand...
Click to collapse
You're right, I would like to truncate those values before being sent to the server one day...

staryon said:
Here is some description for the TrackMe-Server communication
Action="upload"
------------------
Result:0 OK
Result:6 Trip didn't exist and system was unable to create it.
Result:7|SQLERROR Insert statement failed.
Click to expand...
Click to collapse
I was wondering why the server was returning bytes to the client, and was trying to track down to see if it was an error. I am corrent when a Result:0 is returned, that everything was done fine?

Related

[NewRelease] InitLauncher - [HKLM\Init]LaunchXX wrapper

Launching programs using [HKLM\Init]LaunchXX instead of links in \windows\StartUp folder causes some problems. It saves vital resources (slots for running programs, which are limited under WM5 to (AFAIR) 32), but doesn't allow to specify command line parameters and it adds one paramter (number XX), which can be not misunderstood by application. Application should issue SignalStarted(). Things are described here: http://msdn2.microsoft.com/en-us/library/ms901773.aspx. I'm not sure, but in WM6 it is not a problem - there are thousands (or more) of slots.
InitLauncher.exe can solve them.
Simplest configuration:
Code:
[HKEY_LOCAL_MACHINE\init]
"Launch96"="InitLauncher.exe"
"App96"="ARGc.exe"
It immediately launches ARGc.exe without parameters.
Something more complicated:
Code:
[HKEY_LOCAL_MACHINE\init]
"Launch96"="InitLauncher.exe"
"App96"="ARGc.exe"
"Params96"="\"Launched as 96\" SecondParam"
"Delay96"=dword:4e20
It launches ARGc.exe with two parameters 20 seconds (==20.000ms) after system start.
InitLaunch:
- sleeps Delay** miliseconds,
- executes program specified as App** with optional parameters Params**,
- sleeps DelayEx** miliseconds (not shown above)
- and issues SignalStarted(**).
Last example:
Code:
[HKEY_LOCAL_MACHINE\init]
"Launch96"="InitLauncher.exe"
"App96"="ARGc.exe"
"Params96"="\"Launched as 96\""
"Delay96"=dword:4e20
"DelayEx96"=dword:2710
"Launch97"="InitLauncher.exe"
"App97"="ARGc.exe"
"Params97"="\"Launched as 97\""
"Delay97"=dword:4e20
"Launch98"="InitLauncher.exe"
"Depend98"=hex:60,00
"App98"="ARGc.exe"
"Params98"="\"Launched as 98\" SecondParam ThirdOne"
Bootstrap procedure starts two instances of InitLauncher (96 and 97). They are both waiting 20 seconds and they are executing ARGc.exe. Instance 97 exits (issuing SignalStarted(97)), instance 96 sleeps extra 10 seconds and issues SignalStarted(96). Bootstrap procedure (just after SignalStarted(96)) starts instance 98 of InitLauncher, which immediately runs ARGc,exe and exits.
Feel free to use in your ROMs. All parameters except AppXX are optional.
Attached archive:
InitLauncher.exe - main app. Compiled for WM2005
InitLauncher.cpp - source
ARGc.exe - for debugging purposes only
Test_InitLauncher.reg - the las example.
great thing, if it works
to sie moze przydac
Proponuje dac info na pdaclub.pl .
Wowz, great news, will link it from the Safe Mode Bible ( http://www.pocketpcmag.com/blogs/index.php?blog=3&p=1255&more=1&c=1&tb=1&pb=1 ) and also frontpage it in the PPCMag blog!
nothin said:
great thing, if it works
to sie moze przydac
Proponuje dac info na pdaclub.pl .
Click to expand...
Click to collapse
Not interesting for non-polish users.
Myślę, że nie ma sensu. Programik jest w zasadzie bezużyteczny dla "szarego" użytkownika. Może co poniektórzy programiści mogliby skorzystać, a sens ma przede wszystkim dla nowych, smażonych romów.
Menneisyys said:
Wowz, great news, will link it from the Safe Mode Bible ( http://www.pocketpcmag.com/blogs/index.php?blog=3&p=1255&more=1&c=1&tb=1&pb=1 ) and also frontpage it in the PPCMag blog!
Click to expand...
Click to collapse
That's nice
Executing something from [HKLM\Init] only once (after hardreset)
Attached: InitUnLauncher (+source)
command line: InitUnLauncher number1 number2 ... numberN
For every number from command line InitUnLauncher removes values from HKLM\Init: "Delay**", "DelayEx**", "Launch**", "Depend**", "App**", "Params**" if any.
------
With BlueAngel I need to execute specific application (Camera_detect.exe) only once after hard reset (like welcome.exe)
Code:
[HKEY_LOCAL_MACHINE\init]
"Launch88"="InitLauncher.exe"
"Depend88"=hex:3c,32,00
"App88"="Camera_Detect.exe"
"Launch89"="InitLauncher.exe"
"Depend89"=hex:58,00
"App89"="InitUnLauncher.exe"
"Params89"="88 89"
First part (*88) starts Camera_Detect.exe. Probably it would be enough to use
Code:
"Launch88"="Camera_Detect.exe
"Depend88"=hex:3c,32,00
but using InitLauncher I'm sure, that Camera_Detect will not(!) get anything from command line (garbage, in that case one string argument "88").
Second part (*89), which depends on 0x58 (dec 88) deletes values *88 (camera_detect) and *89 (self)
Feel free to use
will this work on wm5 smartphones?
oldsap said:
will this work on wm5 smartphones?
Click to expand...
Click to collapse
Probably no. But ... source is included. Sorry. I have no SmartPhone SDK
baniaczek said:
Probably no. But ... source is included. Sorry. I have no SmartPhone SDK
Click to expand...
Click to collapse
Baniaczku, mam pytanie:
jak wczesny moze być launch initlaunchera.
01?
nothin said:
Baniaczku, mam pytanie:
jak wczesny moze być launch initlaunchera.01?
Click to expand...
Click to collapse
Sprawdzilem przed chwila: co najmniej po shell32.exe (u mnie co najmniej 51). Razem z Depend51=hex:32 00
Zaskoczyles mnie, bo bylem pewny, ze moze byc od 10. Zlinkowalem go najoszczedniej, jak tylko sie dalo, uzywa tylko coredll i tylko operacji na rejestrach, sleep, i ShellExecuteEx.
Po namysle:
No tak. ShellExecuteEx. Jakos mi sie kojarzy z ... shell32.exe
A co? Ma byc wczesniej? Moge poszukac jakiegos API, zeby dalo sie odpalic bez shella. Tylko uwaga - program uruchamiany tez powinien byc niezalezny od shell32
[Edit] ooops.Short in english:
InitLauncher should be executed at least after shell32.exe. In my case: at least as "Launch51"="InitLauncher.exe", "Depend51"=hex:32,00
Thanks! This is exactly what I've been looking for to launch tMan after a short delay so it picks up the correct background color!
Hi,
I don't know why but initlauncher never worked for whatever was the rom i used.
Does anybody else is experiencing problems to make it work?
bye
Herc.
baniaczek said:
Sprawdzilem przed chwila: co najmniej po shell32.exe (u mnie co najmniej 51). Razem z Depend51=hex:32 00
Zaskoczyles mnie, bo bylem pewny, ze moze byc od 10. Zlinkowalem go najoszczedniej, jak tylko sie dalo, uzywa tylko coredll i tylko operacji na rejestrach, sleep, i ShellExecuteEx.
Po namysle:
No tak. ShellExecuteEx. Jakos mi sie kojarzy z ... shell32.exe
A co? Ma byc wczesniej? Moge poszukac jakiegos API, zeby dalo sie odpalic bez shella. Tylko uwaga - program uruchamiany tez powinien byc niezalezny od shell32
[Edit] ooops.Short in english:
InitLauncher should be executed at least after shell32.exe. In my case: at least as "Launch51"="InitLauncher.exe", "Depend51"=hex:32,00
Click to expand...
Click to collapse
wielkie dzieki za odpowiedz, musze sie pobawic, marzy mi sie hm kiosk mode.. bo o innym shellu moge pomarzyc..
jakby co, jeszcze sie odezwe..
thanks a lot.
Safe Mode WM6.1
Does this work in 6.1 pro.
does anyone got experiance with it.
OR are the commercial alternatives much better eg mcube & spb
the main reason to use it it would be to prevent a hard reset if a start-up application was crashing/freezing the startup.
would be better if package up in a nice cab file.
thanks
oldsap said:
will this work on wm5 smartphones?
Click to expand...
Click to collapse
Yes it does, but you cannot make any INITxx depend on it before and including home.exe or appman.exe. I tried to delay the loading of home.exe by making it dependent on the InitLauncher - delaying with DelayEx of it, but home.exe never came up.
The author also mentions that for PPC shell.exe has to be loaded - home (and appman?) are the corresponding items on smartphone.
I will have to solve my problem another way. Either finding a simple program which does nothing but wait 10 seconds and then send "SignalStarted" - not needing the shell process or picking a simple homescreen to (re-)boot and get HW devices (BT and WIFI) initialized fully and reliably. Subsequently I can alter the homescreen again to my layout with some fancy stuff that seems to put HW init out of pace by accessing them too early (I guess).
I also tried to not use the APPxx parameter, but then then Initlauncher just terminates immediately - not caring about the DelayEx data :-(
A side remark
On my CE 6.0 unit I am using a wait-application based on code authored by Chris Tacke
http://blog.opennetcf.com/ctacke/2009/04/15/AutolaunchingCFAppsWithTheHKLMInitRegistryKey.aspx
Code:
#include <Windows.h>
BOOL IsAPIReady(DWORD hAPI);
int WINAPI _tWinMain ( HINSTANCE hInstance ,HINSTANCE hPrevInstance ,LPTSTR lpCmdLine ,int nCmdShow )
{
int nLaunchCode = -1;
// Quick check to see whether we were called from within HKLM\init -> by default HKLM\init passes the lauch code
if(lpCmdLine && *lpCmdLine)
{
// MessageBox(NULL, lpCmdLine ,NULL,MB_OK);
nLaunchCode = _ttoi( (const TCHAR *) lpCmdLine);
}
else
{
// MessageBox(NULL, _T("No argumets passed"),NULL,MB_OK);
}
BOOL success = FALSE;
int i = 0;
while((!IsAPIReady(SH_FILESYS_APIS)) && (i++ < 50))
{
Sleep(200);
}
success = (i < 50);
if(success)
{
i = 0;
while((!IsAPIReady(SH_DEVMGR_APIS))&& (i++ < 50))
{
Sleep(200);
}
success = (i < 50);
if(success)
{
i = 0;
while((!IsAPIReady(SH_SHELL))&& (i++ < 50))
{
Sleep(200);
}
success = (i < 50);
if(success)
{
i = 0;
while((!IsAPIReady(SH_WMGR))&& (i++ < 50))
{
Sleep(200);
}
success = (i < 50);
if(success)
{
i = 0;
while((!IsAPIReady(SH_GDI))&& (i++ < 50))
{
Sleep(200);
}
success = (i < 50);
}
}
}
}
if(nLaunchCode != -1)
{
// Since this is application is launched through the registry HKLM\Init we need to call SignalStarted passing in the command line parameter
SignalStarted((DWORD) nLaunchCode);
}
return success;
}
I make this wait-application dependent on device.dll and gwes.dll, and then start as Launch255/Depend255 my application launcher itself, which depends of course on the wait-application. You easily can extend this piece of code by waiting for other APIs ready, as they are defined here, for example SH_WNET, SH_COMM , SH_TAPI, etc.pp.
jwoegerbauer said:
On my CE 6.0 unit I am using a wait-application based on code authored by Chris Tacke
http://blog.opennetcf.com/ctacke/2009/04/15/AutolaunchingCFAppsWithTheHKLMInitRegistryKey.aspx
Click to expand...
Click to collapse
I have found this blog as well in my search for a solution, but there is no compiled version. I also do not depend on any API to be ready as the WLAN HW driver is loaded via NDIS group from COMM\<driver> and I have no way to check if things completed. It is all just a matter of seconds it seems, so a delay of 10 seconds may suffice for me.
I need to check if the oemstartup.dll that displays an animated GIF will delay the boot (I doubt) - but if so then I will pick a picture that has a longer sequence and problem solved.
GateApp - AutoLaunch
tobbbie said:
I have found this blog as well in my search for a solution, but there is no compiled version.
Click to expand...
Click to collapse
I uploaded my compiled version here.
Forgot to mention the application-launcher I use is AutoLaunch V1.0 by jywilson.
I just see an empty folder ""jwoegerbauer" Shared Files / ceFFM" nothing to load from there.
Anyway, I checked on the boot-time vs. oemstartup.dll animation display and found that it actually is fully sequential in the boot-flow. The current animation gives me 4 seconds - and I know how to deal with these
HKCU\Performance\ Home DismisSplash
with animation: 30 seconds
without: 26 seconds
This should give me a path to a solution
tobbbie said:
I just see an empty folder ""jwoegerbauer" Shared Files / ceFFM" nothing to load from there.
Click to expand...
Click to collapse
Ooops... Link corrected!

Why the basic OPENGL ES app can not run on my Touch HD?

Hi, all.
I find this perfect site through Google after I bought a Blackstone.
I want to do something on my phone, that's OpenGL ES.
When I download the sample code "7 OpenGL ES Tutorials for Win32/WinCE from TyphoonLabs" from khronos and compile them. The samples run well on the Windows Mobile 6.5 Emulator. (there is no libGLES_cm.dll file in the windows folder)
But, when I copy the exe files to my Blackstone, they failed to run. The Tutorials 1 only flash a title then over.
I can find a libGLES_cm.dll file in the windows folder of my Blackstone. It is 322KB, smaller than others I can get. (such as 491KB 10-10-2004). I can't replace it or delete it.
I think the 1st sample of TyphoonLabs is a typical and basic OpenGL ES app, it has not use any advanced ES feature.
however, VR HOLOGRAM runs well on my phone.
I installed "Ati d3d driver", and my app development environment is:
Visual Studio 2008
Windows Mobile 6 SDK
thanks
Have a look at the first post of my OpenGLES test app(check my sig) and try to run this app (take the latest one). There is also a link to a thread about a driverpack (v3 has just been released). Just to be sure that your device has some OpenGLES capable drivers.
AFAIK the hologram app uses d3d.
edit: The examples you mentioned create a rendering device using Red 8, Green 8, Blue 8 bits. Change them to 5, 6, 5 and try again. And don't copy their libgles_cm.dll to the device. Instead use the latest driverpack as described above.
Thank you, heliosdev
yes, i already tried your OpenGLES test app. it runs well also on my phone, but I don't understand C. do you have C code?
i try to modify the sample code following you instruction. but i failed. where am i wrong?
BOOL InitOGLES()
{
EGLConfig configs[10];
EGLint matchingConfigs;
const EGLint configAttribs[] =
{
EGL_RED_SIZE, 5, // i changed it from 8 to 5
EGL_GREEN_SIZE, 6, // i changed it from 8 to 6
EGL_BLUE_SIZE, 5, // i changed it from 8 to 5
EGL_ALPHA_SIZE, EGL_DONT_CARE,
EGL_DEPTH_SIZE, 16,
EGL_STENCIL_SIZE, EGL_DONT_CARE,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_NONE, EGL_NONE
};
hDC = GetWindowDC(hWnd);
glesDisplay = eglGetDisplay((NativeDisplayType)hDC);
if(!eglInitialize(glesDisplay, NULL, NULL))
return FALSE;
if(!eglChooseConfig(glesDisplay, configAttribs, &configs[0], 10, &matchingConfigs))
return FALSE;
if (matchingConfigs < 1) return FALSE;
glesSurface = eglCreateWindowSurface(glesDisplay, configs[0], hWnd, configAttribs);
if(!glesSurface) return FALSE;
glesContext=eglCreateContext(glesDisplay,configs[0],0,configAttribs);
if(!glesContext) return FALSE;
eglMakeCurrent(glesDisplay, glesSurface, glesSurface, glesContext);
glClearColorx(0, 0, 0, 0);
glShadeModel(GL_SMOOTH);
RECT r;
GetWindowRect(hWnd, &r);
glViewport(r.left, r.top, r.right - r.left, r.bottom - r.top);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthox(FixedFromInt(-50), FixedFromInt(50),
FixedFromInt(-50), FixedFromInt(50),
FixedFromInt(-50), FixedFromInt(50));
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
return TRUE;
}
//----------------------------------------------------------------------------
void Render()
{
static int rotation = 0;
GLshort vertexArray[9] = {-25,-25,0, 25,-25,0, 0,25,0 };
GLubyte colorArray[12] = {255,0,0,0, 0,255,0,0, 0,0,255,0};
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatex(0, 0, FixedFromInt(-10));
glRotatex(FixedFromInt(rotation++), 0, ONE,0);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_SHORT, 0, vertexArray);
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(4,GL_UNSIGNED_BYTE, 0, colorArray);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
eglSwapBuffers(glesDisplay, glesSurface);
}
On your device there is no libgles_cm.dll at the place where your exe is, right?
Otherwise remove it from the directory where your exe is.
edit:
If it still doesn't start you could try to write out some messages during initialization (at the places before returning false).
Do you have libgles_cl.dll? In the code you have thes FixedFrom* calls.
You could try to remove all these calls, i.e. instead of FixedFromInt(i) just i and you'll have to change the x to i,f or d in the calls like Rotatex.
heliosdev said:
On your device there is no libgles_cm.dll at the place where your exe is, right?
Otherwise remove it from the directory where your exe is.
Click to expand...
Click to collapse
I copied the libgles_cm.dll file before from windows folder to Storage Card, where the exe file locates.
now I delete the libgles_cm.dll file , but nothing changes.
heliosdev said:
On your device there is no libgles_cm.dll at the place where your exe is, right?
Otherwise remove it from the directory where your exe is.
edit:
If it still doesn't start you could try to write out some messages during initialization (at the places before returning false).
Do you have libgles_cl.dll? In the code you have thes FixedFrom* calls.
You could try to remove all these calls, i.e. instead of FixedFromInt(i) just i and you'll have to change the x to i,f or d in the calls like Rotatex.
Click to expand...
Click to collapse
thank you again.
I find the error occurs during initialization,
BOOL InitOGLES()
{
EGLConfig configs[10];
EGLint matchingConfigs;
const EGLint configAttribs[] =
{
EGL_RED_SIZE, 5, // i changed it from 8 to 5
EGL_GREEN_SIZE, 6, // i changed it from 8 to 6
EGL_BLUE_SIZE, 5, // i changed it from 8 to 5
EGL_ALPHA_SIZE, EGL_DONT_CARE,
EGL_DEPTH_SIZE, 16,
EGL_STENCIL_SIZE, EGL_DONT_CARE,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_NONE, EGL_NONE
};
hDC = GetWindowDC(hWnd);
glesDisplay = eglGetDisplay((NativeDisplayType)hDC);
if(!eglInitialize(glesDisplay, NULL, NULL))
return FALSE;
if(!eglChooseConfig(glesDisplay, configAttribs, &configs[0], 10, &matchingConfigs))
return FALSE;
if (matchingConfigs < 1) return FALSE;
glesSurface = eglCreateWindowSurface(glesDisplay, configs[0], hWnd, configAttribs);
if(!glesSurface) return FALSE;
Here, it returns
Hy,
maybe this can be a workaround for you!
http://cegcc.sourceforge.net/docs/faq.html#DllDoesNotWorkWithWindowsMobile6.1
------------------
Memory management changes in Windows Mobile 6.1 cause some DLLs not to load. It has been suggested (see this blog that the underlying problem is a writable code section in the DLL, other reports suggest that the DLL size may be an issue.
The workaround or solution (I'm not sure what to call it) that we have is to restrict this DLL to Slot 0 by adding the following registry key:
[HKEY_LOCAL_MACHINE\System\Loader\LoadModuleLow] "MyDll.dll"=dword:1
Obviously you need to change "MyDll" into the name of the DLL that causes the problem.
Please note that using the this approach will force your entire DLL into Slot 0 and, it may prevent other modules from loading in that slot. Therefore, the above registry setting should be used with caution.
------------------
Greatz
mccoffein
mccoffein said:
Hy,
maybe this can be a workaround for you!
http://cegcc.sourceforge.net/docs/faq.html#DllDoesNotWorkWithWindowsMobile6.1
------------------
Memory management changes in Windows Mobile 6.1 cause some DLLs not to load. It has been suggested (see this blog that the underlying problem is a writable code section in the DLL, other reports suggest that the DLL size may be an issue.
The workaround or solution (I'm not sure what to call it) that we have is to restrict this DLL to Slot 0 by adding the following registry key:
[HKEY_LOCAL_MACHINE\System\Loader\LoadModuleLow] "MyDll.dll"=dword:1
Obviously you need to change "MyDll" into the name of the DLL that causes the problem.
Please note that using the this approach will force your entire DLL into Slot 0 and, it may prevent other modules from loading in that slot. Therefore, the above registry setting should be used with caution.
------------------
Greatz
mccoffein
Click to expand...
Click to collapse
thank you, mccoffein. that is a different idea.
But i think registry table is not the issue. Because the app can run on WM6.5 emulator, and heliosdev's OPENGL ES test app can run on my phone also.
I download glBenchmark 1.0 from glbenchmark.com, it can run also.
now I have no idea.
anyone can help me?
Got it
When I put my libgles_cm.dll in the same folder of my App, the App runs.
I think the libgles_cm.dll from HTC has some unknown problems.
Thanks
ak2009 said:
thank you again.
I find the error occurs during initialization,
BOOL InitOGLES()
{
EGLConfig configs[10];
EGLint matchingConfigs;
const EGLint configAttribs[] =
{
EGL_RED_SIZE, 5, // i changed it from 8 to 5
EGL_GREEN_SIZE, 6, // i changed it from 8 to 6
EGL_BLUE_SIZE, 5, // i changed it from 8 to 5
EGL_ALPHA_SIZE, EGL_DONT_CARE,
EGL_DEPTH_SIZE, 16,
EGL_STENCIL_SIZE, EGL_DONT_CARE,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_NONE, EGL_NONE
};
hDC = GetWindowDC(hWnd);
glesDisplay = eglGetDisplay((NativeDisplayType)hDC);
if(!eglInitialize(glesDisplay, NULL, NULL))
return FALSE;
if(!eglChooseConfig(glesDisplay, configAttribs, &configs[0], 10, &matchingConfigs))
return FALSE;
if (matchingConfigs < 1) return FALSE;
glesSurface = eglCreateWindowSurface(glesDisplay, configs[0], hWnd, configAttribs);
if(!glesSurface) return FALSE;
Here, it returns
Click to expand...
Click to collapse
Yes. Because hWnd now is not valid handle. Hands of tutorial programmers is from ass .
Simple, call InitOGLES() after you created window.

[GUIDE] Android Client-Server Communication (PHP-MYSQL REST API)

Hey XDA, this is my first guide and first proper contribution to the community!
I’m writing this because I've seen many people ask a variation of the question: “How can my app get information from a database?”
This guide is intended for those who have created their first app – it is assumed you have a working development environment and are reasonable comfortable with the Android SDK and Java. I'm also assuming little to no knowledge of PHP and MYSQL
This guide walks you through:
Setting up a database and a PHP script
Testing the server
Accessing it from Android.
To make it relevant, we're going to use data that we might see in an actual app: First & Last Name, Age and Points.
Requirements:
Android Device*
Computer*
Apache/PHP/MySQL Server – I use WAMP (for Windows) (PHP v 5.4)
Postman Rest Client for Google Chrome
(*Both must be connected to the same network!)
This guide will help you setup a local server. If you want to host your script and database online, you will have to purchase paid hosting.
Let's get started!
First off, what is a RESTful service?
According to Wikipedia: A RESTful web API (also called a RESTful web service) is a web API implemented using HTTP and REST principles.
How it works:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
A breakdown of the steps:
The client makes a request using a HTTP POST to a server
The PHP script queries the MYSQL server
The PHP script gets the SQL data
The PHP script puts the data into an array and assigns keys for the values. The script then outputs the data as a JSON array. JSON (JavaScript Object Notation) is a standard for data exchange, and formats the data in a way both humans and computers can easily read.
The app parses the JSON and displays the data.
Code!
Part 1: The Server
We’re going to start by setting up the server!
Install WAMP server. Leave the settings at the default values.
Start WAMP server and let it come online.
Try and open http://localhost/phpmyadmin/ - if you installed it correctly, you should be greeted by the phpMyAdmin welcome screen. We're going to be using phpMyAdmin to create our database.
Creating the Database:
Create a database called ‘mytestdatabase’. Now click the SQL tab, paste in the following SQL Code and hit run. This will create a test table called ‘users’ and fill it with data.
The table contains 5 columns: id, FirstName, LastName, Age, Points. It has 6 rows of sample data.
SQL Code:
Code:
-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 15, 2013 at 10:07 PM
-- Server version: 5.5.24-log
-- PHP Version: 5.3.13
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET [user=714032]@old_[/user][email protected]@CHARACTER_SET_CLIENT */;
/*!40101 SET [user=714032]@old_[/user][email protected]@CHARACTER_SET_RESULTS */;
/*!40101 SET [user=714032]@old_[/user][email protected]@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `MyTestDatabase`
--
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`FirstName` text NOT NULL,
`LastName` text NOT NULL,
`Age` int(11) NOT NULL,
`Points` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `FirstName`, `LastName`, `Age`, `Points`) VALUES
(1, 'John', 'Doe', 25, 61),
(2, 'Glen', 'Willis', 55, 3145),
(3, 'Helen', 'Cook', 35, 1232),
(4, 'Karen', 'Johnson', 20, 6456),
(5, 'Bill', 'Cooper', 60, 3856),
(6, 'Mary', 'Gomez', 30, 5422);
/*!40101 SET CHARACTER_SET_CLIENT [user=714032]@old_[/user]CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS [user=714032]@old_[/user]CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION [user=714032]@old_[/user]COLLATION_CONNECTION */;
Your database should now look like this:
We’re now ready to move on to the PHP!
Open up your WWW directory (C:\wamp\www) and create a new folder called ‘clientservertest’. In this folder, create a file called ‘login.php’.
Paste the following code into the file. (The PHP code is commented so you can follow what is going on)
PHP:
<?php
#Ensure that the client has provided a value for "FirstNameToSearch"
if (isset($_POST["FirstNameToSearch"]) && $_POST["FirstNameToSearch"] != ""){
#Setup variables
$firstname = $_POST["FirstNameToSearch"];
#Connect to Database
$con = mysqli_connect("localhost","root","", "mytestdatabase");
#Check connection
if (mysqli_connect_errno()) {
echo 'Database connection error: ' . mysqli_connect_error();
exit();
}
#Escape special characters to avoid SQL injection attacks
$firstname = mysqli_real_escape_string($con, $firstname);
#Query the database to get the user details.
$userdetails = mysqli_query($con, "SELECT * FROM users WHERE FirstName = '$firstname'");
#If no data was returned, check for any SQL errors
if (!$userdetails) {
echo 'Could not run query: ' . mysqli_error($con);
exit;
}
#Get the first row of the results
$row = mysqli_fetch_row($userdetails);
#Build the result array (Assign keys to the values)
$result_data = array(
'FirstName' => $row[1],
'LastName' => $row[2],
'Age' => $row[3],
'Points' => $row[4],
);
#Output the JSON data
echo json_encode($result_data);
}else{
echo "Could not complete query. Missing parameter";
}
?>
Testing the Script:
Try accessing http://localhost/clientservertest/login.php from your browser. Do you get this message:
"Could not complete query. Missing parameter"
Then it’s working! The script is looking for a POST variable called “FirstNameToSearch” – we didn't provide any, so it did't work!
To finish testing the script, open the Postman-REST client.
Set it up like so:
Request URL: http://localhost/clientservertest/login.php
Type: POST
Key: FirstNameToSearch
Value: John
Hit send, and you should see this:
Code:
{"FirstName":"John","LastName":"Doe","Age":"25","Points":"61"}
Congrats – your server just returned a result! Try some of the other names in the database (Glen, Helen, Karen, Bill, Mary) and see how their data is returned.
Note: Before we move on to the Android section, we’re going to have to put our WAMP server online. Click the WAMP icon in the taskbar and select 'Put Online'.
Find your computers local network IP address and insert it into the URL like so: http://192.168.1.112/clientservertest/login.php
You should be able to access the script. If this doesn't work, try turning off your firewall - it could be blocking the server.
Part 2: Android
We’re now going to use our Android device to access the web server instead of the Postman client.
I'm not going to go into detail with the boilerplate UI code - I've attached the source code to this post so you can download the project files and browse through them.
Note: Android 3.x+ cannot perform Network operations on the main thread. To solve this, we have to multithread our program. To keep this as simple as possible, we’re going to use an AsyncTask. Again, the code for this can be found in the project download.
Inside of the AsyncTask, we have the most important code - where we create and execute a HTTP POST in Java.
Creating and Executing a HTTP POST in Java:
We have to first setup the name-value pairs for our POST variables. In this case, we use "FirstNameToSearch" as our Key.
Code:
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("FirstNameToSearch", strNameToSearch));
The following code sets up connection timeouts (15 seconds) and creates a HttpClient and HttpPost pointing to our url (http://192.168.1.112/clientservertest/login.php)
Code:
//Create the HTTP request
HttpParams httpParameters = new BasicHttpParams();
//Setup timeouts
HttpConnectionParams.setConnectionTimeout(httpParameters, 15000);
HttpConnectionParams.setSoTimeout(httpParameters, 15000);
HttpClient httpclient = new DefaultHttpClient(httpParameters);
HttpPost httppost = new HttpPost("http://192.168.1.112/clientservertest/login.php");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
The following code executes the POST, gets the result and converts it to a string:
Code:
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
String result = EntityUtils.toString(entity);
Finally, the following code creates a JSON object from the result string and extracts our data:
Code:
// Create a JSON object from the request response
JSONObject jsonObject = new JSONObject(result);
//Retrieve the data from the JSON object
strFirstName = jsonObject.getString("FirstName");
strLastName = jsonObject.getString("LastName");
intAge = jsonObject.getInt("Age");
intPoints = jsonObject.getInt("Points");
That's it. It's so simple!
Where do we take it from here?
This combination of PHP/MYSQL is quite powerful. I'd recommend that you learn more about these technologies and build upon the demo in this guide. PHP Tutorials & MySQL Tutorials
Ideas for practice apps:
Online notes application - Sync your notes to the cloud
Build an Activation Server - Users can activate an app with a key
Feedback
Please feel free to leave any followup questions, comments or suggestions! I'll try my best to respond!
You can find the source code over at GitHub. Have fun! (If you fix a bug, please send a pull request)
 
Additional Information
Changelog
November 3, 2013
Added a link to the GitHub repository.
June 26, 2013
Updated PHP Code. It's more reliable and uses the newer MySQL APIs. Thanks to @dbarrera & @vijai2011
July 7, 2013
Updated the Android project and added Internet permissions (ClientServerRESTDemo v2.zip)
Thanks for this amazing guide but I have a issue.I have my own table and columns.So I changed your php code according to that and when I do a post query in rest,I get all null.But if I do the same in phpmyadmin,I have results.
This is what I get in postman:
Code:
{"pid":null,"name":null,"UID":null,"mobile":null,"description":null,"created_at":null,"updated_at":null}
attached the output of phpmyadmin.
And my phpcode:
Code:
<?php
#Setup variables
$firstname = $_POST["FirstNameToSearch"];
#Avoid SQL injection attacks
$firstname = mysql_real_escape_string($firstname);
#Connect to Database
$con = mysql_connect("localhost","user","pass");
if (!$con)
{
die('Could not connect');
}
#Select the test database
mysql_select_db("mydb", $con);
#Get the user details from the database
$userdetails = mysql_query("SELECT * FROM mytable WHERE name = '$firstname'");
#Catch any errors
if (!$userdetails) {
echo 'It seems the server is down.Please try later';
exit;
}
#Get the first row of the results
$row = mysql_fetch_row($userdetails);
#Build the result array (Assign keys to the values)
$result_data = array(
'pid' => $row[1],
'name' => $row[2],
'UID' => $row[3],
'mobile' => $row[4],
'description' => $row[5],
'created_at' => $row[6],
'updated_at' => $row[7],
);
#Output the JSON data
echo json_encode($result_data);
?>
Thanks for help.
Edit: just found that your app is missing internet permission in manifest
Code:
<uses-permission android:name="android.permission.INTERNET" />
:thumbup:
Thanks so much for this. I will try it out soon.
Sent from my HTC Explorer A310e using xda app-developers app
vijai2011 said:
Thanks for this amazing guide but I have a issue.I have my own table and columns.So I changed your php code according to that and when I do a post query in rest,I get all null.But if I do the same in phpmyadmin,I have results.
This is what I get in postman:
Code:
{"pid":null,"name":null,"UID":null,"mobile":null,"description":null,"created_at":null,"updated_at":null}
attached the output of phpmyadmin.
Thanks for help.
Click to expand...
Click to collapse
I was able to reproduce the null result - it means that the result was not available in the database. You'll want to double check the value you are passing to the script in Postman. (When I used 'FirstNameToSearch' and 'test' - I got a correct result. However, when I used 'testa', I got a null result.)
You can try adding this into the PHP script to catch this problem:
Code:
#Get the first row of the results
$row = mysql_fetch_row($userdetails);
[B]#Check to see if a result was returned.
if(!$row){
echo 'User does not exist';
exit;
}[/B]
I also noticed a few things in your PHP script:
In your screenshot, your table name appears to be 'Myapp', however in your PHP script, it looks like you are using 'mytable'
When you build the result array at the end, you are trying to access a column that doesn't exist:
This code tries to access an 8th column/index:
Code:
'pid' => $row[1],
'name' => $row[2],
'UID' => $row[3],
'mobile' => $row[4],
'description' => $row[5],
'created_at' => $row[6],
'updated_at' => $row[7],
You only have seven columns, so it should be:
Code:
'pid' => $row[0],
'name' => $row[1],
'UID' => $row[2],
'mobile' => $row[3],
'description' => $row[4],
'created_at' => $row[5],
'updated_at' => $row[6],
vijai2011 said:
Edit: just found that your app is missing internet permission in manifest
Code:
<uses-permission android:name="android.permission.INTERNET" />
Click to expand...
Click to collapse
Good catch - Thanks! I'll update the project asap.
Alkonic said:
I was able to reproduce the null result - it means that the result was not available in the database. You'll want to double check the value you are passing to the script in Postman. (When I used 'FirstNameToSearch' and 'test' - I got a correct result. However, when I used 'testa', I got a null result.)
:snip:
Good catch - Thanks! I'll update the project asap.
Click to expand...
Click to collapse
That is not a error in table name because I just wanted to hide it out here but actually it got revealed in the screenshot .No issues will try your php code and correct my json array too.thanks
Sent from my GT-N7000 using xda app-developers app
For some reason,the problem was caused by the mysql_real_escape_string.I commented that line and it is working now.
vijai2011 said:
For some reason,the problem was caused by the mysql_real_escape_string.I commented that line and it is working now.
Click to expand...
Click to collapse
Now that's interesting.. I've never experienced a problem with that before.
I took a look at the PHP docs and found that mysql_real_escape_string() is depreciated - that could be contributing to the problem. I'll investigate this further and adjust the guide as necessary.
Thanks for sharing your solution!.
Alkonic said:
Now that's interesting.. I've never experienced a problem with that before.
I took a look at the PHP docs and found that mysql_real_escape_string() is depreciated - that could be contributing to the problem. I'll investigate this further and adjust the guide as necessary.
Thanks for sharing your solution!.
Click to expand...
Click to collapse
Maybe you are using ancient php module .BTW Can I also put data into tables using your php and slightly modifying "mysql_query" and using post?Or should I use put along with mysql_query?If later is the solution,could give me the snippet of how a put variable looks?because I dono php and I was waiting for someone to write this guide because before I was connecting to db with JDBS which isnt safe.Thanks and sorry for the trouble.
Edit: I got it to work like I said.But only issue is the created at and updated at time stamp which is not the part of php nor the app.I will correct it from mysql.Thanks once again.Will be happy to trouble you soon lol...No dont take it serious BTW
vijai2011 said:
Maybe you are using ancient php module .BTW Can I also put data into tables using your php and slightly modifying "mysql_query" and using post?Or should I use put along with mysql_query?If later is the solution,could give me the snippet of how a put variable looks?because I dono php and I was waiting for someone to write this guide because before I was connecting to db with JDBS which isnt safe.Thanks and sorry for the trouble.
Edit: I got it to work like I said.But only issue is the created at and updated at time stamp which is not the part of php nor the app.I will correct it from mysql.Thanks once again.Will be happy to trouble you soon lol...No dont take it serious BTW
Click to expand...
Click to collapse
Ha you beat me to it! I'll definitely try and add a section into the guide about updating tables. I appreciate your feedback on the guide, and I'm glad it helped you. Feel free to trouble me
Perfect! Just what i needed for my next week exam!
Sent from my GT-S5830M using Tapatalk 2
Super, thx!
But please tell me what I'm doing wrong.
Code:
HttpResponse response = httpclient.execute(httppost); //throw...​
i save errors in log (attached)
pls help ;(
objaa said:
Super, thx!
But please tell me what I'm doing wrong.
Code:
HttpResponse response = httpclient.execute(httppost); //throw...​
i save errors in log (attached)
pls help ;(
Click to expand...
Click to collapse
You are doing something on the main thread which actually has to be done in a different thread.I suspect its at line #119.If you show the entire code,somebody might point it out easily for you
Sent from my GT-N7000 using xda app-developers app
vijai2011 said:
You are doing something on the main thread which actually has to be done in a different thread.I suspect its at line #119.If you show the entire code,somebody might point it out easily for you
Sent from my GT-N7000 using xda app-developers app
Click to expand...
Click to collapse
ok, all code:
package com.nsp.obja;
import java.util.ArrayList;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.util.EntityUtils;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.widget.Toast;
public class MainActivity extends Activity {
@override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.myscreen);
post();
}
@override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
void post()
{
try
{
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("FirstNameToSearch", "wow"));
//Create the HTTP request
HttpParams httpParameters = new BasicHttpParams();
//Setup timeouts
HttpConnectionParams.setConnectionTimeout(httpParameters, 15000);
HttpConnectionParams.setSoTimeout(httpParameters, 15000);
HttpClient httpclient = new DefaultHttpClient(httpParameters);
HttpPost httppost = new HttpPost("http://www.xda-developers.com/");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
String result = EntityUtils.toString(entity);
Toast.makeText(this, result.length(), Toast.LENGTH_LONG).show();
}
catch(Exception e)
{
Log.e("ClientServerDemoX", "Error: ", e);
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
}
objaa said:
ok, all code:
<!----Snip!---->
Click to expand...
Click to collapse
Do post() in async because it has to do http request which needs to be done in another thread.
vijai2011 said:
You are doing something on the main thread which actually has to be done in a different thread.I suspect its at line #119.If you show the entire code,somebody might point it out easily for you
Sent from my GT-N7000 using xda app-developers app
Click to expand...
Click to collapse
vijai2011 said:
Do post() in async because it has to do http request which needs to be done in another thread.
Click to expand...
Click to collapse
hoooww :crying::crying:
Thanks, I figured out and got the code page of our glorious forum
I'm having an issue while testing the Query... I'm using Firefox and using RESTClient for debugging... and testing whatever value, db always responds null (See attachment)...
dbarrera said:
I'm having an issue while testing the Query... I'm using Firefox and using RESTClient for debugging... and testing whatever value, db always responds null (See attachment)...
Click to expand...
Click to collapse
Exactly what I experienced first time.Try after commenting the line which prevents mysql injection and see if it works.If you run latest mysql,the chances are probably that its the issue
vijai2011 said:
Exactly what I experienced first time.Try after commenting the line which prevents mysql injection and see if it works.If you run latest mysql,the chances are probably that its the issue
Click to expand...
Click to collapse
Already tried that... No go... Had to write the whole thing using w3schools example code as base... Just resolved a couple minutes ago and completed the project (it can be viewed @ Github:CardManager (App) and cardmanager_json (Web Service, only principal.php is the one handling the whole thing))...
Maybe a good add to the tutorial would be to have a config.php file with the user, passwd, database and table data calling it through require_once()... The DBConexion and DBGestion files (in my github) are supposed to do that, but didn't work either (hence doing the principal.php code all over again)...
dbarrera said:
Already tried that... No go... Had to write the whole thing using w3schools example code as base... Just resolved a couple minutes ago and completed the project (it can be viewed @ Github:CardManager (App) and cardmanager_json (Web Service, only principal.php is the one handling the whole thing))...
Maybe a good add to the tutorial would be to have a config.php file with the user, passwd, database and table data calling it through require_once()... The DBConexion and DBGestion files (in my github) are supposed to do that, but didn't work either (hence doing the principal.php code all over again)...
Click to expand...
Click to collapse
Interesting.. I'll take a look at at your script, revisit the W3 tutorials, and then re-write mine. It's really rudimentary and tends to fail easily. I wanted to write about the config.php, however, I also wanted to keep this guide as simple as possible for newer users. Maybe I'll add in an advanced section.
I'll update the guide in a few days, as I'm right in the middle of exams :/
Thanks for the feedback!

[HELP] Native Toast Launcher

I was able to install the HTC Sprint Diagnosis app on my Nokia Lumia 1520 and also have the HTC CSDDiag app installed.
Interesting Part : I was able to run CSDDiag on the Lumia handset and all tests were completed.
Now what i would like to know is how do i run this code in the Native Toast Launcher :
Code:
// Type: DiagnosticTool_Sprint.MainPage
// Assembly: DiagnosticTool_Sprint, Version=1.3.2319.13220, Culture=neutral, PublicKeyToken=null
// MVID: B9415712-08FA-4E66-9A8E-A318594B96CD
// Assembly location: C:\Users\Joshua\Desktop\SPRINT\Data\programs\{E69A2877-59B8-43ED-898D-554FBC4B8B2B}\Install\DiagnosticTool_Sprint.dll
using HTCLogUtil;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System;
using System.Diagnostics;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Windows.System;
namespace DiagnosticTool_Sprint
{
public class MainPage : PhoneApplicationPage
{
public static string DIALER_CODE_CT_LAB = "0000";
public static string DIALER_CODE_EMBEDDED_TOOL = "634";
public static string DIALER_CODE_SERVICE_TOOL_1 = "778";
public static string DIALER_CODE_SERVICE_TOOL_2 = "786";
public static string DIALER_CODE_VZW_TOOL = "522";
public static string DIALER_CODE_CSDIAG_TOOL = "3424";
public static string DIALER_CODE_DEBUG = "33284";
public static string DIALER_CODE_ZONE_TOOL = "611";
public static string DIALER_CODE_DIAG = "3424";
public static string DIALER_CODE_SCRTN = "72786";
public static string DIALER_CODE_DATA = "3282";
public static string DIALER_CODE_UPDATE = "873283";
public static string strUri;
internal Grid LayoutRoot;
internal StackPanel TitlePanel;
internal Grid ContentPanel;
private bool _contentLoaded;
static MainPage()
{
}
public MainPage()
{
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
DiagDebugLogUtil.DiagDebugLog(LOG_SEVERITY.LOG_INFO, "[PC Tools]: OnNavigatedTo()++++", new object[0]);
try
{
if (!PhoneApplicationService.Current.State.ContainsKey("VersionNumber"))
PhoneApplicationService.Current.State.Add("VersionNumber", (object) ((object) Assembly.GetExecutingAssembly().GetName().Version).ToString());
string str = "634";
if (this.NavigationContext.QueryString.TryGetValue("DialString", out str))
{
if (str.Equals(MainPage.DIALER_CODE_SERVICE_TOOL_1) || str.Equals(MainPage.DIALER_CODE_SERVICE_TOOL_2) || (str.Equals(MainPage.DIALER_CODE_DATA) || str.Equals(MainPage.DIALER_CODE_SCRTN)))
this.NavigationService.Navigate(new Uri("/ServiceToolLib;component/View/PageLists.xaml", UriKind.Relative));
else if (str.Equals(MainPage.DIALER_CODE_EMBEDDED_TOOL) || str.Equals(MainPage.DIALER_CODE_DEBUG))
{
if (!PhoneApplicationService.Current.State.ContainsKey("DialString"))
PhoneApplicationService.Current.State.Add("DialString", (object) "634");
this.NavigationService.Navigate(new Uri("/EmbeddedTool;component/EmbMainPage.xaml", UriKind.Relative));
}
else if (str.Equals(MainPage.DIALER_CODE_CSDIAG_TOOL))
this.NavigationService.Navigate(new Uri("/RedirectionTool;component/RedirectionPage.xaml?tool=CSDDiag", UriKind.Relative));
else if (str.Equals(MainPage.DIALER_CODE_VZW_TOOL))
this.NavigationService.Navigate(new Uri("/RedirectionTool;component/RedirectionPage.xaml?tool=LabApp", UriKind.Relative));
else if (str.Equals(MainPage.DIALER_CODE_ZONE_TOOL))
{
if (!App.bNoBackForLaunchAPP)
{
MainPage.strUri = "sprintzone:callintercept?code=" + str;
App.bNoBackForLaunchAPP = true;
this.LaunchSprintAP();
}
}
else if (str.Equals(MainPage.DIALER_CODE_UPDATE))
{
if (!App.bNoBackForLaunchAPP)
{
MainPage.strUri = "ms-settings-networkprofileupdate:";
App.bNoBackForLaunchAPP = true;
this.LaunchUpdate();
}
}
else
this.NavigationService.Navigate(new Uri("/EmbeddedTool;component/EmbMainPage.xaml", UriKind.Relative));
}
else
this.NavigationService.Navigate(new Uri("/EmbeddedTool;component/EmbMainPage.xaml", UriKind.Relative));
}
catch (Exception ex)
{
DiagDebugLogUtil.DiagDebugLog(LOG_SEVERITY.LOG_ERROR, "[MainPage] Get Exception msg :" + ((object) ex.Message).ToString(), new object[0]);
this.NavigationService.Navigate(new Uri("/EmbeddedTool;component/EmbMainPage.xaml", UriKind.Relative));
}
DiagDebugLogUtil.DiagDebugLog(LOG_SEVERITY.LOG_INFO, "[PC Tools]: OnNavigatedTo()----", new object[0]);
}
public async void LaunchUpdate()
{
Uri uri = new Uri(MainPage.strUri);
int num = await Launcher.LaunchUriAsync(uri) ? 1 : 0;
}
public async void LaunchSprintAP()
{
Uri uri = new Uri(MainPage.strUri);
int num = await Launcher.LaunchUriAsync(uri) ? 1 : 0;
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
this.RemoveEntry("MainPage");
}
private void RemoveEntry(string sPageName)
{
foreach (JournalEntry journalEntry in this.NavigationService.BackStack)
{
if (journalEntry.Source.ToString().Contains(sPageName))
{
this.NavigationService.RemoveBackEntry();
break;
}
}
}
[DebuggerNonUserCode]
public void InitializeComponent()
{
if (this._contentLoaded)
return;
this._contentLoaded = true;
Application.LoadComponent((object) this, new Uri("/DiagnosticTool_Sprint;component/MainPage.xaml", UriKind.Relative));
this.LayoutRoot = (Grid) this.FindName("LayoutRoot");
this.TitlePanel = (StackPanel) this.FindName("TitlePanel");
this.ContentPanel = (Grid) this.FindName("ContentPanel");
}
}
}
I can reach the Main page by issuing :
Code:
app://E69A2877-59B8-43ED-898D-554FBC4B8B2B/_default
However I would like to run the Dialer commands to see if I can mod anything else on the phone. Could some with good brain explain how this will be possible.
I have tried install other platform Diag tools but was only able to install the two above using fiddler ( thanks ngame for your tutorial )
Who did you do that ? I Try it many times before to install these aps on RM-821 Nokia Lumia 920 but didn't work !
how did you do that ? Could you please P.M Me ?
ngame said:
Who did you do that ? I Try it many times before to install these aps on RM-821 Nokia Lumia 920 but didn't work !
how did you do that ? Could you please P.M Me ?
Click to expand...
Click to collapse
It wasnt hard to install those apps. Just followed the fiddler tutorial posted.
Then I connected the phone and installed SysPushApp onto the device and did an update for the SysPushApp to get the non_OEM files of Samsung and HTC . I couldnt install Samsung Diagnosis as it wasn't letting nor was I able to install HTC Hub ( I dont know why, may be they check some .dll specific to them in the phone before install ) .
Change the oSession in fiddler config file to the specific OEM you want to install the app. Example for HTC[ ->
oSession (NOKIA)
(NOKIA), (HTC) /B]
Mt device is Dev-Unlock.
tids2k said:
It wasnt hard to install those apps. Just followed the fiddler tutorial posted.
Then I connected the phone and installed SysPushApp onto the device and did an update for the SysPushApp to get the non_OEM files of Samsung and HTC . I couldnt install Samsung Diagnosis as it wasn't letting nor was I able to install HTC Hub ( I dont know why, may be they check some .dll specific to them in the phone before install ) .
Change the oSession in fiddler config file to the specific OEM you want to install the app. Example for HTC[ ->
oSession (NOKIA)
(NOKIA), (HTC) /B]
Mt device is Dev-Unlock.
Click to expand...
Click to collapse
Samsung diagnosis already removed from wp store so you can't install it easy
and diagnosis you can see in store may different from one in Samsung phones! If you check file sizes you will get what i say
Most of HTC apps only can install ID_Resolution_HD720p and WVGA devices i don't know how is it possible to deploy them on 1080 devices
maybe MS accept this resolution for all apps because the old apps have to add 1080 support?
ngame said:
Samsung diagnosis already removed from wp store so you can't install it easy
and diagnosis you can see in store may different from one in Samsung phones! If you check file sizes you will get what i say
Most of HTC apps only can install ID_Resolution_HD720p and WVGA devices i don't know how is it possible to deploy them on 1080 devices
maybe MS accept this resolution for all apps because the old apps have to add 1080 support?
Click to expand...
Click to collapse
correct some Samsung apps are Unpublished like Diagnosis. Can you tell me how to run the above codes in Native Launcher .. what to type after app://GUID/??
tids2k said:
correct some Samsung apps are Unpublished like Diagnosis. Can you tell me how to run the above codes in Native Launcher .. what to type after app://GUID/??
Click to expand...
Click to collapse
I don't have this xaps but you have to use .Net Reflector 8 or any .net Decompiler then u can see all hidden xamls after _default you have to enter a #/ then dll name without it's dll them a ; and then folder and xaml address
example :
app://GUID/_default#/dllname;Pages/ExamplePage.xaml
ngame said:
I don't have this xaps but you have to use .Net Reflector 8 or any .net Decompiler then u can see all hidden xamls after _default you have to enter a #/ then dll name without it's dll them a ; and then folder and xaml address
example :
app://GUID/_default#/dllname;Pages/ExamplePage.xaml
Click to expand...
Click to collapse
here is the XAP
tids2k said:
here is the XAP
Click to expand...
Click to collapse
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/DiagnosticTool_Sprint;Component/app.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/DiagnosticTool_Sprint;Component/MainPage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/app.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/dmswitchpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/embcheckspc.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/embmainpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/fieldtrialpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ft1xpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ftactiveapnconnpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ftbtpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ftconfigpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ftdatastatuspage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ftehrpdpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ftgpspage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/fthdrpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ftltepage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ftmemorypage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/RedirectionTool;Component/redirectionpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/ServiceToolLib;Component/homepage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/ServiceToolLib;Component/view/checkspc.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/ServiceToolLib;Component/view/grouplists.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/ServiceToolLib;Component/view/itemedit.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/ServiceToolLib;Component/view/itemlists.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/ServiceToolLib;Component/view/lteavailablefile.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/ServiceToolLib;Component/view/pagelists.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/ServiceToolLib;Component/view/rwchoice.xaml
OMG!!!!!!!! so many xamls !
If you can get a Screen Shot of each xaml is more useful I think
None of them works. We need to add Dialercodes in the end.
tids2k said:
None of them works. We need to add Dialercodes in the end.
Click to expand...
Click to collapse
Oh i'm Really sorry . I have to buy an Ativ S to be a bit useful for other users but I have no money to buy
I'm again sorry I don't know what's going wrong in the Uris I provided :|
ngame said:
Oh i'm Really sorry . I have to buy an Ativ S to be a bit useful for other users but I have no money to buy
I'm again sorry I don't know what's going wrong in the Uris I provided :|
Click to expand...
Click to collapse
its alright mate.thanks for your help. I will try tomorrow.
did you check the xap's i posted in the other thread. I hope they will be useful. Thanks.
btw my phone came with Hong Kong firmware but I have installed the Australian firmware. Im glad atleast this was possible.
tids2k said:
its alright mate.thanks for your help. I will try tomorrow.
did you check the xap's i posted in the other thread. I hope they will be useful. Thanks.
btw my phone came with Hong Kong firmware but I have installed the Australian firmware. Im glad atleast this was possible.
Click to expand...
Click to collapse
@nGage were you able to install those apps on your phone ?
@nGage there is some good news i was able to run the strings which you posted. It was all about changing 'Component' -> 'component' and some other tweaks. But the .dll library refers to something else and hence the data is not fetchable. I will post the screenshots tomorrow. @W_O_L_F can this file 'HTC Diagnostics_Sprint be hacked in any way as I was able to install this on Nokia 1520 via Windows App Store -> SysPush ( via Fiddler i.e chainging the OEMID=HTC )
tids2k said:
@nGage there is some good news i was able to run the strings which you posted. It was all about changing 'Component' -> 'component' and some other tweaks. But the .dll library refers to something else and hence the data is not fetchable. I will post the screenshots tomorrow. @W_O_L_F can this file 'HTC Diagnostics_Sprint be hacked in any way as I was able to install this on Nokia 1520 via Windows App Store -> SysPush ( via Fiddler i.e chainging the OEMID=HTC )
Click to expand...
Click to collapse
Not for Nokia.
Be very careful with the HTC Sprint tool, since it has the ability to change NV values, even if it is commented out. (don't know why.) but it sure does.
hutchinsane_ said:
Be very careful with the HTC Sprint tool, since it has the ability to change NV values, even if it is commented out. (don't know why.) but it sure does.
Click to expand...
Click to collapse
thanks for the advice. But the app is pointless on Nokia phones as i have tried it and it doesn't work ... It can go to the menu's bit cannot get the values either it needs Interop or the dll linked is not for the device.

How to search StorageFiles

I need a way to search in StorageFiles with dynamically pattern, which comes from a TextBox. The directive "Windows.Storage.Search" doesnt exist in windows phone 8.1 runtime, as i saw. Now my question is, how can i do this in alternative way?
The only way to do it with WP 8.1 since Microsoft ALWAYS fails to implement the important things are to query using LINQ.
Ex:
Code:
var result = (await Windows.Storage.ApplicationData.Current.LocalFolder.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByName)).
Where(x => x.Name.
Contains(x => txtBox.Text));
That's about all you can do pretty much. (Thanks Microsoft).
Thank you for the example. But it wont work for me, it shows me the following error(s):
Code:
A local variable named 'x' cannot be declared in this scope because it would give a different meaning to 'x', which is already used in a 'parent or current' scope to denote something else
and
Code:
Cannot convert lambda expression to type 'string' because it is not a delegate type
Thats really odd from Microsoft, that they havent implementet the search function like in WinRT (Windows Store App).
The first error is pretty simple. You already have the variable named "x" and it would be very bad if compiler didn't give you that error.
Change the name of the variable to something else that you don't use in that scope and it will work.
And for second problem, try this one:
Code:
private List<string> Result()
{
var result = ((List<Windows.Storage.Search.CommonFileQuery>)Windows.Storage.ApplicationData.Current.LocalFolder.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByName)).Where(x => x.ToString().Contains(txtBox.Text));
return result as List<string>;
}
private async Task<List<string>> ResultAsync()
{
return await Task.Run(() => Result()).ConfigureAwait(continueOnCapturedContext: false);
}
You should call ResultAsync method and get the result in this way:
Code:
List<string> myList = ResultAsync().Result;
That's not going to work. You can't cast a StorageFile as a string.
To fix my code (simple lambda typo)
Code:
var result = (await Windows.Storage.ApplicationData.Current.LocalFolder.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByName)).
Where(x => x.Name.
Contains(txtBox.Text));
if(result.Any())
{
// Do shtuff
}
Also, you should never access the .Result of an async task because you never know if it completed yet.
Ok, first error is done, but the second error is still here
Code:
Cannot convert lambda expression to type 'string' because it is not a delegate type
You are missing the point of the TAP (Task Async Pattern).
Both main thread and async method will be in execution in the same time. When the async method finish his work, main thread will stop and catch the result trough the Result property.
TAP is the recommended way of asynchronous programming in C#. The only thing with TAP is to use ConfigureAwait method in non-console type of apps to avoid deadlock.
Sooner or later you will get the result from TAP method. Nothing will get in the conflict with the main thread.
Oh wait, @andy123456 I updated my response. I forgot String.Contains ISNT a lambda .
@Tonchi91, I know all about the TAP. I've been using it since it was CTP. I've seen the awkward situations with threading in WP .
Now... if he did
Code:
List<string> myList;
ResultAsync().ContinueWith(t=> { myList = t.Result; });
I wouldn't be worried .
Ok the errors are gone, but the debugger show me the following exception:
Code:
Value does not fall within the expected range
Is this search method case-sensitive? I tried with an exact input in the TextBox.
Hmmm. Let's see your full code.
its actually only for testing, so i added your code to a button (asnyc) and will show the output in a textBlock.
Code:
private async void buttonTest_Click(object sender, RoutedEventArgs e)
{
//Result();
var result = (await Windows.Storage.KnownFolders.CameraRoll.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByName)).
Where(x => x.Name.
Contains(textBox_test.Text));
if (result.Any())
{
// Do shtuff
textBlock_test.Text = result.ToString();
}
}
The error is coming from here
Code:
var result = (await Windows.Storage.KnownFolders.CameraRoll.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByName))
andy123456 said:
its actually only for testing, so i added your code to a button (asnyc) and will show the output in a textBlock.
Code:
private async void buttonTest_Click(object sender, RoutedEventArgs e)
{
//Result();
var result = (await Windows.Storage.KnownFolders.CameraRoll.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByName)).
Where(x => x.Name.
Contains(textBox_test.Text));
if (result.Any())
{
// Do shtuff
textBlock_test.Text = result.ToString();
}
}
The error is coming from here
Code:
var result = (await Windows.Storage.KnownFolders.CameraRoll.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByName))
Click to expand...
Click to collapse
Oh Camera Roll.. You MIGHT need to have the capability to view the camera roll enabled. I forget what it's called, but you need a specific cap in order to view from there. Also, I would try to see if you can use a generic folder instead.
I would try Windows.Storage.ApplicationData.Current.LocalFolder.GetFilesAsync() as your method after the await just to test whether you can read correctly.
Yes but in wp8.1 runtime app, there arent caps anymore. The capability for access to the pictures is simply calles pictures library and is enabled. I have tested it as you said, but it gives me the same exception.
A quick tip: another way to do this is to use the Win32 C runtime API. You can, for example, use the FindFirst/NextFile functions (http://msdn.microsoft.com/en-us/library/windows/desktop/aa364418(v=vs.85).aspx) which support searches using wildcards (* and ? characters in the first parameter). These functions are wrapped in my NativeLibraries classes, but are also just publicly available for third0party developers to call from their own C++ DLLs.
Alternatively, you can use the .NET System.IO.Directory class, which has functions like EnumerateFiles(String path, String searchPattern). This is probably the better way to do it, actually.
Of course, if you want these operations to not block the current thread, you'll need to explicitly put them in their own thread or async function.
EDIT: This also assumes you have read access to the relevant directories. You application data directory works fine, for example (you can get its path from the relevant StorageFolder object). Other directories that can be accessed via WinRT functions may go through a broker function instead of being directly readable.
The point is, that i have an array with filenames. Now i need the StorageFile files which contains these filenames. My idea was to search for these files and return the files as StorageFile, so i can work with these. Or is there a simpler / another way?
http://msicc.net/?p=4182 <-- try this
Thank you, i have already done this and its working. But how can i compare the Files to read, with already read files and take only the not yet read files?

Categories

Resources