[MTCD/E/P] Radio app reverse engineered - MTCD Android Head Units General

Hey,
I created my own Lauchner and wanted to integrate the radio functions.
Since I didn't find any information on the internet about how the original app addresses the radio module, I reverse engineered the app.
To make it easier for others I decided to start an Android Studio project.
The project is only very basic to show how the radio module is controlled.
I also added an extension to it.
Using the RDS signal and a SQlite database the station name and logo are displayed.
I hope it is helpful to anyone.
I uploaded the project to Github:
-https://github.com/zebbel/MTCD-E_Radio-app
(Sorry I´m not allowed to post links)
Kind regards
David

Great work!

Hey,
I have compiled the CarManager module into a jar file for easier use in Android Studio projects.
To be honest I never tried to understand how it works exactly, because it just works :laugh:
I know that I downloaded the files somewhere on Github, but I have absolutely no idea where.
If the "creator" of the files is here please let me know so I can give him credit.
-https://github.com/zebbel/microntek_CarManager
(I need still more posts to create links )

Thank you very much for your work!
Thanks to your library I realized a widget that reads (and shows) the battery voltage value.
I have a question : do you have a complete list of "type" that can be used ?
In you example you attached to your handler the types:
- Radio
- KeyDown
In my case I used "CarEvent" :
Java:
CarManager carManager = new CarManager();
CarManagerHandler carManagerHander = new CarManagerHandler(this);
carManager.attach(carManagerHander, "CarEvent");
In this way my Handler is receiving all the CarEvents. The voltage is contained in the message tagged as "battery".
There are other types that we can use in order to catch other interesting events?
Thank you,
Salvo

Related

Noterrific - note keeping/structuring app

Noteriffic 0.53
Copyright (C) 2004 Rudis Muiznieks
Noteriffic is a quick little app I wrote because I felt that the PPC was
lacking a nice, simple, free note keeping/structuring application that has a
desktop counterpart....
All credit goes to Rudis, but now we have WVGA-Screens, so :
Could anybody of those famous and brave developers
compile this VB-Project for >> WVGA << ?
(Its working fine with QVGA and VGA)
Thanks a lot
Creature/entity appeared in mirror,
LOL
kahe40, I wanted to change something in this app the other day so downloaded a trial version of visual studio from MS plus dotnet compact framework. It let me edit the Noterrific source code and compiled a new version fine. I'm sorry I don't have time right now to work out incorporating WVGA, but thought you might like to know what I found out.
ps. if anyone wants the new source/compilation I can post. I simply added the ability for the app to remember which node it is on and return there next time it opens (otherwise it always ended up opening way down the list which drives me mad).
thanks ddk2, please have nice holidays, maybe later we can see...
what do you think about a dark grey background with white text ?
dont know, maybe there are problems with icons and checkboxes ?
and second: in settings, there is: use smaller font for list/display
would you please change to: use bigger font (only one step)
kahe40, did a very quick patch for you, no longer have large/small font, just textboxes so you can set your font size.
Source attached. Find exe's in each project (pda/desktop) in subdir bin\Release.
This version has my mods as described above.
Before you use it, take a copy of your data file (ntn ext) as mine was cleared out somewhere during testing and had to restore. I don't think its a bug, just something from testing, but take backup just to be safe.
Also did a quick test of grey background. Doesn't look that good to me, icons didn't come out well etc. Also presents issues that unless hardcode to grey, then need to make user option to set colour and that's a whole lot of frigging around....be my guest
very nice, good job, thanks a lot my friend
kahe40, don't know if you are still watching this but I just discovered I made a cockup in the last piece of code. I misinterpreted the use of one variable and the resultant problem shows up next time you go to add a node (I haven't added one for quite a while).
This version has corrected that. Also, changed the way I had it remembering which node it was on between sessions. Now saves with the apps variables (a sep file) rather than in the note file itself. Plus side is its much faster closing the app. Another sideaffect is that when syncing the file between pda and desktop, they each have their own memory of the last used node.
Yes, I am guilty my friend,
I traded my TouchHD for an iPhone, dont want to be banned from
this forum, but - man, oh man - what a wonderful OS ...
So I use the old version as shopping-list with my KS20 (QVGA).
Will test your new version soon, thanks a lot.
hello there
I've found this app some weeks ago to keep track of my actions on my work
Like a time log
Is there some some other app (free/paid) that does the same job.
I've found this one for ipod...http://ax.itunes.apple.com/app/id371157360?mt=8
shame that there isn't none for wm

