[Q] web app - Windows Phone 7 Q&A, Help & Troubleshooting

Hello,
I dont know if the title fits, so i gonna explain my Problem.
I want to Programm a Game With User Login. Sadly wp7 doesnt Support SQL api, so i cant make the User Management directly over sql.
So i got a Website with a working Login Formular. I want to link the wp7 textboxes with the textboxes of the Website which works with SQL.
Is there a simple way to get this working? Or does anyone have a better idea to get my User Management working?
Greatings win99
Sent from my HD2 using Board Express

Hmm... I can only suggest you to learn how to do http requests (and general programming of course). I hope u'll stop thinking in terms like "linking textboxes"

yeah, "linking" is maybe the wrong word
What exactly do you mean with "http request"?
I can program a bit html an php, which i could include in a "WebBrowser" control. This way i could use php with mysql, but i don't want to make a browser game.
Is there somethink like a "http database"? Cause i don't know yet any database based on http. And is there an API availible to do this requests from a panorama app?
Sorry for this basicly questions, but i'm just a hobby programmer and since now i just programme windows desktop projects, where i could easily use SQL.

Your "very basic question" requires a very long answer (sorry, but I don't have enough time. Also, I'm not an expert in SQL http communication). FYI, all communications between web page (and you can treat your WP7 page as a web page) and SQL server based on HTTP POST requests (but of course not on "linked textboxes"! ). So, try to google with words such as "WP7 SQL HTTP POST" - first five links possible will have all info you need (but you should understand "how everything works" first!)

ok, if i understand it correctly, this sound like instead of using "app<->SQL" i should use "appy<->http<->sql".
i will try to find some good tutorials and reply on success/ no success.

win98 said:
ok, if i understand it correctly, this sound like instead of using "app<->SQL" i should use "appy<->http<->sql".
i will try to find some good tutorials and reply on success/ no success.
Click to expand...
Click to collapse
Well, from the sounds of it, I am going to assume you networking and web API knowledge and maybe decent enough MySQL/SQL/Database knowledge, and possibly somewhat new to WP7 C#.NET (Don't take this personal or a lashing towards you, not the case, I mention it so I can be basic and to the point without assuming you know what references I make or offend you).
If you want an "out-of-the-box" easy solution, let's stop and go download RestSharp (http://restsharp.org). After you get it, visit: https://github.com/restsharp/RestSharp/wiki/Getting-Started, as this will give you a great example of HOWTO use this solution.
You also need to remember about the footprint, a 90MB limit (Max) on 256MB phones. Too big can cause some issues.
Also, another good option is SQLlite, probably one of the most popular, straight forward and well respected (I even use it on some projects). Should you choose to use it, go to http://sviluppomobile.blogspot.com/2010/07/wp7-sqliteclient-preview.html and read his Blog post, VERY informative and a Sample available for you to learn from as well.
If you really wanted to do this yourself, you could create an HTML page and do all your coding in it (e.g. Login Box) and use JavaScript as well, this way you grab the contents from your textbox(s) and send to the embedded web browser you load the HTML page in, hence scripting is available for WP7 but must enable scripting support and highly recommend to use IsolatedStorage and can invoke JS just as easy as:
window.external.notify("(Task)Param)");
So this should hopefully get you to where you want to be but if any of the above statement I made was true, I recommend out-of-the-box solutions for you.
Thanks,
Lance

lseidman said:
If you really wanted to do this yourself, you could create an HTML page and do all your coding in it (e.g. Login Box) and use JavaScript as well, this way you grab the contents from your textbox(s) and send to the embedded web browser you load the HTML page in, hence scripting is available for WP7 but must enable scripting support and highly recommend to use IsolatedStorage and can invoke JS just as easy as:
window.external.notify("(Task)Param)");
Click to expand...
Click to collapse
This is the way i planned to do it. How do you call it? For me it is hard to find a tutorial or book or something like that, cause i don't know which keyword to google
thanks anyway

