Dynamic data in Google Earth mobile - google-api

Is there any way to build a mobile Google Earth-based application that can show dynamic (periodically changing) data?
Here is what I have found
There is no GE plugin for mobile (iOS, Andriod) so the Javascript API is out
There is no supported native API
The NetworkLink RefreshInterval KML does not work on mobile versions (I can't get any part of the NetworkLink KML element to work)

NetworkLinkControl Updates DO work with the Google Earth Application for mobile devices.
Load a KML from the internet - inside this KML, have a NetworkLink such as:
<NetworkLink>
<name>Update</name>
<Link>
<href>URL of Updating KML</href>
<refreshMode>onInterval</refreshMode>
<refreshInterval>20</refreshInterval>
</Link>
</NetworkLink>
So, every 20 seconds GE tries to load the 'URL of Updating KML'
Create the 'Updating KML' - which will have <Update> commands such as:
<NetworkLinkControl>
<Update>
<targetHref>URL of initial KML (one to make changes to)</targetHref>
<Change>
<Placemark targetId="placemarkID">
<visibility>0</visibility>
</Placemark>
</Change>
</Update>
</NetworkLinkControl>
That example would look for a Placemark with the id of 'placemarkID' and change its visibility to 0 (invisible)
My example is using the Change feature of updating, there are also Create and Delete
Here is a Google Example of using Updates

Related

How to use Google Picker with Google Drive using flutter

I can't find any resource to embed google Picker in a flutter to upload a doc to Google drive. Can any provide me with an example of how to integrate Google Picker to Flutter?
Same issue here, you can use file_picker:
final result = await FilePicker.platform.pickFiles();
It will navigate user to an UI for selecting files including other app's files, i.e. google drive.
BTW, you should request permissions before picking the file:
final googleSignIn = GoogleSignIn(scopes: []);
await googleSignIn.signIn()
// request when you need it!
await googleSignIn.requestScopes([SheetsApi.spreadsheetsScope])
Found similar question here: File Picker for Google Drive Rest API for Android

How to read and set cookies from Browser/WebView in NativeScript?

I'm building an app which mainly displays public data from a website. A few items require authentication to read. I don't want to recreate the entire website in the app so I'd like to have the user log in via a web view or browser popup and grab the cookie containing the token from this session. I would then use it to authenticate my in-app rest calls in order to fetch the data. This should work on iOS and Android but I couldn't come up with a functioning solution yet. How would one read and write cookies from the phone browser / webview? I'm using the latest Angular (9) and NativeScript.
For android
The webview UI
<WebView height="1200px" src="https://www.nativescript.org"
(loadFinished)="onLoadFinished($event)"></WebView>
The typescript code
import * as application from 'application';
declare const android;
....
....
....
onLoadFinished(args: LoadEventData) {
android.webkit.CookieManager.getInstance().getCookie(<cookie name>)
android.webkit.CookieManager.getInstance().setCookie(<cookie name>, <cookie value>)
}
For IOS seems it is little bit complicated
Refer StackOverflow set cookie in IOS nativescript

IE8 issues with Yammer embed and API

Facing multiple issues with IE 8 (detailed version 8.0.7601.17514). Please note everything works fine in other browsers.
Yammer embed my feed control is not working. Sometimes it shows result and sometimes not.
REST API call not working and giving error as below. However I used new js sdk and new yam.platform.request.
Error is : yam.request is null or not an object. source : platform_js_sdk.js
Thanks in advance for your help!
I found out that the div that you embed yammer feed has to be above the yammer request script
eg.
<div id="embedded-feed" style="height:400px;width:500px;"></div>
<script>
yam.connect.embedFeed(
{ container: '#embedded-feed',
network: 'fourleaf.com' // network permalink (see below)
});
</script>
Otherwise, IE will not be able to find the div to show the feed (but chrome works fine..)

firefox component doesn't seem to be loading

https://github.com/terrafrost/firefox-x-forwarded-for-spoofer
That's an addon I'm trying to revive that's not working in the latest version of Firefox and I'm trying to find out why.
Near as I can tell the component isn't working and I've no idea as to why.
I've tried making the chrome.manifest file read as follows:
content x-forwarded-for chrome/content/
overlay chrome://browser/content/browser.xul chrome://x-forwarded-for/content/overlay.xul
locale x-forwarded-for en-US chrome/locale/en-US/
component ec8030f7-c20a-464f-9b0e-13a3a9e97384 components/x-forwarded-for.js
contract #x-forwarded-for#frostjedi.com/x-forwarded-for.js;1 ec8030f7-c20a-464f-9b0e-13a3a9e97384
I've also tried #frostjedi.com/x-forwarded-for;1 (which is what x-forwarded-for.js has as the contract id but that didn't help) to no avail.
Any ideas?
The ID you list in chrome.manifest should be the component ID, not the extension ID. Also, the contract ID seems to be incorrect, probably a copy&paste mistake. The correct lines would be:
component {f3bbf109-6d66-46ca-960e-4b78014023b3} components/x-forwarded-for.js
contract #frostjedi.com/x-forwarded-for;1 {f3bbf109-6d66-46ca-960e-4b78014023b3}
The component itself needs to be modified as well - to be compatible with Firefox 4 and above it should expose an NSGetFactory function instead of NSGetModule. It is highly recommendable to use XPCOMUtils.jsm module for that, it will do most of the work for you. You can throw out the entire module definition and replace it by the following lines:
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
var NSGetFactory = XPCOMUtils.generateNSGetFactory([XForwardedForProxy]);
Note that you no longer have to declare component ID and contract ID in the component itself, the entries in chrome.manifest are sufficient for Firefox 4 and above.
For reference: XPCOM changes in Gecko 2.0

