I'm trying to build a Gmail Addon using React. The problem is, we have to write Gmail Addons using google Apps Script. The reason I chose React is I already built a plugin for outlook using React. If I can use the same for Gmail then I can port the same plugin with minimal effort.
In short , we can't do that.
Gmail add-on UI is rendered from a google server. The code that we write rests on a server (unless you use clasp for local setup) and runs to render the UI. Also Gmail add-ons do not have access to the DOM.
You can not use react in gmail addon, as gmail addon script runs on google cloud engine and the resulting html that is generated by the cardservice is returned to the client. For everyaction in the add on, it will go to google app script engine and run the script and return the result.
Related
I develop modal window with React.js, that can be distributed for several sites via some kind of web application market.
So I faced the issue, that for any website, that would install this extension (btw it's builded to a simple html page + couple of js files, so app will be hosted directly on website of even customer), Google auth error will throw exception of invalid origin.
So is there any way to find a workaround for my case?
btw now I'm using react-google-login library
Google allows you to set multiple URIs. Just take a look in the settings.
Google oAuth is not supported in android webView. Google recommends to use chrome custom tab for proceeding oAuth. I have also requirements of js call from my web app to native. How to configure to call native methods from web app using chrome custom tab in android similarly like js interface in webView?
Update 1
This mod Chang marked the post as duplicate but the post is different. I don't want to run any JS in my web app from native. I want to invoke method from web app to my native code via JS interface. Is there any way for CCT?
Based on Can I Inject Javascript Code into Chrome Custom Tabs the answer appears to be no.
Chrome Custom Tab is based on Chrome itself and has the same security model. The web content is only allowed access to the Web APIs (camera, device orientation, etc.) and has no access to the native app. At best the native app can capture a URI.
Even the Chrome Custom Tab documentation state that the way for a native app to handle content:
Some URLs can be handled by native applications. If the user has the Twitter app installed and clicks on a link to a tweet. She expects that the Twitter application will handle it.
Before opening an url from your application, check if a native alternative is available and use it.
Implies that either a native app handles a URL or not. My interpretation of Chrome Custom Tab is a skinnable Chrome component adjacent to the native app rather than internal to a native app like a WebView where a Javascript bridge exists.
Your desire for a Javascript bridge from a web app would mean that there would be a arbitrary way for any website code to interact outside of the web container. The rational as to why that is not allowed is given as the responses in the first link.
I'm making a Native Messaging extension in firefox, I have some question:
Background-script (addded by background key) and content-script (added by content-script key). What's different between them and can I use both of them with 1 JS file? If not, I have to send page-script->content-script->background-script->native-app?
Which's the best function I need to use to send message from page-script to native app? I followed this example or tried with this function but it doesn't work.
Background-script can be considered as long term running, since Firefox started, to Firefox process quit. While content scripts runs in web page context, ends when web page closed. Content scripts can be used to access/modify web page, while background script can't. For detail, see documentation of background scripts, content scripts.
You need Native Messaging to send message from extension to native app. In extension, use chrome.runtime.connectNative to connect to native app. It will return a chrome.runtime.Port object. Then use Port.postMessage to communicate with native app.
Reference: Full Documentation of Firefox WebExtensions
I'm trying to develop a Chrome App that will work together with a Chrome Extension that I already created, wherein the Chrome Extension will send information to the Chrome App.
For this communication I thought use the WebSocket locally, in Chrome Extension I managed to make the Client, but now I'm having difficulty in creating the Server in the Chrome App, because I wanted to make as simple as possible without having to install something beyond of the Chrome App.
Among the first Google results there is a sample app from Chrome team: Http WebSocket Server.
You've got to understand that making a server in Chrome Apps is difficult; you are given access to a raw socket, and you need to fully implement the protocol that a particular server must use. Even a HTTP server is non-trivial, WebSockets is even less so.
So: it's possible, but it's not simple unless you're using an existing library.
Just to add to the accepted answer:
There is a Chrome Extension already in the Chrome Web Store: Web Server for Chrome.
And it is opensource: GitHub Link. You can use it as a library to your Chrome App.
Cheers!
Tracking events and setting up Analytics for Websites seems easy. You create an account with one of the Analytics service providers like Google. They give you javascript code that you embed in your pages (whichever event you wish to track) and voila..you're done.
I have written a native application for Android phones, which is actually an adaptation of the actual web site. Now, I am required to setup Analytics and tracking for this native application.
Question:
How to do setup a native application for Analytics?
We have Java Script code(not Google Analytics but for some other engine) that works for the original web site. Is there a way to incorporate that in the native application?
I know Android supports Java Script via WebViews(Webkit);my application does not have webviews, it is native!
I have not worked on JavaScript since school so excuse me if I sound naive.
Thanks.
Google Analytics provide a guide for implementation on a mobile device.
Refer to http://code.google.com/apis/analytics/docs/tracking/mobileAppsTracking.html
To get started have a look at this guide from google.