win98 said:
This is the way i planned to do it. How do you call it? For me it is hard to find a tutorial or book or something like that, cause i don't know which keyword to google
thanks anyway
Click to expand...
Click to collapse
First and foremost, I appreciate your honesty which is why I will basically show you the way...
Well, if you wish to invoke JavaScript via WP7 you can, like below:
1). Open your Mainpage.xaml and find the grid and insert:
<phone:WebBrowser HorizontalAlignment="Left" Name="webBrowser1" VerticalAlignment="Top" Height="xxx" Width="xxx" IsScriptEnabled="True" ScriptNotify="webBrowser_callback" />
2). Make an HTML page, go in the HEADER section and type something like: "<SCRIPT LANGUAGE="JavaScript" src="HelloWorld.js"></SCRIPT>" and add a button that has a function to fire upon clicking + name the section like:
<h1 id='myName'>Hello World!</h1>
<form>
<input id="button" type="button" class="button-standard" style="width:200;height:100" value="Hello World!" onClick="HelloWorld()"/>
* Remove the Quotes from above...
3). Make a file called HelloWorld.js and put in something like:
function HelloWorld() {
window.external.Notify("Name");
}
function sets(val) {
document.getElementById('myName').innerHTML = val;
}
4). In your Mainpage.xaml.cs, find where you want to invoke the script/site and put in:
webBrowser1.Navigate(new Uri("http://lance.compulsivetech.biz/login", UriKind.Relative));
*Change the URI to your address, not my blog's fake login...
5). Since we are loading the site locally in Isolated Storage, go forth and type this in:
private void CreateDirOnStore(string strDir)
{
// Create a directory for local storeage.
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();
if (!isoStore.DirectoryExists(strDir))
isoStore.CreateDirectory(strDir);
}
private void SaveFileToIsoStore(string strFileName)
{
// This will save the file to the isolated storage based on the string provided.
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();
//remove the file if exists to allow each run to independently write to
// the Isolated Storage
if (isoStore.FileExists(strFileName) == true)
{
isoStore.DeleteFile(strFileName);
}
StreamResourceInfo sr = Application.GetResourceStream(new Uri(strFileName, UriKind.Relative));
using (BinaryReader br = new BinaryReader(sr.Stream))
{
byte[] data = br.ReadBytes((int)sr.Stream.Length);
//save file to Isolated Storage
using (BinaryWriter bw = new BinaryWriter(isoStore.CreateFile(strFileName)))
{
bw.Write(data);
bw.Close();
}
}
}
6). In your public MainPage() put:
this.Loaded += new RoutedEventHandler(Load_WebPage);
* Always put stuff after your Intialize call
7). We need to make a page load function as below (in xaml.cs):
void Load_WebPage(object sender, RoutedEventArgs e)
{
//Set the start folder of the widget and navigate to the start page
CreateDirOnStore("helloworld");
SaveFileToIsoStore("helloworld/index.html");
SaveFileToIsoStore("helloworld/helloworld.js");
webBrowser1.Base = "helloworld";
webBrowser1.Navigate(new Uri("index.html", UriKind.Relative));
}
8). Now we invoke the function as seen below:
void webBrowser_callback(object sender, NotifyEventArgs e)
{
//Use invokeScript to give to the web env.
webBrowser1.InvokeScript("eval", new string[] { "sets('txtName.Text')"});
}
Hope this helps, this is basically off the top of my head but should be pretty close to being right and Mango Compat.

Creating a WCF services that calls SQL will be the quickest way...about 30 minutes.

Related

Wanting to develop for WM haivng some problems

