Actionscript 3 Gelocation HTC one - actionscript-3

I have taken the basic code to check if geolocation is supported on my HTC one. The code works in the emulator in flash, but doesn't when I test on the phone itself. I'm hoping that the phone actually has geolocation so im just wondering if anyone has used a HTC in flash and if it has geolocation built in. I have tried looking online if it has and im not really getting an answer.
I know this is not a code question but I hope someone can help.
Here is the code I am using :)
if (Geolocation.isSupported)
{
var my_geo:Geolocation = new Geolocation();
my_geo.addEventListener(GeolocationEvent.UPDATE, onGeoUpdate);
var my_txt:TextField = new TextField();
my_txt.wordWrap=true;
my_txt.x = 100;
my_txt.y = 100;
addChild(my_txt);
}
function onGeoUpdate(e:GeolocationEvent):void
{
my_txt.text = "My Latitude is "+e.latitude+" and my Longitude is "+e.longitude;
}

Related

Text To Speech universal app doesn't work

This code doesn't work in windows universal app 10
var mediaPronunciation = new MediaElement();
using (var speech = new SpeechSynthesizer())
{
speech.Voice = SpeechSynthesizer.AllVoices
.First(i => i.Gender == VoiceGender.Male);
var voiceStream = await speech.SynthesizeTextToStreamAsync("fast");
mediaPronunciation.SetSource(voiceStream, voiceStream.ContentType);
mediaPronunciation.Play();
}
I've got this error
{"The specified module could not be found. (Exception from HRESULT: 0x8007007E)":null}
I find this topic and he has same problem
How do you make Speech to Text work in Windows (Phone) 8.1 Universal App
please help how can I fix this problem?
thanks
var speech= new SpeechSynthesizer();
speech.Voice = SpeechSynthesizer.AllVoices
.First(i => i.Gender == VoiceGender.Male);
SpeechSynthesisStream sss =await speech.SynthesizeTextToStreamAsync("fast");
mediaPronunciation.SetSource(sss, sss.ContentType);
mediaPronunciation.Play();
Try this...
Finally I fix this,
every one have to download this file for player :
Download and install media pack for N SKU of Windows 10 introduced
, Now you can enjoy use Text To Speech
thanks a lot Mr. Fred -> My question in MSDN

Application working on emulator but crashed on phone WP8

At start I'm sorry for my English is poor. And this is the only place where i solved the problem.
I have a problem with my application. I write and test it on emulator in VisualStudnio 2012 and It work fine. But when I add aplication in WindowsPhone store and I get to phone. It crashed. I think that problem is in geolocator or something with GPS, because when i use function where my it don't use gps it work. Everywhere where i use geolocator_geopositionchanged it break down and app is terminate. in one of application page i use map control but i gave token and application id but only in class where i use map.
private void maping_Loaded(object sender, RoutedEventArgs e)
{
Microsoft.Phone.Maps.MapsSettings.ApplicationContext.ApplicationId = "id";
Microsoft.Phone.Maps.MapsSettings.ApplicationContext.AuthenticationToken = "token";
}
Do you have any sugestion or advices?
if you want watching app there is a link
http://www.windowsphone.com/pl-PL/store/app/opencaching/06bce1e1-16ef-4ebf-ac53-23b4c725f78b
I have geolocator in a few class it's one of them
Geolocator code
if (!tracking)
{
gps = new Geolocator();
gps.DesiredAccuracy = PositionAccuracy.High;
gps.ReportInterval = 100;
gps.PositionChanged += geolocator_PositionChanged;
}
else
{
gps.PositionChanged -= geolocator_PositionChanged;
gps = null;
}
tracking = !tracking;
Geoposition changed code
void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
double distance = 0;
distance = point.GetDistanceTo(new GeoCoordinate(args.Position.Coordinate.Latitude, args.Position.Coordinate.Longitude));
string asa = Convert.ToInt64(distance).ToString();
if (asa != null)
{
Dispatcher.BeginInvoke(() =>
{
TBodleglosc.Text = asa +"m";
navi.Rotation = 180 + Kierunek(point.Latitude, point.Longitude, args.Position.Coordinate.Latitude, args.Position.Coordinate.Longitude);
});
}
}
Debug on your device. If that cannot repro, setup a Beta Test app and use that to distribute the app back to yourself for debugging. Sometimes signing breaks things.
I debug at lumia 920 and I have a problem with convert.toDouble
because there are was , i have . and vice versa
I think that it's connected with phone language
because in english emulator and Ertay Shashko phone who debug it yesterday it's working fine.
At now application work at phone but doesn't at emulator.
but if i change settings on location and language apps work but I can't debug because visual studio have error
It's weird .....

Flickr API image unavailable windows phone

