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

百般思念 提交于 2019-12-25 07:37:46

问题


I am using JuiceSSH for making SSH connections to my RaspberryPi whenever I want. 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. I am thinking about using a google apps script in which I can get the new IP address value from the e-mail. But I don't know where the JuiceSSH app holds the configurations. And I do not also know whether I can manipulate any file into an android phone using a google apps script.


回答1:


Google Apps Script cannot directly access any files except those in your Google Drive.

You may be able to empower a script to indirectly change the JuiseSSH config - if you can...

  1. Figure out where it is.
  2. Set up a web server on your phone to accept incoming POST operations.
    • See this LifeHacker blog.
    • When a valid POST is received, decode the payload and use it to update the local file.
    • There will be security issues with this!
  3. Write your Google Apps Script
    • Monitor your email for a message about a change in your Raspberry PI's IP address.
    • Figure out how to track the phone's IP address!
    • POST the update to your phone.
    • retry periodically until the POST is successful (since the phone's connection is not reliable)

Another approach would be to have a Google Apps Script WebService serve up the current address of the device; 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.



来源:https://stackoverflow.com/questions/24704943/is-it-possible-to-create-a-google-apps-script-that-manipulates-a-file-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!