Hi I want to make an application using location, I found this tutorial
http://msdn.microsoft.com/en-us/library/dd938890.aspx#RetrievingLocationInformationthroughGPS
which looks very helpful but because I am new to visual studio I am having some problems.
1) is the article it says "This article includes complete sample code." but I cant find a download for all the code.
2) he only mentions referencing Microsoft.WindowsMobile.Samples.Location.dll which I have done but the class LatLong is still unknown
3) I made a sample program without the LatLong class just to experiment I get the following error on my device
"Microsoft.WindowsMobile.Samples.Location, Version=1.0.3448.25673, Culture=neutral, PublicKeyToken=null, or one of its dependencies, was not found
any idea what this means?
4) Could all my problems be because I am using visual studio 2005 and not 2008? I found a code project that looked really helpful but when trying to open it it says that it cant because it is from a newer version of the software, anything that can be done?
5) I find MSDN confusing for finding out what to reference to add a class for example this is the page for the LatLong class http://msdn.microsoft.com/en-us/library/cc514548.aspx
with the java online info the first thing you always see is where the class is found but it seems to be missing for this class. Other basig classes appear similar to java.
below is my sample code its basically taken from the article but I have commented out the references to LatLong and put in checks instead
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsMobile.Samples.Location;
namespace DeviceApplication3
{
public partial class Form1 : Form
{
private Gps gps;
int count = 0;
public Form1()
{
InitializeComponent();
gps = new Gps();
gps.Open();
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = (getGpsString());
}
private string getGpsString()
{
GpsPosition position = gps.GetPosition();
/*LatLong location = new LatLong();
if (position.LatitudeValid)
location.Latitude = position.Latitude;
if (position.LongitudeValid)
location.Longitude = position.Longitude;
if (position.HeadingValid)
location.Heading = position.Heading;*/
StringBuilder sb = new StringBuilder();
sb.Append("\n");
sb.Append("Latitude = ");
if (position.LatitudeValid)
{
sb.Append(position.Latitude.ToString() + "\n");
}
else
{
sb.Append("Not found yet\n");
}
sb.Append("Longitude = ");
if (position.LongitudeValid)
{
sb.Append(position.Longitude.ToString() + "\n");
}
else
{
sb.Append("Not found yet\n");
}
sb.Append("Heading = ");
if (position.HeadingValid)
{
sb.Append(position.Heading.ToString() + "\n");
}
else
{
sb.Append("Not found yet\n");
}
return sb.ToString();
}
}
}
Microsoft.WindowsMobile.Samples.Location.dll
is this file located in bin\debug and or \bin\release
?
and does it only give runtime errors or also compile time ?
no it compiles fine, can you see anything wrong with my code? The weird thing is the form comes up using the emulator but not on the device. Could it be because I have a custom rom that seems to have compact framework 3.5? I would assume it would be back compatible?
How have you deployed it to the device? Have you copied the .exe and the Location.dll?
one thing you could also test was if you could disable the stuff in the gps
and just run a program without it to verify that it's not missing net3.5's fault
heliosdev said:
How have you deployed it to the device? Have you copied the .exe and the Location.dll?
Click to expand...
Click to collapse
Hi thanks for this I didnt copy over the dll I'm very silly.
So what do you guys think about loading projects ment for vs 2008 in 2005 is this impossible ? or can i convert them somehow?
sure it's only the project and solution files which differ
add the cs files manualy and it should work fine
Use the same name to create the new project in vs2005 to have the same namespace.
You'll have to do some manual changes if the code uses c#3.0 .net 3.5 features.
Thanks guys your awesome,
very random and off topic but since your programming kings ill ask anyway,
I think I want to eventually work in the gaming industry, I'm close(3months) to finishing my MSc CompSci conversion course and I am looking for jobs, its quite aparent that most games companys don't want unexperienced people so do you guys have any ideas of places to apply for that will give the the necessary experience? btw I have no taught experience with C++ which I think is my biggest dissadvantage, I do know C and java quite well though and as you can tell just starting to play with C#.
your help is always appreciated.
well, continue with general programming (object oriented programming, ui development, database, network,...). There are so many different fields in software development!
For example take a look at the chapters of the books in the game programming gems series to see what (not only) gaming companies are working on. In general for beginning there is a lot of information online where you'll find tons of tutorials.
Try to get a profound base in programming.
Starting with your gps application, develop a gui, save/load the positions (database), visualize the points...
heliosdev said:
well, continue with general programming (object oriented programming, ui development, database, network,...). There are so many different fields in software development!
For example take a look at the chapters of the books in the game programming gems series to see what (not only) gaming companies are working on. In general for beginning there is a lot of information online where you'll find tons of tutorials.
Try to get a profound base in programming.
Starting with your gps application, develop a gui, save/load the positions (database), visualize the points...
Click to expand...
Click to collapse
Hi sorry for the late reply I upgraded to windows 7 last night to try and improve my rubbish laptop, seems to be a bit better btw,
anyway just want to say thanks for the advice. also my app will use google maps yahoo zonetag and windows live earth (or bing maps if thats what there calling it now) I think for some of thoes services I will need to pay to realease my app to the public even if its free but what about testers would I be able to give it to say 10 people?