I'm trying to use flicke's api to import images into a Windows Phone app and display them on the phones panoramic dispaly.
I'm new to flickr's API and am stuck ATM.
I've tried the following call:
// original string flickString = "https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=cc9babb2754c1d29837bea480c97013e&text=game+of+thrones&format=json&nojsoncallback=1&api_sig=bb86a60e9e42f31950bf53d25fc45f08";
string flickString = "https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=cc9babb2754c1d29837bea480c97013e&text=game+of+thrones&extras=url_sq%2C+url_t%2C+url_s%2C+url_q%2C+url_m%2C+url_n%2C+url_z%2C+url_c%2C+url_l%2C+url_o+&format=json&nojsoncallback=1&api_sig=9e74e094d8c6a7496fc66e070f5c0898";
var baseUrl = string.Format(flickString, flickrAPIKey);
string flickrResult = await client.GetStringAsync(baseUrl);
FlickrData flickrApiData = JsonConvert.DeserializeObject<FlickrData>(flickrResult);
if(flickrApiData.stat == "ok")
{
foreach (Photo data in flickrApiData.photos.photo)
{
// To retrieve one photo
// http://farm{farmid}.staticflickr.com/{server-id}/{id}_{secret}{size}.jpeg
//string photoUrl = "http://farm{0}.staticflickr.com/{1}/{2}_{3}_o.jpeg";
//string photoUrl = "http://farm{0}.staticflickr.com/{1}/{2}_{3}_b.jpeg";
//string photoUrl = "http://farm{0}.staticflickr.com/{1}/{2}_{3}_n.jpg";
string photoUrl = "http://farm{0}.staticflickr.com/{1}/{2}_{3}"
string baseFlickrUrl = string.Format(photoUrl,
data.farm,
data.server,
data.id,
data.secret);
flickr1Image.Source = new BitmapImage(new Uri(baseFlickrUrl));
break;
}
}
}
When I deploy and run the app I get an image saying that this image is unavailiablemessage every time? I've tried changing the search terms etc and still get the sme message. Which is making me wondor if I've missed something setting up my account with flickr earlier that I'm not aware of? It's very frustrating - help please.
Thanks to card_master for his help so far
I'm also integrating with Flickr. I'm creating a web site that uses their api.
I'm using FlickrNet. This is an open source .net library that you can use to call the Flickr Services. This is a C# library.
The benefit of using it on a mobile application you can take advantage of the caching. It allows you to store images in the phones storage. This won't work on a web application though.

As3 - LocalConnection between SWF and AIR desktop app

I need to send a text from an embedded SWF (Web browser) to an AIR based desktop app.
I did everything like explained in the documentation but I can't establish a connection.
Does anybody see what I did wrong or can point me to a working example?
From the SWF:
function startConnection(e:Event=null):void
{
var localConnection:LocalConnection
localConnection = new LocalConnection();
localConnection.client = this;
localConnection.allowDomain("app#com.example.desktop");
var textToSend = "Hello world! Source: http://www.foobar.com";
localConnection.send("app#com.example.desktop:connectionName", "methodName",textToSend);
}
From the AIR desktop app:
function onBrowserInvoke (event:BrowserInvokeEvent):void{
var localConnection:LocalConnection
localConnection = new LocalConnection();
localConnection.client = this
localConnection.allowDomain("example.com");
localConnection.connect("connectionName");
}
Thank you.
Uli
The working code is:
AIR:
var localConnection:LocalConnection = new LocalConnection();
localConnection.send("_myConnection", "methodName", "Hello world! Source: http://www.foobar.com");
SWF:
var localConnection:LocalConnection = new LocalConnection();
localConnection.allowDomain("app#airtest"); //or use "*" wildcard to allow any domains and AIR applications
localConnection.client = this;
localConnection.connect("_myConne‌​ction");
Where airtest is the app id for AIR application. Use the _ symbol before local connection name for supporting unpredictable domain names (it'll work in debug mode and via http).

How to have physical location using google map api

I am relatively new to web development. I am trying to extract a physical location from the longitude and latitude using google map (i think google.map would be right for this). I have already written this code in JADE which gives me lat and long. How can i use this value to see the exact physical location. Thanks !
if (navigator.geolocation) {
console.log('Geolocation is supported!');
var startPos;
navigator.geolocation.getCurrentPosition(function(position) {
startPos = position;
jQuery("#location_latitude").append(startPos.coords.latitude);
jQuery("#location_longitude").append(startPos.coords.longitude);
console.log(startPos.coords.latitude);
console.log(startPos.coords.longitude);
});
}
A am sure you will find solution looking in the source:
http://html5demos.com/geo
You have to create the map and then locate a marker on it.