Software Archive
Read-only legacy content
17061 Discussions

Problems with mixed APP

Juan_Eduardo_Brennan
1,113 Views
ENGLISH
 
My problem is that when leave the APP through a form to a PHP that receives data.
Example (APP that requests a password and sends it via a form by post method)
And in this PHP I want to detect the geographic coordinates with google API, not working if I try installing the APP on a mobile phone.
But if I test my PHP in a browser on a computer it works perfectly.
Is there some encapsulation of the APP that is preventing me from my PHP work well?
 
 
SPANISH
 
Mi problema es que cuando salgo de la APP a través de un formulario a un PHP que recibe datos.
Ejemplo (APP que pide una password y la envía a través de un formulario por método post)
Y en este PHP quiero detectar las coordenadas geográficas con la API de google, no funciona si lo pruebo instalando la APP en un móvil.
Pero si pruebo mi PHP en un navegador de un ordenador funciona perfectamente.
Existe algún encapsulado de la APP que me esté impidiendo que mi PHP funcione bien?
 
 
0 Kudos
8 Replies
John_H_Intel2
Employee
1,113 Views

Why are you trying to use php to detect the geolocation? You need to use the geolocation plugin that is available in the XDK, once you get the latlng back, you can send those somewhere of your choosing.

0 Kudos
Juan_Eduardo_Brennan
1,113 Views

Yes, that would be better but development can not be done entirely in XDK given the dynamics cacterísticas it.
Therefore only the main page goes inside the APP and the rest is on a server with PHP.

Hence the question, whether this affects encapsulating the app to external PHP does not have the capacities to 100%

 

Si, eso seria mejor pero el desarrollo no se puede hacer integramente en XDK dadas las cacterísticas dinámicas del mismo.
Por eso solamente la pagina principal va dentro de la APP y el resto está en un servidor con PHP.

De ahi la pregunta formulada, si afecta esto por el encapsulamiento de la app a que los PHP externos no tengan las capacidades al 100%

0 Kudos
Barry_Johnson
New Contributor I
1,113 Views

"Not working" - not working how exactly? From what you have described, you may be asking one of several items. These seem like the most likely cases:

  • Mobile app cannot successfully call server-side code
    • ​...and the server never received a request from the client
    • ...but the server seems to get the request from the client.
  • Mobile app connects to server side code, geolocation code executes but an incorrect location is returned.
  • Mobile app connects to server side code, geolocation code fails on the server side.

Could you let the thread know which of these, or something else, you mean by "not working"?

Thanks!

 

0 Kudos
Juan_Eduardo_Brennan
1,113 Views

The application reduces the flow passing data to a PHP page on the server which verifies the data and calls a page of options, the latter encodes geo location.

INDEX.HTML (app) method send post to http: //xxx/verify.php (server)

verify.php processes the data and load menu.php

In menu.php this code storing geo location coordinates.

If I access by browser menu.php detects and stores the coordinates correctly, but if it is accessed from the menu.php application does not detect the coordinates.

0 Kudos
Juan_Eduardo_Brennan
1,113 Views

I know where is the problema...

In my menu.php have JavaScript.

In this say Windows.location.href = xxxxxxx

In browser work fine, but from App not work (not call href)

This is the problema, why???

0 Kudos
Juan_Eduardo_Brennan
1,113 Views

The code is...

<script src="geo.js" type="text/javascript"></script>
<script>

function detectar(){
if(geo_position_js.init())
{
 geo_position_js.getCurrentPosition(mostra_ubicacion,function(){enableHighAccuracy:true});
} else {
 document.write('Error en la posición');
}

}

function mostra_ubicacion(p){
var coords = ""+p.coords.latitude + "," + p.coords.longitude+"";
location.href = "localizar.php?lat="+p.coords.latitude.toFixed(5)+"&lng="+p.coords.longitude.toFixed(5);
}
</script>

 

Call detectar() function from HTML

<script>

detectar();

</script>

 

0 Kudos
Juan_Eduardo_Brennan
1,113 Views

I think use cookies JavaScript and read with php.

In browser work fine, but from App Intel xdk not work...

Why Windows.location.href or cookies in JavaScript not work in Intel xdk ????

This is the problem for robust Project...

0 Kudos
Juan_Eduardo_Brennan
1,113 Views

Yes, it's correct.

Is my post, same question send to support.

0 Kudos
Reply