[Q] How to retrieve image from sql server into window phone?

I had error ArgumentNullException was unhandled when run my coding.
Code:
public class ImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
byte[] buffer = value as byte[];
[B]Stream memStream = new MemoryStream(buffer);[/B]
WriteableBitmap wbimg = PictureDecoder.DecodeJpeg(memStream);
return wbimg;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
The bold line is where the error occur..
Any solution to this error or any other suggestion for me to retrieve image into window phone? Thank you.
Well...
Well, I guess you enter your method with value as null. Your code snippet does of course not show just why value might be null.
Pardon me this innocent question: Why don't you just take the whole thing into the debugger and watch what happens?
Either value is null, or value is not a byte[].
It would be better to just cast it to byte[] instead. That way you would get a different error if it's not a byte[], than if it's null. This would be of some diagnostic value but as another poster mentioned your best bet is to run this in a debugger to see what's going on.
save the image name in database,
Sorry, may i know how to test it in debugger mode?Thank you.
Too early?
hueikar said:
Sorry, may i know how to test it in debugger mode?Thank you.
Click to expand...
Click to collapse
I don't want to offend you, and of course you are free to do whatever you like, but I think it's too early for you to build a full and maybe complicated WP7 app. Do you know the saying "First you have to learn to crawl before you can try to walk"? I think you should learn the fundamentals of using Visual Studio and programming for WP7 from some nice book or online tutorial first.
Even working with complete code samples, as you seem to try, does not help, if you ask me. At least it always was like that when I tried it myself: If in the past I tried to get some code samples to work that I did not understand myself, the first trivial problem already stopped me dead in my tracks. I only had success after my knowledge had progressed to a point where I could read and understand the samples.
Sorry. Yes. I admit that i am too rush to do a win7 app. This is my first time doing window phone app and so with the language c#. But i kinda run out of time to do learning..My first mistake is choose wrong title to do window phone app as my final year project..Luckily so far i manage to do the CRUD for the app.but this is the most difficult problem i am facing now..
Well, in answer to your question, Visual Studio has a Debug button. Select whether you want to debug on the emulator or on your phone (the latter requires that the phone be connected to the PC and Zune be running) and give it a try. If you want to use the media library while debugging, you'll need to use the WPConnect program (it's part of the dev tools, I believe) which allows you to close Zune after you establish the connection, thus unlocking the media library on the phone.

Link contact adress to Nokia Drive

