I'm trying to get a script that I've made for a google sheet to trigger when the sheet is opened (since I've found you can't trigger them manually through the mobile app). Somehow, I've managed to get half the script to work, while the other half does not. The script is intended for use on both desktop and mobile, and I want it to clear a predetermined set of cell ranges while also hiding a predetermined set of rows and columns (for formatting purposes). The script runs perfectly on desktop, but the clearRanges portion of the script doesn't run on mobile even though the hideRows/Columns portion of the script does. Any ideas on why this might be? The function I'm using can be seen below:
function onOpen() {
//Create custom menu options
SpreadsheetApp.getUi().createMenu('Invoicing')
.addItem("Clear Data", "clearRange")
.addItem("Submit", "sendEmailWithPdfAttach")
.addToUi()
//Clear ranges
var source = SpreadsheetApp.getActiveSpreadsheet();
source.getRange('A23:A40').clearContent();
source.getRange('H6:I6').clearContent();
source.getRange('H8:I8').clearContent();
source.getRange('F13:F13').setValue('FALSE');
source.getRange('F15:F15').setValue('TRUE');
source.getRange('D19:I19').clearContent();
source.getRange('D23:G23').clearContent();
source.getRange('D31:G31').clearContent();
source.getRange('A42:I44').clearContent();
source.getRange('B24:G25').clearContent();
source.getRange('B28:G29').clearContent();
source.getRange('B32:G33').clearContent();
source.getRange('B35:G40').clearContent();
source.getRange('H24:H29').clearContent();
source.getRange('H32:H33').clearContent();
source.getRange('H35:H39').clearContent();
//Hide rows/columns
var sheets = source.getSheets();
sheets.forEach(function (s, i) {
if (i == sheetNum) {
s.hideRows(45, 400);
s.hideColumns(10, 17);
} else {
s.hideSheet();
}
});
}
The custom menu options are for desktop use and can be ignored. I will also say this is my first time really using Apps Script, and most of this code was taken from elsewhere and modified. If you guys have any clue as to what I can do, I'm all ears. Thanks
There is a simple solution to it, You can create a button on your main
spreadsheet and link it with the script!
Open the same sheet on your Mobile Google Chrome
On the extreme Right Top corner, click on the three dots. A drop-down
menu Opens
Select "View in Desktop Mode".
Notice, the button your Spreadsheet is now clickable, as the sheet
interprets the user to be logged on to a PC
Now, Just Click on the button and let the script do its magic
SpreadsheetApp.getUi() doesn't work on Google Sheets mobile apps. The alternative is to create Android add-ons for Google Sheets. Unfortunately at this time there isn't support for other mobile platform add-ons for Google Sheets.
Related Q&A
Stack Overflow
Executing Google Apps Script Functions from Mobile App
google speadsheet api onOpen does not work on mobile ios
Web Applications SE
Add a script trigger to Google Sheet that will work in Android mobile app
Related
I made an addon (link, in the description - the full code) that works like this.
The spreadsheet editor fills the cells and selects the item to which the addon script is assigned in the user menu. The script inserts the current date on the sheet, collects the cell values, sends them to the owner, and removes the editor’s access to the spreadsheet.
Everything works great on the desktop, but does not work on mobiles. Now more than 50% of users visit the Internet from mobile devices. Mobile users cannot access menus, sidebars and buttons in the Google Sheets application. In addition, the mobile application must be additionally downloaded and installed. It is not comfortable.
In the mobile browser (for example, Chrome) they are available, but only if you select "Full version" in the settings.
In addition, in Chrome, the menu items are very small, you have to swiping to increase them. This is all uncomfortable.
It would be great if you could launch the addon from the button. The button can be made large. Then on mobile devices, using the spreadsheet directly in the browser will be more convenient.
Are there any ways that can solve this problem?
I would be grateful for the ideas.
I am new to hybrid mobile app development. Normally the frontend of my mobile application is developed with ionic, cordova and angular.js and the back end is .net.
This is the scenario I wanted to implement
In my mobile app, when the user is in online mode (with internet connection) the app automatically connect with remote database(host in somewhere else) and load the user templates which is saved in remote database. Actually the templates consists the user window for each type user.For example login widow for adult users,login window for young users, login widow for kids and etc.So then user can select the right template for him/her.
And the next part is the complicated part for me.
When the user in online mode, the app should download all the templates from the remote DB and save it in the local storage od the mobile device.Then when the user launch the app in offline mode(internet connection turned off) again the app should load the templates from the local storage(from the place where the templates are saved in online mode) and then the user can select the window as previously.
Actually this requirement is quite difficult to tackle with for me.So any help in this regards is highly appreciated.I don't have any idea about how to solve this problem.Please help me.Thanking you
add connection plugin.
write angular wrapper or use ng cordova.
write callback function in angualr for information on connection.
a) in this angualr function change $state to that you need.
first of all you create Two global variabel ex. var his = 0; var her = 0; and your select category section if we select his on thai click function his = 1; and onload page function set if condition like if (his == 1) {
load json throw your his themes.
};
**And still you have any confusion then message me.**
I am using Google Maps javascript API within an angular application. When using the app in Google Chrome on a regular desktop machine with a mouse, various navigation features (pan/zoom) work in the google maps part of the application just fine. However, when I try to use touch gestures on a windows 8.1 screen, the maps do not recognize any of the pan or zoom gestures. If I pinch to zoom, nothing happens. If I double tap on the screen like a mouse, then maps will zoom in. If I drag with a finger, the browser window handles the touch events instead of the maps div, so left and right navigates page history and up and down dragging scrolls the whole page instead of panning the maps.
As another experiment, I tried using google maps http://maps.google.com itself inside of Chrome, and it worked fine. So that means that it can be done somehow....
So, is it a viewport meta tag type of thing? Or does it have to do with sizing the map element? Or is it an angular thing and we need to do something with ngTouch somehow to allow the app to respond to touch events?
Update: the touch events do work on the same page on an iPad. I'm not sure what that says, but it's encouraging that at least it works on mobile safari. It seems that we need to communicate something to Angular to tell it to accept the touch events.
UPDATE
This issue was handled in the bug
https://issuetracker.google.com/issues/35824421
and was solved in version 3.27 of Google Maps JavaScript API in December 2016.
Putting the following code before the google maps api script tag helps me. But, unfortunately, it continues to disable mouse events. Please, can we a find a solution for Google Maps API with both touch and mouse support?
This solution in place of setting the application boot flags of '--user-agent chrome' or '--user-agent safari'
<script>
navigator = navigator || {};
navigator.msMaxTouchPoints = navigator.msMaxTouchPoints || 2;
//navigator.maxTouchPoints = navigator.maxTouchPoints || 2;
//window.ontouchstart = window.ontouchstart || function() {console.log('this is touchstart!');};
</script>
Note that only the first two lines are used, the other two are commented out and were not required.
My inspiration for this solution is from: https://hacks.mozilla.org/2013/04/detecting-touch-its-the-why-not-the-how/ so thank you to Patrick and Robert.
This is in fact a Google Map bug #6425
The fun fact is that Google Map API is not serving the same content based on the User Agent. So, for some use case, the workaround is to spoof the User Agent, ether by :
Chrome Dev tool > Emulation > Model
a user agent spoofing extension
--user-agent chrome flag
Any android or iOS device will work, changing the default desktop google map app to a mobile like app. Drag and pinch will work again on this mobile like app.
After some testing, the minimal UA that switches to the mobile like app is "Chrome" or "AppleWebKit/537", but it sounds hazardous to use it, as it may very well change in the future.
For my purpose, chrome based kioks, this will do the trick until the bug is fixed.
I used the above solution and modified for it to work with a mouse as well
<script>
function MapTouch() {
return true == ("ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch);
}
if (MapTouch() === true) {
navigator = navigator || {};
navigator.msMaxTouchPoints = navigator.msMaxTouchPoints || 2;
}
</script>
I had the same problem.
JJ Stiff's solution enabled the touch events.
Apparently if you also want the mouse to work, you have to add the following line:
navigator.msPointerEnabled = true;
EDIT :
This morning i've test it with iphone 4 and its working perfectly so its probably specific on Android (i'm using Version 4.1.2) Vs AsyncUpload Control
I am currently creating a file upload section on a web page that can be view on every type of device (Computer, Tablets and mobile phone). When i test the file upload section on a standard computer everything works perfectly. When i test it on mobile phone (I'm using Samsung Galaxy S2 with all the latest update) i have access to the files on my phone. I can select the file that i want and it seems to upload perfectly ( I got the green dot from the telerik control which means that the upload has been successful ) but in fact the file created in the template directory of the control ( app_data\RadUploadTemp ) has a size of 0 bytes. So when i press my submit button, the file copied in my working directory is invalid and cannot be read. You can test it yourself on a telerik demo page.
http://demos.telerik.com/aspnet-ajax/asyncupload/examples/additionalfields/defaultcs.aspx
When i upload a file on this page from my mobile phone, the file size is always 0... So from there i know that its not something with my code but its something between the control and the mobile browser.
I have asked my question on telerik forum but i didn't get any answer yet.
Does someone know if there is a limitation from mobile browser to upload file using RadAsyncUpload control
And by the way, RadAsyncUpload control use the html5 File API first, if the browser cannot use it, the control will try to use flash/silverlight. if its still not working, it will use standard IFrame module to upload the file.
Here are some docs about the control http://www.telerik.com/help/aspnet-ajax/asyncupload-overview.html
I would like to know if someone else can test it on the demo page and let me know if it works. If not , anyone have an alternative solution to upload file from mobile phone ?
Thanks !
Sebastien
Here is the code to solve the problem on Android. i was not able to put it in my comment.
Telerik.Web.UI.RadAsyncUpload.Modules.Flash.isAvailable = function () { return false; };
Telerik.Web.UI.RadAsyncUpload.Modules.FileApi.isAvailable = function() {return false; };
Telerik.Web.UI.RadAsyncUpload.Modules.Silverlight.isAvailable = function() {return false; };
I just added a kind of If (android) do the code
Cheers !
With respect to webpages and webapps using Facebook's Javascript and Server side integration...
Facebook documentation notes that the send dialog is not supported on mobile devices, but they don't indicate how they make the determination that the dialog will not be shown or how we can find out.
This makes it difficult to display some alternate functionality in the right cases. For example the iphone is out, but the ipad will display the iframe version. The Nexus 7 with Chrome won't do the popup, but it doesn't have "mobile" in the user agent.
Does anybody know the criteria? ie. Regex on the user agent, or some certain feature detection?
Right now I am using browser sniffing :-(
function isMobile(string) {
return /mobile|android/i.test(string || navigator.userAgent);
}
Which, for instance, doesn't account for the fact that iPad Safari will display this dialog as an iFrame (but not the popup).
Thanks.