Detect complete plugin installation

82 views
Skip to first unread message

j.somers

unread,
Sep 24, 2009, 4:36:37 AM9/24/09
to KML Developer Support - Google Earth Plug-in
When the GE plugin is not installed you are asked to install it. I
would like to be able to detect when the plugin completed the
installation to force a browser reload. Right now my users still need
to do that manually.

It seems I cannot rely on the google.earth.isInstalled() function
because that only works when the plugin is also loaded. At least, as
far as I can tell, it doesn't return TRUE when the installation
finished.

Since I want to use the plugin inside a desktop application I have can
also monitor the file system. I tried checking whether the
geplugin.exe exists in the corresponding folder but that file is
already written somewhere at the beginning of the installation so it's
not a reliable solution.

Any pointers are greatly appreciated.

- Jensen

fraser (Earth API Guru)

unread,
Sep 24, 2009, 12:24:43 PM9/24/09
to KML Developer Support - Google Earth Plug-in
Hi,

If you are working from a desktop application then then there are
numerous ways...

For example on Windows you could use WMI to enumerate all installed
software...
Or look in to the contents of "SOFTWARE\Microsoft\Windows
\CurrentVersion\Uninstall"

Really I would suggest you google for....

"Check application installed <your languge>"

where <your language> is C++, Delphi, c#, etc...

F.

j.somers

unread,
Sep 25, 2009, 4:48:23 AM9/25/09
to KML Developer Support - Google Earth Plug-in
Hi,
The WMI solution is way to slow for me. I need to poll constantly with
an interval of 5 seconds. It takes about 3 minutes before the WMI
query finishes. Fortunately the registry is a far cleaner and faster
solution.

Below is the C# code which made it possible.

protected bool IsPluginInstalled()
{
bool installed = false;

const string SUB_KEY = @"SOFTWARE\Microsoft\Windows\CurrentVersion
\Uninstall";
using (RegistryKey rootKey = Registry.LocalMachine.OpenSubKey
(SUB_KEY))
{
if (rootKey != null)
{
foreach (string key in rootKey.GetSubKeyNames())
{
try
{
using (RegistryKey productKey = rootKey.OpenSubKey
(key))
{
if (productKey != null)
{
string productName = Convert.ToString
(productKey.GetValue("DisplayName"));
if (productName.Equals("google earth plug-
in", StringComparison.InvariantCultureIgnoreCase))
{
installed = true;
break;
}
}
}
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
}
}

return installed;
}

Roman N

unread,
Oct 2, 2009, 2:25:31 PM10/2/09
to KML Developer Support - Google Earth Plug-in
Hi,

For NPAPI-supporting browsers (everything but IE), you can use:

var pollFn = function() {
navigator.plugins.refresh(false);
if (google.earth.isInstalled()) {
alert('Yay, installed!');
} else {
window.setTimeout(pollFn, 2000);
}
};

pollFn();

It might work in IE, but I haven't tried.

Thanks,
Roman
Reply all
Reply to author
Forward
0 new messages