I use my7rom on my Omnia 7.
Is there anyway to link a contacts adress to Nokia Drive instead of Maps (stock wp7 app). It would be much more practical if Nokia Drive opened a navigation session instead.
Anyone up for the challenge? A reg-tweak perhaps?
// Manneman
Skickat från Windows Phone 7.8
There's two parts here. The first is identifying the correct "filetype" or URI scheme that is used for navigation. That shouldn't be too hard; a little digging in HKCU should reveal it. We already know about ones like callto: and http: and I'm actually (slowly) working on an app to allow people to easily change them. The second part is finding the correct command to load that address or route in the Nokia Maps app. If the app supports pinning routes or destinations to Start, this is probably possible. If not, it may not be possible in the app. Most apps aren't designed to accept command-line parameters, so even if you make them the default handler for a given filetype or URI scheme, they ignore the value you send them and just start as though launched from Start.
GoodDayToDie said:
If the app supports pinning routes or destinations to Start, this is probably possible.
Click to expand...
Click to collapse
Nokia Drive supports pinning to start so it should be possible. Unfortunately I can't tell you exact command line parameters 'cause my Lumia 900 still "in jail"
Let me see if I have a copy of the Nokia Drive XAP handy. I'll need to decompile it to figure out the correct parameters for launching it with the intent of navigating to a specific location. Note also that this might not be possible directly - for example, the app might store a list of locations internally, and the tiles only provide an index into that list rather than providing the location directly - but that just requires another layer of indirection.
In that case, you create an app that gets registered as the navigation handler, and in response to a navigation request, it writes the requested location into the Nokia Drive app and then chain-launches Nokia Drive with the index of the newly written location. That's just an example of one way that this might go wrong, but overall, the odds are actually pretty good. Obviously, all of this will require, at a minimum, write access to the HKCR hive in the registry.
Ah, guys! You are so kind helping me out. I´m really certain alot of members in the WP7 section would love for this to work!
// Manneman
GoodDayToDie said:
I'll need to decompile it to figure out the correct parameters for launching it with the intent of navigating to a specific location
Click to expand...
Click to collapse
GoodDayToDie, you may try much simpler solution. Just create assembly (dll) to show startup parameters in message box, and replace main Nokia Drive dll (but pin some location first).
That's actually harder than it sounds; even if the app is sideloaded (which would mean I already have the DLL) my fake would have to mimic the internal structure of the real app to a degree (namespaces, class names, default actions, etc.). That's not hard, but decompiling .NET is pretty trivial too.
AFAIR, Nokia Drive is obfuscated (but I'm not 100% sure). Also, you don't need to duplicate all names and structures; just a stuff mentioned in WMAppManifest (I hope so). BTW, I forgot: I still have unlocked handset; if I'll found time, will try today later.
Update: tried but without of luck What I did:
- installed Nokia Drive first;
- downloaded map and pinned current location;
- created fake app with same app guid and namespace name ("Drive"), and performed app update (that operation completely override whole solution but NokiaDrive tile still pinned to the start screen);
- tried a few different page names (_default.xaml, QuickStartPage.xaml, DestinationPickerPage.xaml, FavoritesPage.xaml) with code
Code:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
MessageBox.Show("Hello from fake dll");
if (e.NavigationMode == System.Windows.Navigation.NavigationMode.New)
{
string[] keys = NavigationContext.QueryString.Keys.ToArray();
string[] values = NavigationContext.QueryString.Values.ToArray();
string param = "";
for (int i = 0; i < keys.Length; i++)
{
param += keys[i] + " -> " + values[i] + "\n";
}
MessageBox.Show("parameters: " + param);
}
}
But result always the same: app doesn't start from the pinned tile
Update 2: Finally, I did it
The trick is:
- do the same as I've described above (you should have pinned tile from ND);
- add following code to the start page:
Code:
public MainPage()
{
InitializeComponent();
var appTile = ShellTile.ActiveTiles.Last();
if (appTile != null)
{
//MessageBox.Show(appTile.NavigationUri.OriginalString);
EmailComposeTask emailTask = new EmailComposeTask();
emailTask.Subject = "NokiaDrive pinned parameters";
emailTask.Body = appTile.NavigationUri.OriginalString;
try
{
emailTask.Show();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK);
}
}
}
- run app as usual (not from tile);
We allset - all params are sent to our email (I'm too lazy to manually copy all stuff )
Here we are (start parameters; bold values are changed for privacy reason ):
/_default?destination.name=200 SomeName Street&destination.latitude=49.5255378801376&destination.longitude=-72.4296837244183&destination.address.street=SomeName Street&destination.address.houseno=200&destination.address.district=&destination.address.county=&destination.address.city=SomeCity&destination.address.state=&destination.address.country=USA&destination.address.postcode=05720&destination.hashCode=371767793destination.address.statecode=MA&pinnedFrom=Favorites
P.S. Just found: Navigon also has ability to pin address to the start tile So, if you find the way to modify map protocol (or how it calls), it will be a really nice hack! BTW, could you remind me: do we have ability to launch assembly by GUID (on the full-/policy-unlocked phones)? If "yes", it's possible to write a real nice "proxy" app to handle map requests
I don't know about launching assemblies directly, but it's certainly possible to launch apps by GUID. It doesn't even require anything more than dev-unlock in fact (although of course you can only launch apps that you could launch anyhow). So yes, a proxy app is totally possible. That's actually what I'm working on (started as a project to make a Kindle ebook file loader, that would pur .mobi/.prc file in the Kindle app's folder and then launch the app).
GoodDayToDie, could you please, take a look to the registry, for default map protocol handler and figure out how to change that stuff? I'm pretty busy these days (and probably will be extremely busy couple of next months) but we can cooperate and create this app...
I'll investigate, but you're not the only one busy. If you've noticed a lack of software from me recently, it's due to the nex job I got some months back; I love it, but it leaves me with a lot less time for phone hacking if I want to still have a life outside of that.
With that said, this actually ties into the work I'm already doing with things like filetype handling and default browser switching. I can send you my HKCRlib, at a minimum; it's a library that simplifies interacting with HKCR, including creating backups of important values when they change, and reverting the backups.
GoodDayToDie, truly, I'm not much interested (personally) in that hack 'cause I can't use it for my Lumia 900. So it's only for the community needs but because of lack of time, I believe, we may put it on hold.

