google maps for iphone with PhoneGap - javascript

I have an app built in HTML5 + PhoneGap,
in the application has a map of the Google-maps,
on an Android The application works fine,
I moved it to the iphone it also runs but it hangs when it should deal with google maps.
My link to the google map looks like this:
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
Do I need another link?

Add maps.googleapis.com to ExternalHosts in Cordova.plist. This is a whitelist of servers that the app is allowed to access.
Check the debugging log for whitelist violation errors if the problem persists, and add any other servers as necessary.

Related

google maps iframe on cordova, tablet and ios problems

I am using a cordova application, for the maps i let the clients download the "iframe"snippet from the backend of a website using ajax calls. I have to do this because the owner has to upload the code for the different maps. So the problem is this works like a charm on mobiles, but in samsung galaxy tab 3 and on iphone the maps are not showing. The iframe is charging but is empty. (i think the map is not rendering)
Check your error console, if it appears something like that:
ERROR Internal navigation rejected - <allow-navigation> not set for url='http://maps.google.com
Just put that on the config.xml
<allow-navigation href="*"/>
That worked for me

Possible to use Google Play Game Services from origin file:///android_asset

Crosswalk is an excellent wrapper to allow HTML5 games to be packaged as native Android apps. You upload your HTML, JS and CSS files and it wraps it with Chromium for Android and builds an APK. It has full GPU support including WebGL, making it far better than PhoneGap.
I want to use the Google Play Game Services web API in a Crosswalk app, but it appears Crosswalk runs from the origin file:///android_asset. E.g. the main page will run from file:///android_asset/www/index.html.
It does not appear possible to allow Crosswalk apps to use the web API. The API console rejects file:///android_asset as an "invalid URI". Is there any workaround to this? Crosswalk is the only sensible way to publish HTML5 games as native apps on Android, and it's a shame if we can't use Google Play services!
The JavaScript code is limited by the same-origin policy, so you cannot access the Google play services(https://www.googleapis.com/*) from the origin file:///android_asset.
But Crosswalk has provided the solution for the cross-origin xhr, you can easily achieve that via adding the following configure to the manifest of your app.
{
...
"xwalk_hosts": [
"http://www.host-you-want-to-go.com/*"
],
...
}
More details in wiki.
You must try it in the latest beta version of Crosswalk, 6.35.131.5.
You can also ask the help about Crosswalk on the crosswalk-help#lists.crosswalk-project.org, in which you could get more faster response.
I wrote a simple example that accesses google play game services with cordova and crosswalk. See https://github.com/rscohn2/phonegapi
With cordova, you can create a browser window for the login, and give http://localhost as the redirect URI. After a successful login, it redirects to http://localhost,
which is not present. The app detects that the browser window has redirected. It reads the access code, then closes the window before the user can see the error.

Domain problems with my facebook login

I've created a HTML5 game that I run in my browser. I want to add facebook login, and copypasted stuff from the tutorial and replaced with my appId.
When I run it it states:
Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
The problem here is that I dont have a domain to run it under? My game is just running locally in chrome for now, but down the road I want to wrap it for mobile devices (android, ios, wp) using Phonegap or something
Are you running it inside your localhost?
Check this post for more information, it might help you:
Local Facebook App Development using localhost

Facebook App is not working in Chrome but well in Firefox

I have just started making Facebook Apps using heroku. I made a test app. I uploaded a page on heroku which uses HTML5, CSS and Javascript. The app is not showing in Google Chrome https://apps.facebook.com/shrytestapp/ but works well in Mozilla Firefox. Also, the page works well when opened in heroku server http://salty-shelf-6707.herokuapp.com/.
When you access the app within Facebook, HTTPS is used to transfer the data, but Chrome has blocked content delivered over normal HTTP as a result and insists that everything be transfered securely whereas Firefox isn't so fussy.
Here's what the Console is showing in Chrome
[blocked] The page at https://salty-shelf-6707.herokuapp.com/
ran insecure content from http://www.google.com/jsapi.
Uncaught ReferenceError: google is not defined
Google's JS API has been blocked and the JavaScript fails to run.
(You also have some not found errors, but that's unrelated)
The app works fine through the http://salty-shelf-6707.herokuapp.com/ as you mentioned, but not through https://salty-shelf-6707.herokuapp.com/
Try using the following instead to load the API
<script type="text/javascript" src="//www.google.com/jsapi"></script>
the // at the start of the src value will make the url protocol-relative or for the correct technical term, scheme-relative.
Paul Irish, the lead developer of HTML5 Boilerplate, has more information about this in a post on his site.

How can I create a Google Sites script that detects browser type and redirects accoringly?

I want to create a Google Sites script that can detect whether my visitors are using Android or iOS and then redirect them to AppStore or Google Play accordingly.
This will allow me to advertise only one QR code for all devices.
Is there a way to easily set it up and host it on Google Sites?
Well the script needs to inspect the HTTP_USER_AGENT header, and do something like this:
Common link to open iOS, Android and BlackBerry app
Bear in mind that not everyone on an Android-based device has the Google Play store (e.g. Kindle Fire -> Amazon Appstore); unfortunately getting the user to an appropriate app store on Android is tricky because there are many options.

Categories