I'm currently using wikitude sdk 4.0 for android and trying out the the sample of Multiple POIs in my app.
https://github.com/Wikitude/wikitude-sdk-samples/tree/master/3_PointOfInterest_3_MultiplePois
I got it instantiated but stuck with user location.
I don't understand how the user's location is pulled by this Javascript
https://github.com/Wikitude/wikitude-sdk-samples/blob/master/3_PointOfInterest_3_MultiplePois/js/multiplepois.js
The "AR.context.onLocationChanged = World.locationChanged;" in JS does the magic.
After this line is executed the 'World.locationChanged' (or any other given) function is fired on every Android/iOS native call of the architectView's setLocation is executed.
Check out the LocationProvider-implementation in the Sample Application for a very basic approach.
For state-of-the-art location fetching I recommend you to have a look at Google's Location Strategies.
Kind regards.
Related
I am currently building a pizza ordering app using Xamarin.forms intended for both iOS and Android, and whilst trying to integrate with the payment provider I have encountered a very sticky situation.
Essentially the payment provider (Elavon) provides me a Hosted Payments Page(HPP) where I can send the user to complete their transaction, great. The issue is that when the user cancels a transaction or successfully completes the page will redirect to a page of my choosing, but I have no way of knowing (from Xamarin) when the transaction is complete/cancelled.
So in order to jump out of the WebView I need to call a JavaScript function from the redirected page, that will in turn invoke some C# in Xamarin to exit webview and navigate to an appropriate page.
I have successfully implemented the HybridWebView from Microsoft docs in the past, here:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/hybridwebview
Ideally I could navigate to a local html page in each of the platform projects as in this example, but I do not think this is possible with just a Url, which is all the HPP accepts (Additionally file locations are different on Android/iOS).
I intended to simply navigate to a webpage that I host in Asp Net core where I can call the invokeCSharpAction method, pass string data back to xamarin, and depending on string value navigate accordingly in Xamarin.
The problem with this approach is that on the web page I get an "Uncaught Reference Error" on the "invokeCSharpAction" and the function in Xamarin is NOT getting called.
Does anyone know if it is possible to invoke a C# action in Xamarin from a web page that is NOT local to the device?
Thanks in advance to anyone who has any ideas, I'm fresh out.
I'm trying to develop an offline android app using simple html, css and javascript. I use website2apk software to convert the local html files to a standalone apk file.
My app contains a tariff of some random products. What i need is to notify (in-app notification) my app user if there is any update to the app.
For example, when user get connected to internet the app should automatically check for updates and if there is any update available, a warning should appear on top of the home page which says "New Update Available" which will be linked to mysite.com/newversion.apk .
Can someone suggest me what to do for this?. I can only depend Webview and pure javascript, which means no jquery.
I'm sorry for my bad English. Thanks in advance.
The site which hosts your apk should have an api so you can check from your app if there is any newer version available.
A possible solution would be to add a file (for example a json file) which contains the actual version of your app. Then you can make a web request in your app to get the file data.
Example:
get 'http://www.yourwebsite.com/appversion.json'
I work for a startup and recently we wanted to give the newest Web version of the Facebook Analytics for apps a try but have come up with a problem:
First of all, the web app is built with React so I put the Facebook's JavaScript SDK in a base.html, test that it worked on every page with the logPageView that comes by default in the docs. Until that point, everything seems to be working fine.
But when I tried to use my own custom event for example:
function logPostCreatedEvent() {
FB.AppEvents.logEvent('postCreated');
}
And check the analytics to see the event had been registered it took too long to update the data or it wouldn't load at all. So my question is: Is there a way during development to make the events show up right away?
I check everything the official Facebook docs has and also check an introduction video on web tracking
Also, I couldn't fin any info about how to handle the analytics in a React App or for a SPA app so if you know any good tutorial or info source it will be very much appreciated.
I have a html page that shows the directions from the current location to a certain address.
I would like to do the same but use the map app instead of showing it in a browser.
When I use :
<script>
document.location = "geo:0,0?q=myaddress";
</script>
That works fine but does not show me the route.
What I read from this : Android Google Directions Service usable natively? with wrapper framework? Public transit/biking directions available?
It should be possible using this code :
String url = "http://maps.google.com/maps?saddr=some+address&daddr=another+Address"
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(url));
Can I do the same just using javascript ?
Android is capable of detecting links to Google Maps in the browser and redirect the Intent to the native Google Maps app, if it is set as the default app. There is, however, no way to force the user to use the Google Maps app. Clicking the link can also show him the activity chooser or open Google Maps in the browser. It might also open a third-party app that is registered to handle the same Intent. The code snippet you posted will behave exactly like that, too.
This not only works from the browser, but with all links in the system. For example, I sent the link you posted via e-mail to myself and clicked it on my phone. I could open it with my Goolge Maps app. So there is really no need for JavaScript, you can just use a simple HTML link to send the Intent.
Just simply call the function from JavaScript to Android , and inside the function you can call the android intent.
you can find out the tutorial how to call android function from JavaScript:
http://android-er.blogspot.in/2011/10/call-javascript-inside-webview-from.html
and call the map using Google V3 library .
https://developers.google.com/maps/articles/android_v3
I would like to create a Web App for device. For that I would have some script being stored on device, instead of downloading them all time when I start application. As far as I saw including a GoogleMaps API makes some additional request for javascript files. Is there any way of having all of them taken directly from local store? Or is this always have to refeer to google web address? Thanks for any answers here!
No, you always must load them from the Google site. They offer no way to run Google Maps locally. The GMaps scripts are generated on the fly, based upon (among others, I'm sure) the HTTP_REFERER header of the request. That's how they can bind an API key to a specific website.