About Geolocation in HTML 5

Google Maps can now pinpoint my location with street precision with the help of Firefox.
I understand this is a new feature of HTML 5 compatible browsers and that the location is fetched by using some sort of feature of the connected WiFi network (I hope I'm not making any silly assumptions).
What I intend to know is how this whole process exactly works:
Why only in HTML 5?
Why / how does Firefox ask me to share my location with Google Maps?
What is the normal precision one can count on?
How can I implement this feature in my websites?
Thanks in advance!
How does it work?
When you visit a location-aware website in Firefox, the browser will ask you if you want to share your location.
If you consent, Firefox gathers information about nearby wireless access points and your computer’s IP address, and will get an estimate of your location by sending this information to Google Location Services (the default geolocation service in Firefox). That location estimate is then shared with the requesting website. (Source)
How accurate are the locations?
Accuracy varies greatly from location to location. In some places, the geolocation service providers may be able to provide a location to within a few meters. However, in other areas it might be much more than that. All locations are to be considered estimates as there is no guarantee on the accuracy of the locations provided. (Source)
In my case, Firefox reports that I am about 10km away from my real location.
How do I use this feature in my website?
You would do something like this:
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
alert(position.coords.latitude + ", " + position.coords.longitude);
// Use the latitude and location as you wish. You may set a marker
// on Google Maps, for example.
});
}
else {
alert("Geolocation services are not supported by your browser.");
}
You can see an online demo here: Firefox HTML 5 Geolocation Demo (Requires a geolocation-aware browser such as Firefox 3.1b3.)
HTML5 supplies an API which allows the web browser (and then hence the server-side of an web application) to query the location and related information such as speed (if relevant), in a standard, uniform, fashion.
The host and its web browser supply the "devices" which compute/estimate the geolocation per-se
For this API to be useful, requires that the underlying host and web browser
a) allow the sharing of such info (note the privacy issue) and
b) be somewhat equipped (either locally or by way of the network they are hooked-up to) to read or estimate the geolocation.
The techniques and devices involved in computing the actual location involves a combination of the following (not all apply of course), and is independent from the HTML 5 standard:
GPS device (lots of phones now have them)
Routing info at the level of the Cell phone network
IP address / ISP routing information
Wifi router info
Fixed data, manually input (for pcs which are at a fixed location)
...
Therefore...
- HTML5 alone cannot figure out geolocation: upgrading to newer web browser, in of itself, won't be sufficient to get geolocation features in your applications etc.
- Geolocation data can be shared outside of the HTML5 API, allowing GPS-ready or GeoLocation-ready phones expose the geolocation data within other APIs.
HTML5 Geolocation API uses certain features, such as Global Positioning System (GPS), Internet Protocol (IP) address of a device, nearest mobile phone towers, and input from a user, in the users’ device to retrieve the users’ location. The users’ location retrieved by using the Geolocation API is almost accurate depending upon the type of source used to retrieve the location.
There is a really good demo of HTML5 Geolocation here (http://html5demos.com/geo). Whenever a website tries to fetch your location by using one of the following mentioned APIs, the browser will ask me your permission before invoking the API to share your location.
The Geolocation API provides the following methods:
getCurrentPosition(successCallback, errorCallback, options)
Used to retrieve the current geographical location of a user.
watchPosition(successCallback, errorCallback, options)
The function returns a watchId and calls successCallback with the updated coordinates. It continues to return updated position as the user moves (like the GPS in a car).
clearWatch(watchId)
Stops the watchPosition() method based on the watchId provided.
Sample Code:
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(userPositionSuccess, userPositionError);
} else {
alert("Your browser does not support geolocation.");
}
function userPositionSuccess(position) {
alert("Latitude: " + position.coords.latitude + " Longitude: " + position.coords.longitude);
}
function userPositionError() {
alert("There was an error retrieving your location!");
}

Resources