Need help with Google Sheets API - Tasker Tips & Tricks

I recently found a tutorial on how to use Tasker to take voice notes to save it to Google Sheets. I'm trying to make a different project that involves adding (and possibly renaming) new sheets to an existing SpreadSheet. I've tried everything possible (with my limited knowledge, of course) to get it to work after reading Google's documentation. But nothing has worked. Can anyone tell what I might be doing wrong.
A1: HTTP Auth [ MethodAuth 2.0 Client ID:%client Client Secret:%secret Endpoint To Get Code:https://accounts.google.com/o/oauth2/v2/auth Endpoint To Get Refresh Token:https://www.googleapis.com/oauth2/v4/token Scopes:https://www.googleapis.com/auth/spreadsheets Force Re-Authenticationff Timeout (Seconds):30 Username: Password: ]
A2: HTTP Request [ MethodOST URL:https://sheets.googleapis.com/v4/spreadsheets/%spreadsheetid/batchUpdate Headers:%http_auth_headers Query Parameters: Body:{ "requests": [ { "addSheet": { "properties": { "title": "Sample Title", "gridProperties": { "rowCount": 20, "columnCount": 12 }, "tabColor": { "red": 1.0, "green": 0.3, "blue": 0.4 } } } } ] } File To Send: File/Directory To Save With Output: Timeout (Seconds):30 Trust Any Certificateff Automatically Follow Redirectsff Use Cookiesff ]

iampunX said:
I recently found a tutorial on how to use Tasker to take voice notes to save it to Google Sheets. I'm trying to make a different project that involves adding (and possibly renaming) new sheets to an existing SpreadSheet. I've tried everything possible (with my limited knowledge, of course) to get it to work after reading Google's documentation. But nothing has worked. Can anyone tell what I might be doing wrong.
A1: HTTP Auth [ MethodAuth 2.0 Client ID:%client Client Secret:%secret Endpoint To Get Code:https://accounts.google.com/o/oauth2/v2/auth Endpoint To Get Refresh Token:https://www.googleapis.com/oauth2/v4/token Scopes:https://www.googleapis.com/auth/spreadsheets Force Re-Authenticationff Timeout (Seconds):30 Username: Password: ]
A2: HTTP Request [ MethodOST URL:https://sheets.googleapis.com/v4/spreadsheets/%spreadsheetid/batchUpdate Headers:%http_auth_headers Query Parameters: Body:{ "requests": [ { "addSheet": { "properties": { "title": "Sample Title", "gridProperties": { "rowCount": 20, "columnCount": 12 }, "tabColor": { "red": 1.0, "green": 0.3, "blue": 0.4 } } } } ] } File To Send: File/Directory To Save With Output: Timeout (Seconds):30 Trust Any Certificateff Automatically Follow Redirectsff Use Cookiesff ]
Click to expand...
Click to collapse
You can try in a different way. I am not sure if it is possible or not. But you can try google apps script.
read doPost or doGet function of apps script and SpreadsheetApp guide. there is quota limit. So do a google search first. and you can read this also https://stackoverflow.com/questions...et-in-a-google-sheets-with-google-apps-script

Related

[Q] Modifying notification

Hi folks,
even though there are many nice 3rd party twitter clients available they are all missing an important feature: push notifications using GCM. The original Twitter app offers GCM based notifications but the app itself is more or less crap.
Therefore I thought about utilizing the original Twitter app for receiving GCM messages which create the Android notifications and then modify these notifications so that another (3rd party) app is started when clicking on them. I already managed to hook into the NotificationManager:
Code:
XposedHelpers.findAndHookMethod(android.app.NotificationManager.class, "notify", String.class, int.class, Notification.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("NotificationManager.beforeHookedMethod(): param=" + param);
for (Object o : param.args) {
if (o instanceof Notification) {
Notification n = (Notification) o;
XposedBridge.log("NotificationManager.beforeHookedMethod(): notification=" + n);
}
}
}
}
);
At this stage, where simple things as changing Notification.tickeText work, I tried the following:
1) Creating a new PendingIntent and assigning it to Notification.contentIntent:
Code:
Intent LaunchIntent = context.getPackageManager().getLaunchIntentForPackage("it.mvilla.android.fenix");
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, LaunchIntent, 0);
n.contentIntent = contentIntent;
This fails due to the fact that I did not succeed in getting my hand on a Context instance. Does anyone have got an idea on how to get a Context instance or can provide another possibility for creating the PendingIntend without a Context?
2) As the previous did not work due to a missing Context I tried to change the LauchIntent of the existing Notification. But I was not able to find the correct place - I did not even find the original LaunchIntent when studying the sources or even by dumping the notification by reflection.
I also started investigating on how to hook into the Twitter app itself. But as the source code is (of course) not public and additionally is obfuscated this seems to be even more complicated. In addition hooking into the NotificationManager is more generic and would allow - when adding configuration - the redirection also for other sources and targets.
As you see, I am somehow stucked. But I'm not hopeless respectively cannot imaging that it should not be possible. So now it's up to you to feed me with the correct ideas
So far and thanks in advance,
yaan04
yaan04 said:
1) Creating a new PendingIntent and assigning it to Notification.contentIntent:
This fails due to the fact that I did not succeed in getting my hand on a Context instance. Does anyone have got an idea on how to get a Context instance or can provide another possibility for creating the PendingIntend without a Context?
Click to expand...
Click to collapse
AndroidAppHelper.currentApplication() should do the trick. Otherwise see this, though if AndroidAppHelper fails most of these probably will, too.
yaan04 said:
2) As the previous did not work due to a missing Context I tried to change the LauchIntent of the existing Notification. But I was not able to find the correct place - I did not even find the original LaunchIntent when studying the sources or even by dumping the notification by reflection.
Click to expand...
Click to collapse
LaunchIntent?
yaan04 said:
I also started investigating on how to hook into the Twitter app itself. But as the source code is (of course) not public and additionally is obfuscated this seems to be even more complicated. In addition hooking into the NotificationManager is more generic and would allow - when adding configuration - the redirection also for other sources and targets.
Click to expand...
Click to collapse
Android API calls won't be obfuscated. Try searching for "NotificationManager" for example and see where it's used.
Yeah, AndroidAppHelper.currentApplication() provides a usable Context instance \o/
Thanks, GermainZ. Now I can go on...