Help for starting developing

Hi Guys,
I wanna start developing apps for the gearS2. Foir now I have some experience with html and several other languages mainly for windows applications and also last programming job was like 6 years ago so I'm not really up to date with all the different options for developing.
For start I tried to use the tizen SDK but I'm a little lost due to the variaty of options and also the quite buggy SDK. Installing the 2.4 SDK left me with an error for the simulator (hax not working). I t hink i got arround this by installing this manually. Emulator works now but for example the UI builder doesnt work. So my thought is to start a web app with tau as this seems to work quite reliable. My goal is to write a basic control of my hue lights (I know there is an app for that but I wanna try to build my own). My plan is to use an java lib for the hue commands and do the rest via the tau/html/javascript.
Now my question is if anyone can give me any advice on how to start developing. Does my plan seem valid. Can anyone help me or give me some tips? Maybe I'm missing something or someone just has some shortcuts.
Thanks in advance.
Björn
Hi.
I found this "howto" : http://www.tizenexperts.com/2015/12/how-to-deploy-to-gear-s2-smartwatch/
It helped me to successfully deploy a project sample on my gear s2 folllowing these steps :
- install sdk
- generate & configure author certificate.
- download, compile and run/deploy a project sample on the gear s2 (SensorBall).
During the "Request the Certificate" step, I ran into this java exception :
Unhandled event loop exception No more handles [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]
Click to expand...
Click to collapse
I'm on "debian jessie" with "openjdk7":
If this happens:
- install package "libwebkitgtk-1.0-0"
- add "-Dorg.eclipse.swt.browser.DefaultType=webkit" to you "eclipse.ini" file
- restart tizen.
At the end, you'll have a new app installed on your watch. You can recognized it with the tizen icon.
I hope this can help you.
Bye.
thank you for your feedback akaiah.
I found this site earlier, requested a certificate but then I couldnt find the site again. So thx for the link.
My problems are more linked to
a) the general structure of webapps for tizen
b) rusty coding skills (last time i coded was 6 years ago and mainly c# / object pascal for windows)
c) problems with tau / it's documentation
Maybe someone can help with a few detailed questions.
First question is regarding the online samples. I've found the following code in one sample for wearables (calendar app) but I don't know what this is and if I should be using stuff like this. It doesn't look like standard javascript to me but I can't find any API/library included either:
Code:
/**
* App module.
* @requires {@link Calendar/views/initPage}
* @namespace Calendar/app
* @memberof Calendar
*/
define({
name: 'app',
requires: [
'views/initPage'
],
def: function appInit() {
'use strict';
/**
* Initializes the app.
* @memberof Calendar/app
*/
function init() {
console.log('app::init');
}
return {
init: init
};
}
});
Second question is regarding jquery. Which version should I use and how am I supposed to include this? I'm using the 2.4 SDK download but programming a wearable web app with 2.3.1. I tried inlcuding jquery by downloading the latest version 2.1.4 (uncompressed) and putting it in my lib file folder, then including it in the html header. I have the feeling though that this is causing some issues. E.G. some notations don't work:
Code:
$( "#divname" ).innerHTML = "newtext";
doesnt work. No error just no result.
Third question is regarding tau. I tried to create a popup and register a callback for the popupafterclose-event like this but it doesn't work (event is not fired)
HTML:
<!--Popup HTML code-->
<div id="popup" data-role="popup">
<p>This is a completely basic popup, no options set.</p>
</div>
<script>
// Use popup events
var popup = document.getElementById("popup");
popup.addEventListener("popupafteropen", function()
{
// Implement code for popupafteropen event
});
</script>
taken form HERE
What am I doing wrong here? Is this the correct API im looking here or maybe does it collide with the jquery library?
For any tips I would be very thankfull.
Greetings
Björn
Wow thanks finally some one. I wold love to root my device ..
If theres a way.
If anyone was wondering about this issue, I kind of got this solved.
I just started an new project copied over all code and removed my jquqery imports and the code that gave me errors before just works fine. TAU in generell seems to be quite buggy and is easily be destroyed by an "unlucky" combination of UI changes (opening a popup or another window).
Even a week later I still don't know what the code in the calendar sample is from and tau seems not to be the most stable library out there. If anyone else has trouble starting developing for this I'm happy to share more experiences.
Greetings from germany

