I have a Google App Script web application through which users can accomplish the following tasks
Read/Write Spreadsheets in my G-Suite Drive
Read/Write CSV files in my G-Suite Drive
Read/Write Script, User and Document properties of the Project
The web app permission is set to execute as Me.
I intend to create an Android Application to achieve all the above tasks. Is it possible to build one? If yes please provide some pointers, sample codes or any tutorial to start with.
Here are some excellent resources:
"Please provide some pointers"
I would recommend using this as a basis for all projects to be deployed as web apps, although this might be better suited to be a add on, I'm just going to go with it
make three more files (you start with one, code.gs, when you start) all html
a) html, Index.html This is your main html code
b) html, CSS.html This is your CSS (cascading style sheet) file
c) html, javascript.html This is going to help you string them together
copy and past the following removing what is there when you created the file
code.gs
function doGet() {
return HtmlService.createTemplateFromFile('index')
.evaluate();
}
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename)
.getContent();
}
index.html
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<?!= include('css'); ?>
</head>
<body>
<?!= include('javascript'); ?>
</body>
</html>
css.html
<style>
/* CSS reset */
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td {
margin:0;
padding:0;
}
html, body {
margin: 0;
padding: 0;
}
body {
font-family: 'Roboto', sans-serif;
font-weight: 100;
}
fieldset {
border: 1px solid white;
color: white;
text-align: center;
width: 200px;
}
legend {
padding: 0 10px;
}
</style>
javascript.html
<!DOCTYPE html>
<script>
window.addEventListener('load', function() {
console.log('Page is loaded');
});
</script>
"Please provide some sample code"
You obviously have the code above, but try google apps documentation here. I prefer not to use this as a tutorial, accept for google app script only features. Its not my favorite but is your best bet for written code examples specific to google app script. Also remember you can always go to the google-apps-script tag in stack overflow too!
"Please provide any tutorial to start with"
Most people would say w3 schools, and while I like w3 schools I recommend as a tutorial if you prefer to just google stuff to learn, not follow examples and try it out. If that's not you, I recommend you use w3 schools as a reference rather than a tutorial. As for a tutorial, I recommend codecadamy (the lessons are free, the quizzes and projects are not) as the number 1 tutorial.
Edit: Also check out google app script documentation for tutorials more specific for this question like here
Related
I've got some issue with geo location in html.
I'm developing a android app, one of the pages is webview this one loads a url I've been created.
The problem is: it ask to allow location but how to set it so always is allowed ??
Because that is not possible in Android app to request.
This is the code:
<iframe id="map_iframe" style="border:none; margin:0px; padding:0px; width:100%; height:150%;" src="https://url.com" allow="geolocation; microphone; camera; midi *; marginheight="0" marginwidth="0" frameborder="0" border="0"></iframe>
I've got some issue with geo location in html.
I'm developing an Android app, one of the pages is webview this one loads a url I've created.
The problem is: it ask to allow location but how to set it so always is allowed?
Because that is not possible in Android app to request.
This is the code:
style="border:none; margin:0px; padding:0px; width:100%; height:150%;" src="https://url.com" allow="geolocation; microphone; camera; midi *; marginheight="0" marginwidth="0" frameborder="0" border="0">
I wrote the code for mini cart. This is working fine in desktop but in mobile device its not working and code is showing as its in mobile browser. I am using below code.
<script>
jQuery(document).ready(function(){
jQuery('#mini-cart').mouseover(function(){
jQuery( this ).addClass('open');
jQuery( this ).children('.dropdown-menu').css('display','block');
}).mouseout(function() {
jQuery( this ).removeClass('open');
jQuery( this ).children('.dropdown-menu').css('display','none');
});
});
</script>
Please someone help me on this issue.
Thanks
you wrote mouseover() and mouseout() function. So it will work only in desktop. How do you access mouse in mobile ..?
try by changing open script tag to
<script type="text/javascript">
I got the error. This is designing issue. Designer put * and display: block in css that was applying on all elements. like.
.myclass > * {
display: block;
}
This is the issue that's why jquery is showing in browser.
I tried to make custom fonts for my application in phonegap. For that, I wrote this code in my html file:
#font-face {
font-family: 'customfont';
src: url('fonts/BMitra.eot?#') format('eot'),
url('fonts/BMitra.woff') format('woff'),
url('fonts/BMitra.ttf') format('truetype');
font-style: normal;
}
body {
font-family: "customfont";
font-size:30px;
}
....
<body>
<h>Custom Fonts</h>
<div style="font-family: 'customfont';" id='txt1'>This is for sample</div>
</body>
It works fine on Ripple (chrome emulator) but it doesn't work on the Device (Samsung Android 4.1.2)
I have googled and stack-overflowed to find the solution, i found this post font-face on android 4.0.x doesn't work which says to have text-rendreing:auto but it didn't work too.
Any help, will be appreciated.
finally I overcome this issue on Persian And Arabic custom fonts,
Keep all the codes with #fontface as same as it is,
Download this package http://averta.net/labs/fa/?p=10
From extracted archive, add bifon-1.1b.js to your html and use this script
function onDeviceReady() {
$('#txt1').text(FarsiStyle.convert('سلام عليكم').split('').reverse().join('').split(' ').reverse().join(' '));
}
which txt1 is a div or span.
p.s Thanks to Mr. Morteza F. Shojaei
I have been at this for days and have had no luck with trying to trouble shoot. So I have multiple live streams up on my site and I wanted to put this in an app but everytime I upload to phonegap and download on my phone the video wont play.
Neither the Flash or HTML5 version of the app plays. I simply copied the code I used on the site to place in my index.html document of my app but for some reason it fails. The message I get reads something like (going off memory) Either there was a problem with the network or server or this file is not supported). Although I know that isnt the fact because it works when I view the site from my phone, just not the app.
Markup looks something like this:
<head>
<script type="text/javascript" src="http://www.my-domain.com/jwplayer/jwplayer.js"></script>
</head>
<body>
div id='mediaplayer2'>
<script type="text/javascript"> jwplayer('mediaplayer2').setup({
'id': 'playerID', 'width': '388', 'height': '218',
'provider': 'rtmp',
'streamer': 'rtmp://0.0.0.0/some-directory',
'autostart': 'true',
'stretching': 'exactfit',
levels: [{
bitrate: "800",
file: "my-file-name",
width: "1280"
}],
'modes': [
{type: 'flash', src: 'http://www.my-domain.com/jwplayer/player.swf'},
{
type: 'html5',
config: {
levels: [ {'file': 'http://0.0.0.0/some-directory/playlist.m3u8'} ],
'provider': 'video'
}
}
]
});
</script>
<video
id="mediaplayer2"
controls="1"
autoplay="1"
height="218"
preload="none"
src="http://0.0.0.0/some-directory/playlist.m3u8"
width="388">
</video>
</div>
</body>
What do I need to do different to get this to work in an app like it does in my browser? Im developing in Dreamweaver and even when I hit "Live" it streams perfectly, just not in app.
Thanks in advance
Use Vitamio Player it can play all kind of streaming also its open source,. u just need to include this as library into ur project and make sure to use vitamio videoview or mediaplayer,. k no worry take a look at this Sample to include Vitamio into ur project
Hope its Helps you,.
Regards
Rajeev
I want to be able to create an app that uses WebView to request a url
from an external web application which returns html and css that
references images that are assets within the actual application. The
idea is basically to speed up everything so that images never have to
be downloaded.
Here is a simplified example:
Server HTML:
<html>
<head>
<style>
#myImage { background-image: url("file:///android_asset/myImage.jpg"; width: 50px; height: 50px;}
</style>
</head>
<body>
<div id="myImage"></div>
</body>
</html>
So, is there any way to be able to do this? My main goal is to just have the application request all the HTML from a server, but be able to map the image urls to local resources within the application.
Thanks in advance,
Leon
Why not to load all HTML from application side? If you bother that this web page will have no access to network - use WebView.loadDataWithBaseUrl method.
For embed images into a web page you can use data:URI scheme: http://en.wikipedia.org/wiki/Data_URI_scheme
Also you can map your application images even if you are page is loaded remotely. You can use WebView.loadUrl("javascript:....") to "send" images data via JavaScript code (also using data:URI scheme).
EDIT.
Firstly, at HTML side your example with embedded images will look something like this:
<html>
<head>
<style>
#myImage { background-image: url('data:image/png;base64,iVBORw0KG.....'); width: 50px; height: 50px;}
</style>
</head>
<body>
<div id="myImage"></div>
</body>
</html>
When, if you want to store this page at the application side, you can store it somewhere (string resource, asset folder) and when get it.
String pageResource = // get it somehow
WebView myWebView;
myWebView.loadDataWithBaseUrl(
"http://my.site.com", // The base url
pageResource, // page content to load...
"text/html", // it's MIME type...
"UTF-8", // and encoding
"http://my.site.com/page.html");
Now the WebView has loaded your page. It is loaded from local resources but from WebView point of view it is like it is loaded from the network. It has access to network resources and JavaScript code working here as well (this is the main difference between loadData and loadDataWithBaseUrl).