[Oskari-user] Oskari RPC and Cordova Android app issue
Mäkinen Sami (MML)
sami.makinen at maanmittauslaitos.fi
Fri Apr 12 00:36:10 PDT 2019
Hi,
Apparently WebView sees the iframe as having a file:// protocol. This might be due to the iframe not being loaded yet and happens on browser as well, but JSChannel recovers from this. If the message ever reached the iframe with the file:// protocol you would might see this kind of message https://github.com/oskariorg/oskari-frontend/blob/master/bundles/framework/rpc/instance.js#L88. But if you can use just the iframe you could do the same things by running this kind of JS inside the map page:
Oskari.getSandbox().postRequestByName('MapMoveRequest', [x, y, zoomlevel]);
This would by-pass the postMessage() and call Oskari API directly.
Sami
Lähettäjä: Puikkonen Klaus (Ruoka)
Lähetetty: perjantai 12. huhtikuuta 2019 10.10
Vastaanottaja: Mäkinen Sami (MML) <sami.makinen at maanmittauslaitos.fi>; Oskari-user at lists.osgeo.org
Aihe: VS: Oskari RPC and Cordova Android app issue
Hi,
just WebView for the iframe is ok.
In the browser that works fine. But when I try this in android phone with cordova "Osakari onReady" newer occurs.
try {
channel = OskariRPC.connect(
documentItem,
mapAddr
);
channel.onReady(res => {
this.loggerService.debugBuffer("Oskari onReady: " + res.clientSupported + " " + res.version);
});
We are using https://hkp.maanmittauslaitos.fi maps.
This might be a reason maybe...but what can I do to allow this?:
Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (’https://hkp.maanmittauslaitos.fi') does not match the recipient window’s origin (‘file://’).“,
-klasu
________________________________
Lähettäjä: Mäkinen Sami (MML)
Lähetetty: 12. huhtikuuta 2019 9:58
Vastaanottaja: Puikkonen Klaus (Ruoka); Oskari-user at lists.osgeo.org<mailto:Oskari-user at lists.osgeo.org>
Aihe: VS: Oskari RPC and Cordova Android app issue
Hi,
Do you need the “parent page” or can you just do a WebView for the iframe src/the map? Most of the Google search results related to postMessage in WebView seems to deal with how to communicate between Java and Javascript by sending and receiving messages using the postMessage().
BR,
Sami
Lähettäjä: Oskari-user <oskari-user-bounces at lists.osgeo.org<mailto:oskari-user-bounces at lists.osgeo.org>> Puolesta Puikkonen Klaus (Ruoka)
Lähetetty: torstai 11. huhtikuuta 2019 16.02
Vastaanottaja: Oskari-user at lists.osgeo.org<mailto:Oskari-user at lists.osgeo.org>
Aihe: [Oskari-user] Oskari RPC and Cordova Android app issue
Hi,
does anybody have idea or knowledge how Oskari RPC could work with Cordova and Android Webview. With browser everything works fine but in Webview postmessages does not work for some reason.
For example:
this.channel.postRequest(
'MapMoveRequest', [x, y, zoomlevel]
);
does nothing.
I'm trying to convert www application to simple android app....the applications for herders. They take pictures and locations of dead reindeers... the location are shown in the map which is in iFrame.
br
klasu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/oskari-user/attachments/20190412/6f83dcf2/attachment-0001.html>
More information about the Oskari-user
mailing list