CycloneApps[By Request][ContactRetriever 3.0][CMessageSuite V1.0][CBRunner V1.0]

Hello Everyone,
I am a avid, aspiring developer, and as such I felt it would be mutually beneficial to start this thread. The Point of this this is for you [the users] to post up ideas for programs, and some sketch-ups of designs, and in return, I will try to make, and maintain, these applications.
In doing this, I will get the experience I need, and you [the users] will get the results that you [hopefully] want.
Below is [or will be soon enough] a list of programs that are developed or in the process of consideration.
Project List:
AutoSend - Scheduled SMS Sender [V3.5][NO LONGER BEING UPDATED]
CMail - A Replacement tmail for Devs and Advanced Users[V1.0]
Export-Studio - A FREE alternative app to export Contacts and SMS[V4.0 + Command Line Version]
Appointmentor - A command-line based app for creating appointments quickly and easily [V1.5]
ContactRetriever - A command-line based app for getting info on a specific contact! [V3.5]
CDL - A Command-Line based File downloader (designed with MortScripter's in mind) [Release Delayed]
CSort - A Command-Line based List Sorter (designed with MortScripters in mind) [V2.0]
ImgResize - A Command-Line based Image Resizer (Resize + Crop) [V2.0]
All2Reg - Based off of Msg2Reg, this will export MANY things to registry [Coming Soon]
TornadoClean - A utility for deleting old files/SMS/MMS/EMAILS with certain 'traits' specified by the user [Conceptual - PsuedoCode Stage]
CBRunner - [Idea courtesy of HowdyKeith] Runs EXE's (and possibly other file types like MP3, etc.) In the background so MortScripters can do their stuff! [V1.0]
CMessageSuite - A Re-Make of AutoSend with more features! [V1.0]
*As you can see, the list is sort of pathetic now, but with your help, I can bulk it up*
UPDATE:
A command-line version of Export Studio is now posted for all you Scripters!
Appointmentor[V1.5]
This program allows scripters and devs to quickly and easily make appointments. This program features the ability to set every parameter that a user could set thru the calendar itself (I believe...)
This Program Includes:
A documentation explaining all parameters
A small cmd-line app for creating appointments.
To Install:
Just download and extract the ZIP file to anywhere on your phone, and you are done!
To use:
Follow the parameters in the documentation, but as for running it, run it like any other command-line based program.
Tips:
Not all parameters must be set, as I have preset defaults (shown in documentation).
EDIT: DOWNLOADS REUPLOADED
V1.5 Update:
In this update, you can DELETE scheduled appointments. This feature has not been thoroughly tested, so errors may occur. Will test in near future. (If users could post back successes/failures it would help).
Please test it out!
*While I coded this on my own, credit must be given to google and this forum for its constant help in everything I do. Please don't forget that while these apps are free, donations are appreciated!*
Update:
I fixed up a major issue in Appointmentor and re-uploaded it. Now it should work. All documentation is provided in the ZIP file. Please test and post results and ideas!!!!
Image Resizer [V2.0](Command-Line Utility)
This application is a command-line based app for resizing images.
All instructions are provided in the Documentation.txt
Enjoy!
V1.5 Update:
In this version of the program, Cropping is now available. Look at the docs to find out how to use it. I also fixed an issue with Naming, so now the outputted file has the ACTUAL size of the image (not what is inputted in some cases). Also, you can use PERCENTAGE to resize/crop. Lastly, you can now simply convert your file from one extension to another.
V2.0 Update:
In this version, BatchCropping and BatchResizing is now available. Look at the docs to find out how to use it. This comes in handy when dealing with many pics in a folder. Please report back any bugs that are found
DISCLAIMER::::::
I did not code this program fully by myself. For the original Image Resizing project visit:
http://blogs.msdn.com/acoat/archive/2007/05/09/resize-images-a-thumbnail-maker.aspx
All Credit for the actual Image Resizing functions of this app go to the original author:
Username on msdn blogs is : acoat
Name (?) : Andrew Coates
ContactRetriever V3.5
This application allows a scripter or dev to export a specific contact's data for easy use!
This program includes:
A simple, easy to follow documentation and functionality
A light-weight solution for getting contact info.
A SUPER EASY GUI (contacts menu) when not wanting to start it in CommandLine mode.
The ability to export specific contacts (or many) as VCF files
To Install/Use
Just unzip the ZIP file and read the documentation!
(To use the GUI, just run the app WITHOUT parameters, to use the CMD run it WITH paramteres)
Bugs:
None so far!
V3.5 Update:
In this version, you can find contacts by partial (or full) phone numbers! Read the docs for more info.
Please remember that while I did the coding on my own, help came from XDA and Google and the millions of resources on the net. Please remember that while this application is free, Donations are greatly appreciated!
Enjoy!
UPDATE:::
Export-Studio 2.5 Is now out.
2.5 Has the ability to set the NUMBER of Contacts/SMS to be exported (with a safeguard that if the number is too high or is 0, it will set it to the maximum).
Expect an upgrade to Export-Studio 3.0 Soon (ability to export to VCF, and maybe MMS implementations).
Expect a new CMail to come out (ability to send E-Mail's via commandline and maybe MMS implementations).
Contact related app...
I've been searching for an app that allows to browse the contact list (with a scrollable list of names for a GUI... similar to Outlook or any other contact manager) and retrieves a selected contact full name as a reg key (my point would be using it in conjunction with MortScript and go2contact to add a dynamic contact launcher feature to my HS++ skin... guess it would be usefull for other skinning engines too).
Would you be willing to do such an app?
frmariam said:
I've been searching for an app that allows to browse the contact list (with a scrollable list of names for a GUI... similar to Outlook or any other contact manager) and retrieves a selected contact full name as a reg key (my point would be using it in conjunction with MortScript and go2contact to add a dynamic contact launcher feature to my HS++ skin... guess it would be usefull for other skinning engines too).
Would you be willing to do such an app?
Click to expand...
Click to collapse
Sure would be! I will just implement a GUI into ContactRetriever! Expect a release in 10 minutes TOPS.
UPDATE::
Export-Studio 3.0 Now released - Can export Contacts as vCard (VCF) format!
UPDATE::
ContactRetriever 1.5 NOW released - Has a really simple GUI (same functions)!!
UPDATE::
ContactRetriever 2.0 NOW released - Ability to export as VCF, control # of contacts, and WILDCARD'ing
Thank you so much! Just tried it and this was what I was looking for.
There seems to be an issue though... I can only get stuff from the first contact in the list... Also the name will be in all caps and have an underscore before it... I can't get any other contatcs info in the reg...
how about Cdown.exe -url "http:.../file.zip" -outp ".../file-Downd.zip"
as smartphones cant do that w/mort atm...
howdykeith said:
how about Cdown.exe -url "http:.../file.zip" -outp ".../file-Downd.zip"
as smartphones cant do that w/mort atm...
Click to expand...
Click to collapse
Added to project list....WOrking on it
Thank you so much for fixing ContactRetriever
While the paint is still fresh... Any chance on creating a value for the selected contact named "LastSelectedContact" (or something else) where the contact name is the data (without the preceding underscore and case sensitive like Outlook). Would really make it a lot easier to MortScript (I really have no idea how to get just the desired part of the key and remove the underscore).
Hope I'm not abusing of your good will...
Hey, so I can't really make a key that is for "lastcontact" because the command-line users may export a whole bunch of them (as you can see, I implemented the ability to export based on Wildcards)....
As for removing the underscore and such, I put that there as a standard for users so that they know what WAS created by my program, or what was created by something else that may have used the same area (rare, but possible).
Anyways, if you want to format it, do a substring on the Key name using the indexOf the _ as the ending for the first and that + 1 for the start of the second, then bring it all to lowercase then make the first uppercase (through substringing?) I don't know the mort-commands, but I am sure you can figure it out by asking HowdyKeith or posting on the MortScript thread or reading the Manual on Mort's website.
Good Luck
Thanks for the info. I've been reading the txt manual of Mortscript and it's kind of incomplete compared to the pdf... I'll read it tomorrow (must sleep) but until now I didn't find a function that returns the reg key (because it'll be random). I'm sure the substring bit will help.
Just found my contact list got sort of messed up by some app I used (guess it's too late to find out which one...) All the names (first and last) are now stored in the first name box... I didn't notice it before so I didn't get why was there a _ before the name even when I had a last name too.
Ok.
How about CSort.exe -inp "/path/Unsorted.txt" -outp "/path/sorted.txt"
maybe the option to dump the output into a regkey:
Sorted1=Alimoney
Sorted2=Bingo
...
If we r dumping to a reg folder, why not import from a registry folder too?
So i know u got the picture taking exe.
what about calling the Camera get picture class? Like your contact retriever calls the GUI.
I have to think about it to see if that makes sense.
howdykeith said:
So i know u got the picture taking exe.
what about calling the Camera get picture class? Like your contact retriever calls the GUI.
I have to think about it to see if that makes sense.
Click to expand...
Click to collapse
I am using Managed C# code, and the most 'power' that I get in terms of taking photos is just to start up the 'dialog' with certain paramters....so in MortScript, a script can just call it, then send the "ENTER" button to start and "ENTER" to stop (if it is a video) or save (if it is a photo)....
*FYI: The Camera App I am developing is currently in Private Beta, release soon enough*
So as far as contacts posted to the reg from contact retriever.
It probly should always delete the prior searches unless you give it a command -keep
For the advanced hacker: SQL database access and posting.
Do u have a Microsoft Bluetooth stack? There is no toggler for Widcomm Bluetooth. PhoneAlarm controls the bt just fine, so it's not impossible.
Can you turn on and off the flash? Other apps do it, so that's a low priority. But if you could and u added that function to an all in one tool, that would be cool.
Make a contact from a command line.
Can u change the power profiles? Normal/Headset/Auto...
Can u get the accelerometer info? i dont have one. Detect stylus removed from a command line?
I really hope u can get the sorter to the registry, so i am holding my breath til then.
Thanks Dude.

[APP] Resident Mort - Scary Good, not Scary Evil

*Anyone get the reference? Haha*
Resident Mort
The Scripter's Companion​
Current News / Status:
Resident Mort is currently Under Development
Resident Mort is planned to be a background EXE that will extend the functionality of MortScript available to developers through the usage of the "PostMessage" function.
Resident Mort is planned to extend functionality by adding extra, possibly more complex, functions or even adding in the ability for more complex GUIs.
Features (Green = Implemented, Blue = In Testing, Orange = Planned, Red = Failed):
GetProcessList - Gets a list of Running Programs
GetRecentApps - Gets a list of Recent Apps (10)
CreateScript - Creates a MortScript with the provided info
MakeFile - Makes a file of any kind with the provided info
MakeFolder - Makes a folder at the specified location
RegToEvent - Registers a File to an event​
UnRegFromEvent - Unregisters a File from an event
IsIdEventRegistered - Checks to see if a File is registered to an event.
DispImg - Displays an Image to the screen [and gets where the user Presses]
MakeForm - The Initial call for setting up an 'advanced GUI' form
FormAddObject -A Call that will add one of the predefined objects to the form being created
DeployForm - The Final call for setting up an 'advanced GUI' form, displays it to the user
This application is being made for MortScripters, to possibly make some projects easier. Since I don't use MortScript so much any more, I do rely on you the developers who use MortScript, to tell me what you want in the program.
Since I have a good deal of Functions there, I will commence work on a primary release
Saved For Future Use - Features and Screenshots
like the idea! advanced guis would be very useful
so this is a compiler? I am not sure what this is about
-sorry
No, this is a Resident App, an EXE that is always running in the background. It will have certain functions in it which can be accessed by MortScripters.
All the functions can be called with PostMessage ( I will provide documentation on how to do so, when I make a first release ). Then the results will either be written in the REGISTRY, written to a FILE, or copied to the CLIPBOARD (depending on how the scripter wants to handle the task).
Does this clarify it a bit?
Thanks for sharing!
A small update:
I am using this 'decent' planning utility, to help me keep track of my growing projects. According to this utility, the program is close to 30% complete. Then again, this is just a 'decent' utility haha. I would say, in my estimation (since some Code is "Copy + Paste"), I am close to 60% to 75% done.
A small change in my plans:
While I originally had the intentions of making this program as simple as a PostMessage in MortScript, I found out the following two Limitations:
1) MortScript's PostMessage/SendMessage only support(s) sending Numbers in the wParam and lParam parameters...very disheartening.
2) Due to #1, I made an assistant EXE, which would be run instead of calling PostMessage [this way I could do it Natively in my own control], but it is MUCH harder to transfer data between two applications that I would have thought! Due to Virtual Stacks and Memory Allocation 'rules', I couldn't EASILY do this.
So Here is my change:
In order to use Resident Mort, scripters will have to do about 3 or 4 commands to run. The only real commands that need to be used are PostMessage and RegWriteString (Did I get those right?).
In any case, my Resident Mort will read the Registry for corresponding wParam and lParam values and use those [in the future I will attempt Clipboard integration, to avoid Registry Interfacing].
When I release this program to the public, I will try to include a MortScript file that shows how to use all the functions. I don't remember much of MortScript [unfortunately], but I was thinking it could be helpful to make a "Library" of MortScript functions so a script will only have to call that function. But that is if some kind dev. would like to help out later on
Anyways, Thats that for this update. Expect a result in the coming week.
That sounds interesting for adv. gui functions.
Cyclonezephyrxz7 said:
1) MortScript's PostMessage/SendMessage only support(s) sending Numbers in the wParam and lParam parameters...very disheartening.
Click to expand...
Click to collapse
That's not MortScript's fault, it is design of whole Windows CE kernel, more here
I'd go with background EXE, that would listen to messages WM_USER+somenumber, maybe even region (for different actions, so you'd have both lParam and wParam free for another parameters). If you need help with this part, drop me PM on MSN, I had to study this a bit in the PinchToZoom project myself.
@OndraSter : Yeah, I know that Windows CE has limitations, however it is not impossible. Such an ability could be implemented in a code-update to MortScript. I did my reseach (if you look at #2, I mention that I found it much harder to transfer data between exe's that I had hoped) and found that you can transfer data via SendMessage (the Synchronous method) using a TRANSFERDATASTRUCT and WM_COPYDATA. If MortScripts interpreter could identify a SendMessage with a String value in either wParam or lParam, then it would create such a structure and transfer it, the receiving app would HAVE to take care of deleting the data though, or you have mis-used RAM.
As for how it is going to work now, I did not consider using WM_USER + a value, mainly because my program won't be using other Messages, and will only act if the correct wParam/lParam are provided (preventing accidental execution if the System decides to post a message with the same ID). I have it mostly covered, and I am closing in on finishing (currently with Reg data retrieval only, no Clipboard yet). I have completed 3 of the 7 Proposed Functions (MakeFile, MakeFolder, CreateScript) and I would have finished RegToEvents, but I got sorta lazy hehe. DispImg shouldn't take me more than a few minutes when I get to it, and once I get the API calls for Processes and figure out how to read the MRU reg-entry, I will have the last 3 complete!
As for Clipboard data retrieval, unless I am using the entirely wrong API calls, MortScript has an interesting way of using the Clipboard...I tried copying simple strings like "hello world" to the clipboard using MortScript, then trying to retrieve them in my Resident Mort, but the clipboard always comes up empty... Any ideas anyone?
Thats that for now I am about ready to release....any other functions you want implemented?
As for how it is going to work now, I did not consider using WM_USER + a value, mainly because my program won't be using other Messages, and will only act if the correct wParam/lParam are provided (preventing accidental execution if the System decides to post a message with the same ID).
Click to expand...
Click to collapse
http://msdn.microsoft.com/en-us/library/ms644947(v=VS.85).aspx
Good idea, the only downside being that it will generate the Message Numbers each time it is run... It is not assured that the Post / Send Message MsgIDs will remain constant.
Thanks for the link however
Cyclone,
Sorry about taking so long to post here...
How about, when the BT is on, this reports what is "out there" based on what the BT stack is telling you.
That is, it should read the surrounding area, then report that is saw my BT dongle. In the car, it should report that it saw my BT GPS unit.
Then, I can use that information to change my profile. That is, when it sees the BT dongle, regular phone calls. When it sees the BT GPS unit, run speaker mode, or connect to the GPS unit for phone calls.
Thanks!
--Ironhead
P.S. it would need to support the Touch Pro 2, Rhodium (my understanding is that it is Widcomm BT stack)
I"ll see what I can manage. I am really 'grid-locked' in my work on a couple of projects already So a release of this may have to wait a while....Sorry
I wish I had caught you a little sooner...
AutohotkeyCE may be a better base to work from than Mortscript...
http://www.autohotkey.net/~Micha/AutohotkeyCE/html/index.htm
In fact... AHKCE should be able to cater to all of your needs without the separate resident app
Yeah, I have seen that before. This project is really just a little challenge for myself to expand upon MortScript [because I know it is widely used].
Thank you for the link/suggestion however
I've been playing with Mortscripts for a while, I'm really thinking I can do everything I want, right from there...
EXCEPT:
Actually getting the information from the BT stack. I just need to see if there are any registered BT devices around my phone (so I can tell if I am in my car, at home, at work, etc.).
--Ironhead
Bumpity bump!
Hehe...Yeah, sorry for the lack of work on this. Check out FFP_LockScreen. I am working on a new release. I have very little time now, and I can't manage more than just one or two projects at a time. Once I release FFP_LS 3.0, I can devote some time MAYBE to this project. It all depends on how quickly the XDA-Marketplace idea takes off.
Sorry =\
I you can add a tool to make an GUI... it s must be soo cool...

Include local JavaScript within PhoneGap on Windows Phone 7

I have a PhoneGap application designed to work on multiple mobile platforms. I'm loading a dynamic HTML content from an external page on the Internet using jQuery Mobile. The problematic system is Windows Phone 7.
This is what I get from the external page, with the URL of the script tag already replaced to load from the phone instead of from the net to save bandwidth:
HTML:
<script type="text/javascript" charset="utf-8" src="x-wmapp1:/app/www/test.js"></script>
This works fine on Android, iPhone and even BlackBerry when I replaced the x-wmapp1: part by a respective counterpart (e.g. file:///android_asset/www/ on Android). However, on Windows Phone 7 it doesn't seem to work at all.
When I try to load the same URL via $.getScript function, it always returns a 404 eror, even if I try and load it with a relative path only.
Any suggestions?
First of all, this type of question may be better suited to the Software Development or Apps and Games sub-forums, as a lot of the people who hang out here are more familiar with homebrew hacks. I'll give it a shot, though.
First of all, what kind of path are you trying to use? I haven't tried loading scripts or images in HTML or JS, but to dynamically load content within the app itself typically requires some care with regard to the path. For example, is the JS file being built into the assembly (as a resource) or included alongside it (as content)? How about the HTML page?
This is a kind of lame approach, but one option that's sure to work is just inlining the scripts in the page, directly. That won't increase the total app size or load time at all, although it might make maintaining the app take a little bit more effort.
Thanks for the reply, I will try to post this into the more appropriate forum.
With regards to paths - you can see the path in the HTML snippet I provided in the original question. It's all a bit specific and we cannot afford to load JS directly from page, since that does increase the size of the resulting HTML, sent from an external PHP page, thus increasing bandwidth. This is the first reason why we chose to have all JS and CSS files directly bundled with the application and load them internally rather than from Internet.
Also, all of JS files are included alongside the application as content. I'm using the same approach for all images, since if they were included as a resource, they would not show in the application.
GoodDayToDie said:
First of all, this type of question may be better suited to the Software Development or Apps and Games sub-forums, as a lot of the people who hang out here are more familiar with homebrew hacks. I'll give it a shot, though.
First of all, what kind of path are you trying to use? I haven't tried loading scripts or images in HTML or JS, but to dynamically load content within the app itself typically requires some care with regard to the path. For example, is the JS file being built into the assembly (as a resource) or included alongside it (as content)? How about the HTML page?
This is a kind of lame approach, but one option that's sure to work is just inlining the scripts in the page, directly. That won't increase the total app size or load time at all, although it might make maintaining the app take a little bit more effort.
Click to expand...
Click to collapse
First question: have you set the IsScriptEnabled proerty on the control to True? It defaults to False, preventing scripting within the control. Also, changing it only takes effect
on navigation, so if you already loaded the page and then set this property, it still won't work.
Anyhow, I missed that your HTML was coming externally, and only the scripts and stylesheets were local. That's... interesting, and seems reasonable enough, and I can't find any info online that exactly matches your use case. The way you're structuring the script src URI looks weird to me, but I haven't messed with the WebBrowserControl very much at all.
One solution, though a bit hacky:
Use the WebBrowserControl's InvokeScript function to dynamically load scripts into your pages. To do this, you would first need to load the script file content into a .NET String object. The GetResourceStream function is probably your best friend here, combined with ReadToEnd(). Then, just invoke the eval() JS function, which should be built-in, and pass it the JS file content. That will load the JS into the web page, creating objects (including functions) and executing instructions as the files are eval()ed.
Of course, you'd need to do this on every page navigation, but you can actually automate it such that the page itself requests that the app load those scripts. In your app, bind the script-loading function to the ScriptNotify event handler, probably with some parameter such as the name of the script to load. Then, on each page served from your server to the app, instead of including standard <script src=...> tags, use <script>window.external.notify('load localscript1.js')</script> and so on; this will trigger the app's ScriptNotify function for you.
I hope that helps. I can see your use case, but somewhat surprisingly, I couldn't find anybody else online who had either run into your problem or written a tutorial on doing it your way.
Thank you for your reply, it was very informative. One question though - why do you think the way I'm structuring the SCRIPT URI is wierd? I tried to mess around with relative URIs and the such, however those would load the JavaScript file from Internet rather than from the application itself.
The problem I'm running into with your proposed solutions, however is that:
1. the project is a PhoneGap/Cordova application, using its own components, so I have no idea where I would look for IsScriptEnabled here (although this all worked on an older PhoneGap release, so I'm guessing they have it set up correctly)
2. injecting a script programmatically on each navigation would require me to rewrite much of the code we already use for other platforms, not to mention those custom Cordova components, which I don't even know if they can handle such thing
As for my user case - I was surprised to be the only guy on the internet with this methodology in place as well. So it either works for everyone else or nobody really thought of doing it my way, since it's basically an Internet application (maybe the don't want to disclose their sources, who knows).
CyberGhost636 said:
1. the project is a PhoneGap/Cordova application, using its own components, so I have no idea where I would look for IsScriptEnabled here (although this all worked on an older PhoneGap release, so I'm guessing they have it set up correctly)
Click to expand...
Click to collapse
In the WebBrowser properties.
CyberGhost636 said:
As for my user case - I was surprised to be the only guy on the internet with this methodology in place as well.
Click to expand...
Click to collapse
Of course you not "the only guy". I've tried to port/run a few HTML java-script based games on WP7 (Digger and couple more) more then year ago; they runs well with one HUGE exception - touch screen events are freezing scripts execution and make games not playable.
The "x-wmapp1:" URI scheme was what I was referring to. Not sure where that comes from, but I haven't done anything really with the WebBrowser control.
I have no knowledge of PhoneGap or Cordova; I assume they're "we write your app for you" frameworks? One would assume that such tools would know to set IsScriptEnabled, but you may have to do so manually. A bit of web searching on that direction may be fruitful - maybe earlier versions enabled scripting by default, and now it's disabled by default so you have to specify an option somewhere?
Injecting the script on navigation really doesn't require any major change to the server-side code. I mean, is sending
<script>window.external.notify('load localscript1.js')</script>
really much different from sending
<script type="text/javascript" charset="utf-8" src="x-wmapp1:/app/www/test.js"></script>
? If that's too different, you could instead send
<script src="http://yourserver.com/LoadLocalScripts.js"></script>
and put "LoadLocalScripts.js" on your server with the following code:
window.external.notify('load localscript1.js');
This has only a trivial increase in server traffic and load time, but lets you continue using external scripts instead of inline ones. Very little server-side change needed at all.
Now, the additional client-side code to support the window.external.notify and call InvokeScript... normally I'd say that's dead easy, because it is if you have any experience with the .NET framework, but in your case I get the feeling that this isn't so? I code to the framework, or to the underlying native code, and I tend to code "raw" (very little auto-generated code), so I'm not going to be able to help you solve the problems with a "make me an app" wizard unless I can see the code it generates for you.
For what it's worth, here's the approximate raw code that I'd use (it's over-simplified, but close enough):
void HandleNotify (String param) {
String[] parts = param.split(" ");
if (parts[0] == "load") LoadScript(parts[1]);
}
void LoadScript (String script) {
String content = Application.GetResourceStream(new Uri(script, UriType.Absolute)).ReadToEnd();
theBrowserControl.InvokeScript("eval", content);
}
void theBrowserControl_Loaded (...event handler args here...) {
theBrowserControl.IsScriptEnabled = true;
theBrowserControl.ScriptNotify += HandleNotify;
theBrowserControl.Navigate("http://yoursite.com");
}
the URI comes from Windows Phone itself, with this code, you can see for yourself:
var a = document.createElement('a');
a.setAttribute('href', '.');
alert(a.href);
also, I've been informed that this works in Cordova 2.0, so it might be a 1.8.1 bug... will try and see how it goes
thanks for your help so far!
Looks like it was a problem with PhoneGap 1.8.1 - after upgading to Cordova 2.0 (PhoneGap got renamed) it all works now... thanks for all the help!

Hardcoded Password in GPS Library

Hey everyone, I've been a lurker for quite sometime, so I'm finally posting something. This is isn't in any of the dev sections because this is my first post.
When I first got my GNex (toroplus) was very annoyed with the capabilities of the gsd4t gps chip. Static navigation makes it really hard to use the chip for telemetry projects and the 1Hz position update doesn't give me enough sample data for the things I'm working on. I decided to do some investigation to see if it was limited to the hardware itself or the driver.
I scoured the forum, and tried a bunch of apps, found datasheets and the what not and nothing really improved my situation. I decided to take matters into my own hands and poke around lib_gsd4t.so (stock).
With verbose logging turned on, I noticed an interesting looking entry.
Code:
Hello EE downloder !!!.
{sgee.samsung.csr.com, instantfix.csr.com}, port : 80
Y3Nyc2xsOmROTkw5NnN1, /diff/packedDifference.f2p3enc.ee, format 2
EE_DOWNLOAD: EE_Download_Init done.
EE_Download_Init - returned 0 !!!.
EE_DOWNLOAD: EE_Download_Start successful.
EE_DOWNLOAD:EE_Download_Scheduler started; server_address=(sgee.samsung.csr.com,instantfix.csr.com), port=80, file=/diff/packedDifference.f2p3enc.ee
...
The string Y3Nyc2xsOmROTkw5NnN1 really stuck out to me. The character set fit in the base64 space which for some reason or another, developers seem to think base64 encoded text is somehow a good way to make things more secure. I have seen this numerous times. To me, it just makes it more noticeable that someone is trying to hide something.
So I went ahead and decoded the string and got
Code:
csrsll:dNNL96su
Just to be sure it wasn't some string unique to my phone, I checked where it most likely came from, which is the lib_gsd4t.so and it is indeed there (@offset 0x1b7429).
What's so special about that string?
I'm almost 100% sure that it is the username : password combo for downloading the SGEE data. I'm guessing it is using a post request (anyone wanting to use wireshark to packet sniff this can confirm) because there are extra parameters being used to retrieve the data.
Have I tried to access the file with those credentials?
No.
Why am I posting this?
I thought it was funny that the username and password are hardcoded in the driver and written to the logs. What's the point of having it password protected if you're just going to tell everyone the account credentials?
My actual job involves application security and I used this as an example for the other programmers on my team as to why we shouldn't ever mistake encoding for encryption and if you try to hide something, chances are you are actually drawing attention to it.
Oh also, is anyone interested in knowing more about the library. I have figured out quite a bit
How odd!
If you've figured out the gps drivers maybe you know how to make an updated file to disable static navigation? I op'd this thread http://forum.xda-developers.com/showthread.php?p=38684789 based on the ics version, but would love an android 422 based mod.
I posted my modded drivers. It may also require new configs.
afrotronics said:
I posted my modded drivers. It may also require new configs.
Click to expand...
Click to collapse
Did you ever figure out the proper request? (curl or wget?)

Categories

Resources