[Q] problem with class static value

have some problems with static values used as flags.
for example I need to hook 2 methods in different FRAMEWORK classes during initZygote. (no problem with system apps during handleLoadPackage)
I hook method in first class, set static value and waiting when another method of another class will be triggered.
once another method is invoked, flag always has it's initial state.
it looks like each hook method processed in different class instances.
i tried volatile type, tried to synchronize - nothing help.
unreliable remedy:
1. register broadcast receiver inside hook method.
2. send action to own service
3. send broadcast from own service.
4. catch broadcast with receiver.
BUT it is not battery cost efficient solution in my case. And mostly I receive broadcast message when hooking method already processed and returned value. Otherwise I need to wait when service will process request and send broadcast. But it is not usable.
is there any solution?
Code:
public class XMain implements IXposedHookInitPackageResources, IXposedHookZygoteInit, IXposedHookLoadPackage
{
private static boolean isNeedToRun = false;
public void initZygote(StartupParam startupParam) throws Throwable
{
findAndHookMethod("com.class1", null, "method1", int.class, new XC_MethodHook()
{
@Override
protected void beforeHookedMethod(final MethodHookParam param) throws Throwable
{
isNeedToRun = true;
}
});
findAndHookMethod("com.class2", null, "method2", int.class, new XC_MethodHook()
{
@Override
protected void beforeHookedMethod(final MethodHookParam param) throws Throwable
{
if (isNeedToRun) param.setResult(null); // always FALSE even if previous hook set as TRUE
}
});
}
}
Why do you think that using a broadcast receiver is not battery efficient?
GermainZ said:
Why do you think that using a broadcast receiver is not battery efficient?
Click to expand...
Click to collapse
I do not want to invoke service and send broadcast very often (several thousands times during normal battery one cycle charge)
I just want use easiest way by storing flag inside class and worried that users will find the module in the list of gluttonous applications.
Falseclock said:
Code:
if (isNeedToRun) param.setResult(null); // always FALSE even if previous hook set as TRUE
Click to expand...
Click to collapse
You're probably not considering the fact that different processes will each have its own "isNeededToRun" variable.
Whenever new processes (system_process, apps, etc.) are forked from zygote, each of them will have its own independent state which includes this static variable. From then on they will be completely separate things even if it's a variable with the same name, don't get confused by that.
Try adding a Log.i(...) call to write something in both methods, and then check the logcat for the pid in which the messages are logged. I bet you'll see that different pids are writing and reading, and you can't expect them to be doing it in the same global variable.
Tungstwenty said:
You're probably not considering the fact that different processes will each have its own "isNeededToRun" variable.
Whenever new processes (system_process, apps, etc.) are forked from zygote, each of them will have its own independent state which includes this static variable. From then on they will be completely separate things even if it's a variable with the same name, don't get confused by that.
Try adding a Log.i(...) call to write something in both methods, and then check the logcat for the pid in which the messages are logged. I bet you'll see that different pids are writing and reading, and you can't expect them to be doing it in the same global variable.
Click to expand...
Click to collapse
Yes, I realized this. But under handleLoadPackage everything work perfect.
Any suggestion to solve situation?
Falseclock said:
Yes, I realized this. But under handleLoadPackage everything work perfect.
Any suggestion to solve situation?
Click to expand...
Click to collapse
handleLoadPackage is executed after the fork, in the new process. Not sure what exactly you hooked when you tried that way, but probably both callbacks were executed in the same app/process.
You have the typical problem that requires some kind of inter-process communication (IPC). Most common examples for IPC in Android are broadcasts and services. Files might also be an option (especially with observers), but probably not when you need to change the value very frequently.

