android url scheme or javascript interface? - javascript

I have a html 5 single url based app (written using slingshot), which has features of sending email to a specific date and time based on user requirements. I used android webview to access the app. The email functionality explained above need to be transferred to android local notification. Setting up notification is not the issue, the issue is how to get the web layer json data in my android native layer to set the local notification.
Not sure if I can use javascript interface as i am not going to call any method from my web app. The save button i have in my web app will trigger the json dada which i want to capture in android layer. I was thinking to user intent filter to capture the url scheme but didn't really find any good example as most of the example is showing local html file coming from asset directory. But in my case i have a html 5 single url app (written using slingshot) triggering the data when save button is getting click.
didn't really find any good references stuck here , please help.

Related

Xamarin.Forms/Asp.Net Core Custom WebView Integration

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.

How to show an android app which uses webview is up to date

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'

Communicate w/ Javascript running in an iFrame

I'm currently working on an application that uses the Phonegap/Cordova framework to display an online and an offline version of a website. If you're not familiar w/ this framework, it offers a simple way of creating multi-platform applications by displaying local files in a full-screen webview.
When launching the application, the Javascript integrated in the local files of the application detects if Internet access if available, and redirects the user to either another local webpage containing a full-screen iFrame of the live website, or a reduced offline version of the website (contained in the local files of the app) if no Internet connection is detected.
I would like to detect when the user logs in using the various forms on the website (being displayed inside the iFrame), but I have no way of knowing which page the user is on, or interact w/ the website content at all because of the same-origin policy.
Would it be possible though to make the Javascript from the local page (which contains the iFrame) interact w/ the Javascript from the remote page (which is being displayed in the iFrame)? This way, I would be able to obtain the login information, and save it for later use (obviously not w/o using a token system), but also it would help for another planned feature (trigger the guidance system).
Thank you.
Look into HTML5 communication, it's pretty simple and sounds like it fits your needs
http://stevehanov.ca/blog/index.php?id=109
https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage

Exporting HTML file from Cordova app in a manner that works in both IOS and Android

I have a cordova app which offers a journal function. Users store questions and programmatically generated answers to local storage, which are presented in a rich html page through a Webview.
Some users have asked for the ability to export that file for safekeeping. I want to implement one javascript solution which works in either IOS or Android. So I need a solution that doesn't depend on a local file system (because IOS won't allow that).
I thought about creating an email a user can send to themselves. I could generate a pdf with one of the pdf libraries, but RFC 2368 says I can't attach that as attachments are not allowed in the mailto URL scheme. I can't put html in the body of a mailto email either, RFC 2368 again.
The local storage data is butt-ugly: I don't want to send raw data or JSON strings to an end user, and while I could render a plain-text mailto body, I'd have to lose images and just lay out some very long URLs in plain text and cross fingers that the client will render them as links.
A webview browser page can't be saved.
So what am I missing? What's the single genius solution for taking a web page that exists in local storage and providing the user a way to store it locally on a computer or snag it from a server, regardless of the device or operating system of their phone or tablet?

Deciding an architecture for a titanium mobile application

I am fairly new to the development world. I need to built an app writing javascript on Titanium that should run on iOS as well as Android using a single codebase. I am currently targeting iPhones at the moment. The app is about a shop that is into selling traditional clothes and letting interested people know about the collection that they have. Any idea about the architecture that i should decide. Since it is quite logical that the user will update his collection of clothing frequently how should i go about it? Should i give him the client application that will run on his pc that he will make use of to update his changes? Will Appstore accept such apps? Any other points i need to know as i need to start the development asap.
I think the best solution will be an App with Web as backend. Means you can put the data in Web, and your app used particular URL's for fetching the required data in the form of XML and JSON.
Your app will parse the data and display it on the view.
If there is new images in the server, your app will download it to the iOS device.
Another option is an app which deals with HTML pages. Means you need to display the page on a web view. If you need to update the data, you can update it on the server. Also it can be of two type
Your app will load the page from remote server, using the url
Your app will download the page to iOS device and display it from there, until a new change occurs.
If you are interested in HTML and CSS, PhoneGap is another cross platform, that can also help you.
for rapid devlopment you can use python django... in your case you can use Django-tastypie for backend will be good choice.since using django you can develop it in quick time and the tastypie has api services which can used easily for retrieval and sending data
you can go through this
http://django-tastypie.readthedocs.org/en/latest/

Categories