Reading a URL

I am trying to make a self steering gear for a boat. The actuator side that moves the tiller uses an ESP8266 and rather than add a compass there along with push buttons and LCD I thought I would try to use an Android phone and send the data to the ESP over wifi.
My starting point is compass_dev from github. This gives me a variable called "azimuth" that is taken directly from the phone/tablet. I do not at this stage need to be concerned with any of the inner working about how azimuth is arrived at and can, for now, just take it as a correct value that I have to work on.
All good so far and working well. The ESP has a PID controller to know how to move the rudder and it accepts from a web page on the ESP, a number that is the angle between a locked heading and the bearing the boat is going on so any number between 180 and -180.
This number is transferred from the main compass application through a singleton into my http handling bit (dohttp). In dohttp I am connecting to my ESP with this:
protected Long doInBackground(URL... urls) {
try {
components = SingletonSession.Instance().getBearing();
URL url = new URL("http://192.168.0.57/msg?msg="+components);
// Log.e("bears", "H11 " + components);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setUseCaches(false);
connection.setDoOutput(true);
connection.setRequestMethod("PUT");
connection.setChunkedStreamingMode(0);
OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());
out.flush();
out.close();
connection.disconnect();
}
You can see that the URL is:
http://192.168.0.57/msg?msg="+components
components is normally just the error angle (azimuth - bearing)
If I enter, for example "12" then once this URL is accepted by the ESP the URL will change to:
http://192.168.0.57/msg?msg=12&EX=Execute
So you can see that if the ESP has received correctly I can parse the URL looking for:
12&EX=Execute
If I do not get this then the ESP has missed the value.
The problem I have is that I cannot work out how to read the URL. I do realise that I can add the values to the actual page and parse the data out with a read but it seems a long winded way when just reading the URL would give me what I need if reading the URL is possible.
I am a complete beginner and this is the first java programming I have ever attempted, first use of Android Studio and have really struggled to get this far so please make the answers as simple as possible.Any input is greatly appreciated.
Please excuse me if this is not in the right place, I seem not to have permission to put it where I think it should go and this is the closest I could find that was even slightly relevant.

Categories

Resources