[Q] call startService from hook method

Hello,
I've succeeded to hook method that gives me the accelerometer events.
so now all the application which use the accelerometer are generating events.
I wanted to send all those events from the hooking method to a service using intents that will aggregate them
and write them into a sqlite db (the db is not relevant for now, only the service).
The problem is that i can't start the intentService from the hook method.
Things that i tried already:
-- getting the Context from the activity on load by hooking the onStart in the Activity.class (succeeded getting the context but not starting the Service with an intent)
-- using the same context as above but start a broadcast receiver with implicit intent (define intent-filter in the manifest), and from the
broadcast to start the service (not worked either, the broadcast never got the sent message)
is there some guide or tutorial that can show me how to start a service or broadcast receiver from the hook method?
thanks ahead...
- make sure your service is defined in the manifest
- instead of IntentService, consider using standard service to which you can bind using context.bindService together with ServiceConnection object (see developer.android.com). You can use messenger approach for data exchange. This would be more efficient in your case.
As an example, I am using that approach in the following scenario:
I need to process screenshot taken during screen off in DisplayPowerController using my application context as I need to write image file within my module's filesDir
- I have a service within my module that receives image data and writes them to a file.
- I am binding to this service using bindService from within DisplayPowerController. It sends image data in chunks.
See this commit for more info:
https://github.com/GravityBox/GravityBox/commit/ad09553eaf0c669c4dcb8233a6b9706d1d939761
Call from other app context
First thanks for your answer,
Just to make it clear lets say i don't have any application,
i want to make some monitoring module on my phone which record all the Accelerometer events
request by different apps installed on my phone.
So there is general hook that tracking all the Accelerometer events, but when from those apps
or hook (the apps not mine but some apps i downloaded from the google play store), i want to
start a service or broadcast using their app context (taken from the activity or something).
The broadcast or service will not start (i think something with sandbox or that the apps and the service are not under the same context)
**that what i understood, maybe it's just some mistake in my code**
For example that some test i made:
Main Hook class:
public class TestHook implements IXposedHookLoadPackage{
@override
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
XposedBridge.hookAllMethods(Activity.class,"onStart", new XC_MethodHook()
{
@override
protected void beforeHookedMethod(MethodHookParam param)
throws Throwable {
Context context = (Context)param.thisObject;
if(context != null){
XposedBridge.log("sending brod...");
context.sendBroadcast(new Intent("com.example.logging"));
} else {
XposedBridge.log("not sending");
}
}
});
}
}
The receiver:
public class BrodTest extends BroadcastReceiver{
@override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Toast.makeText(context, "Got BroadCast", Toast.LENGTH_LONG).show();
}
}
and the manifest:
<manifest xmlns:android=
package="com.example.testproject"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<receiver android:name=".BrodTest">
<intent-filter>
<action android:name="com.example.logging"/>
</intent-filter>
</receiver>
<!--Declaration of the Xposed framework -->
<meta-data
android:name="xposedmodule"
android:value="true" />
<meta-data
android:name="xposedminversion"
android:value="30+" />
<meta-data android:name="xposeddescription"
android:value="Recording Sensors and Transmission events"/>
</application>
</manifest>
just tried to make some hook that will send to broadcast and show Toast message...
Thanks again...
I don't see anything wrong with the code. It should work.
Do you get a log message that the broadcast was sent?
Exported receiver?
Receiver log
The log shows me the sending message to the receiver so i know i have the context correctly,
and i at first put my broadcast exported to false, but than i thought about permissions problem
so i deleted the exported attribute for being exported=true by default..
bottom line, i see the logs messages but not the toast that the receiver should show me...
if there is any other suggestions i be grateful,
thx
Try creating a different receiver with a different class name. Try using fully qualified class name. Also make sure to change intent action string for a new one. Use something more standard like "testproject.intent.action.LOGGING".
Maybe something got messed up while you were changing receiver properties.
This info from doc is interesting:
android:name
Once you publish your application, you*should not change this name*(unless you've setandroid:exported="false").
Click to expand...
Click to collapse
Regarding "exported" attribute. Safely omit it as it defaults to true automatically when you have intent-filter defined.
And maybe also try Log.d() instead of toast and check logcat.
Log.d
about the Log.d you suggested, when i run even with debug mode from eclipse and install the new module
its require me to restart the phone first, how can i debug like normal application?
when i restart the phone the adb is closed and i loose the debugging ability?
thanks anyway i will try it out...
Use adb logcat from command line.

Random message to your wife/gf

So I get in trouble from wife sometimes cause I don't send message thoughout the day so I have come up with a taker profile to fix it.
Random Message (6)
A1: Variable Randomize [ Name:%waitmin Min:1 Max:179 ]
A2: Wait [ MS:0 Seconds:0 Minutes:%waitmin Hours:0 Days:0 ]
A3: Variable Randomize [ Name:%linenum Min:1 Max:20 ]
A4: Read Line [ File:Tasker/wifemessages.txt Line:%linenum To Var:%randommessage ]
A5: Flash [ Text:%randommessage Longn ]
A6: Send SMS [ Number:1234567890 Message:%randommessage Store In Messaging Appff ]
So the tasker is setup to fire every three hours.
**A4 you will need to make a txt file containing some message you want to send to your lover.
**A6 to your lovers number.
Let me know if I can improve this.
Josh
Dude I didn't test it.. But it's real innovative...[emoji106]
Thought about doing this myself!! Glad someone has already done the work.
Is there a way to do this with hangouts or kik or any other message app?
Sent from my SM-N920T using Tapatalk
any way you can get this to send a message to your girlfriend number 1, and send a different text to gfriend number two and three?
nickmax1 said:
any way you can get this to send a message to your girlfriend number 1, and send a different text to gfriend number two and three?
Click to expand...
Click to collapse
Sure. Just have it run again for each number.
I mean... No! You shouldn't have more that one gf at a time!
Sent from my LG G2 Mini using XDA Labs
Haha really cool thing!
samsHarvy said:
Haha really cool thing!
Click to expand...
Click to collapse
I love it keeps me out of trouble
Sent from my SM-G930F using XDA-Developers mobile app
WaterTrooper said:
Is there a way to do this with hangouts or kik or any other message app?
Sent from my SM-N920T using Tapatalk
Click to expand...
Click to collapse
I think autoinput will do it.
Josh Smith10 said:
So I get in trouble from wife sometimes cause I don't send message thoughout the day so I have come up with a taker profile to fix it.
Random Message (6)
A1: Variable Randomize [ Name:%waitmin Min:1 Max:179 ]
A2: Wait [ MS:0 Seconds:0 Minutes:%waitmin Hours:0 Days:0 ]
A3: Variable Randomize [ Name:%linenum Min:1 Max:20 ]
A4: Read Line [ File:Tasker/wifemessages.txt Line:%linenum To Var:%randommessage ]
A5: Flash [ Text:%randommessage Longn ]
A6: Send SMS [ Number:1234567890 Message:%randommessage Store In Messaging Appff ]
So the tasker is setup to fire every three hours.
**A4 you will need to make a txt file containing some message you want to send to your lover.
**A6 to your lovers number.
Let me know if I can improve this.
Josh
Click to expand...
Click to collapse
Wonderful idea!
I did the same. A serious problem will come the day the task will send the identical message twice.
Randomly it will happen. When your wife will unferstand that the romantic is made by tasker will she be happy?
I solved the issue setting in variables the last two random lines and checking that the current one is not equal to those.
My wife is happy...
pulcinella75 said:
Wonderful idea!
I did the same. A serious problem will come the day the task will send the identical message twice.
Randomly it will happen. When your wife will unferstand that the romantic is made by tasker will she be happy?
I solved the issue setting in variables the last two random lines and checking that the current one is not equal to those.
My wife is happy...
Click to expand...
Click to collapse
Oh. No way she wouldn't be happy lol.. Sometimes I blame the ohone if it's sends too.. Could you share your task at the end to check.
Sent from my SM-G930F using XDA-Developers mobile app
Happy wife - happy life! Case closed :good:
Anybody want to share the Xml?
Sent from my SM-G920V using XDA-Developers mobile app
Thanks
Josh Smith10 said:
So I get in trouble from wife sometimes cause I don't send message thoughout the day so I have come up with a taker profile to fix it.
Random Message (6)
A1: Variable Randomize [ Name:%waitmin Min:1 Max:179 ]
A2: Wait [ MS:0 Seconds:0 Minutes:%waitmin Hours:0 Days:0 ]
A3: Variable Randomize [ Name:%linenum Min:1 Max:20 ]
A4: Read Line [ File:Tasker/wifemessages.txt Line:%linenum To Var:%randommessage ]
A5: Flash [ Text:%randommessage Longn ]
A6: Send SMS [ Number:1234567890 Message:%randommessage Store In Messaging Appff ]
So the tasker is setup to fire every three hours.
**A4 you will need to make a txt file containing some message you want to send to your lover.
**A6 to your lovers number.
Let me know if I can improve this.
Josh
Click to expand...
Click to collapse
Thanks for the great task. I changed it up to meet my needs, but it was nice to have a good base to work off of. Keep up the great work.
Josh Smith10 said:
So I get in trouble from wife sometimes cause I don't send message thoughout the day so I have come up with a taker profile to fix it.
Random Message (6)
A1: Variable Randomize [ Name:%waitmin Min:1 Max:179 ]
A2: Wait [ MS:0 Seconds:0 Minutes:%waitmin Hours:0 Days:0 ]
A3: Variable Randomize [ Name:%linenum Min:1 Max:20 ]
A4: Read Line [ File:Tasker/wifemessages.txt Line:%linenum To Var:%randommessage ]
A5: Flash [ Text:%randommessage Longn ]
A6: Send SMS [ Number:1234567890 Message:%randommessage Store In Messaging Appff ]
So the tasker is setup to fire every three hours.
**A4 you will need to make a txt file containing some message you want to send to your lover.
**A6 to your lovers number.
Let me know if I can improve this.
Josh
Click to expand...
Click to collapse
Very cooooll thing
Thanks for this. Now before my son plays any games he has to get 3 correct spellings.
Buried the file nice and deep, and renamed it to minimise cheating too.
I absolutely love Tasker, but this is one time where I decided to make an app to make this “brain dead” simple, and add some easy-to-use smarts as well. The app is CommuniqAI and it can be used to help you stay in touch with anyone, not just loved ones. Details are at https://forum.xda-developers.com/t/...sms-calls-and-email-with-promo-codes.4337045/.

Wifi switching between 5 home networks

I have a large house on a farm. I have 5 wifi networks. 4 are in the house. There are two routers. Each has a 2.4GHz network and a 5GHz network. I also have a line going out to my shop from one of these routers. The line feeds an access point.
I want to make a task that QUICKLY switches to the strongest network of the 5. Id like the task to trigger when I get home from work. I thought these phones could sense wifi networks they are familiar with even when wifi was off. Can I tap into this somehow to trigger the task? I have tried auto connect and the task described in this YouTube video(https://youtu.be/5Y0csfH4h_g). This seems to work partially and sporadically. It's the best I have had. I have been chasing this one since I got this phone in November. If someone can figure this out we need to post it all over the internet! It seems like most of these are designed for switching between 2 networks, but don't work well when having to pick from multiple networks like in my scenario. There have been a couple other plugins mentioned such as this one: https://play.google.com/store/apps/details?id=ultimatesoftware.nw.SSIDSelector&hl=en. This hasn't been updated in years though, and the developer never replied when I emailed him. Someone please help.
Sent from my Pixel 2 XL using Tapatalk
TTT
You'll need Autotools. Here's description of the task:
ChgToBestWifi (2)
Abort Existing Task
A1: Perform Task [ Name:GPS On Priority:%priority+10 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stopff ]
A2: AutoTools Connectivity [ Configuration:Check Wifi Networks: true Timeout (Seconds):5 Continue Task After Errorn ]
A3: AutoTools Json Read [ Configuration:Simple Mode: true
Json: %atwifinetworks
Fields: ssid
Separator: , Timeout (Seconds):5 Continue Task After Errorn ]
A4: AutoTools Connectivity [ Configuration:SSID: %ssid Timeout (Seconds):10 Continue Task After Errorn ]
A5: Perform Task [ Name:GPS Off Priority:%priority+10 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stopff ]

Categories

Resources