简体   繁体   English

是否可以创建可操纵Android手机中文件的Google Apps脚本?

[英]Is it possible to create a google apps script that manipulates a file in android phone?

I am using JuiceSSH for making SSH connections to my RaspberryPi whenever I want. 我随时使用JuiceSSH来建立与RaspberryPi的SSH连接。 What I need to do is swap the IP address value into the JuiceSSH configuration file with the IP address that will be sent by RaspberryPi in case of IP address change. 我需要做的是将IP地址值交换到JuiceSSH配置文件中,并在IP地址更改的情况下将RaspberryPi发送该IP地址。 I am thinking about using a google apps script in which I can get the new IP address value from the e-mail. 我正在考虑使用Google Apps脚本,从中可以从电子邮件中获取新的IP地址值。 But I don't know where the JuiceSSH app holds the configurations. 但是我不知道JuiceSSH应用程序在哪里保存配置。 And I do not also know whether I can manipulate any file into an android phone using a google apps script. 而且我也不知道我是否可以使用Google Apps脚本将任何文件操作到Android手机中。

Google Apps Script cannot directly access any files except those in your Google Drive. 除Google云端硬盘中的文件外,Google Apps脚本无法直接访问其他文件。

You may be able to empower a script to indirectly change the JuiseSSH config - if you can... 您可能可以授权脚本来间接更改JuiseSSH配置-如果可以的话...

  1. Figure out where it is. 找出它在哪里。
  2. Set up a web server on your phone to accept incoming POST operations. 在手机上设置网络服务器以接受传入的POST操作。
    • See this LifeHacker blog . 请参阅此LifeHacker博客
    • When a valid POST is received, decode the payload and use it to update the local file. 收到有效的POST后,解码有效负载并使用它来更新本地文件。
    • There will be security issues with this! 会有安全问题!
  3. Write your Google Apps Script 编写您的Google Apps脚本
    • Monitor your email for a message about a change in your Raspberry PI's IP address. 监视您的电子邮件,以获取有关Raspberry PI IP地址更改的消息。
    • Figure out how to track the phone's IP address! 弄清楚如何跟踪手机的IP地址!
    • POST the update to your phone. 将更新发布到您的手机。
    • retry periodically until the POST is successful (since the phone's connection is not reliable) 定期重试,直到POST成功为止(因为电话连接不可靠)

Another approach would be to have a Google Apps Script WebService serve up the current address of the device; 另一种方法是让Google Apps脚本Web服务提供设备的当前地址。 then a program on the phone could periodically reach out to the service to find out the address, and update the file. 然后电话上的程序可以定期与服务联系,以找到地址并更新文件。

Of course, if you connected to your Raspberry PI using a name instead of an IP address, you wouldn't have to worry about any of this. 当然,如果使用名称而不是IP地址连接到Raspberry PI,则无需担心任何这些。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Android中运行Google Apps脚本 - Run Google Apps Script in Android 是否可以在Android手机中执行Shell脚本? - Is it possible to execute a shell script in an Android phone? 是否可以从手机上安装的其他应用程序提取Android菜单设置? - Is it possible to extract Android menu settings from other apps installed on the phone? 从 Android 应用程序运行 Google Apps 脚本? - Run a Google Apps Script from Android App? 是否可以在iOS / Android / Windows Phone中访问其他应用程序的文件? - Is it possible to access other apps' files in iOS/Android/Windows Phone? 是否可以使用 MySQL 创建桌面应用程序和 android 应用程序(移动)? - Is it possible to create a desktop apps and an android apps (mobile) with MySQL? Android应用程序在手机上崩溃 - Android Apps crashes on phone android 应用程序未部署到手机 - android apps not deployed to phone Android JUnit测试可以在目标应用程序数据目录中创建配置文件吗? - Possible for Android JUnit test to create a config file in the target apps data directory? android-是否可以将Google出售的Android Dev Phone 2更新到2.1 OS? - android - is it possible to update the Android Dev Phone 2 sold by google to 2.1 OS?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM