Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Launch IOS Application after handling request #557

Closed
fryguy04 opened this issue Aug 11, 2013 · 9 comments
Closed

Launch IOS Application after handling request #557

fryguy04 opened this issue Aug 11, 2013 · 9 comments

Comments

@fryguy04
Copy link

I've just got SiriProxy up/working and love it, I'm new to ruby but wrote an application to control my HDMI Matrix switch with a command like:

Watch "TiVo" in "Bedroom"

I would like to automatically launch the TiVo Application (or other ones dependent on what device user wants to watch)

I know Siri can Launch ... Is this possible for SiriProxy to do the same? If so can you provide example Ruby code? Thanks!

@elvisimprsntr
Copy link
Collaborator

Someone was successfully able to do just that using URL methods. https://github.com/aecom/siriproxy-url

@elvisimprsntr
Copy link
Collaborator

@elvisimprsntr
Copy link
Collaborator

http://handleopenurl.com

@fryguy04
Copy link
Author

Wow, thank you for your extremely quick response ... I'm currently coding my siriproxy and will incorporate your great advice!!

@elvisimprsntr
Copy link
Collaborator

I haven't been able to find the Tivo app URL scheme, but I would think it exists.

@elvisimprsntr
Copy link
Collaborator

looks like the TiVo app URL scheme is simply tivo://

@fryguy04
Copy link
Author

Actually tried tivo:// and it fails ... some googling uncovered
fb129267530460609:// will launch TiVo IOS App ... Confirmed it works for
me!!!!

I'm currently writing a generic App launcher (mainly to learn more Ruby)
... I'll share when done (lot of the code is based off of @elvisimprsntr
various examples ... Much thanks!

On Sun, Aug 11, 2013 at 2:24 AM, Elvis notifications@github.com wrote:

look like the TiVo app URL scheme is simply tivo://


Reply to this email directly or view it on GitHubhttps://github.com//issues/557#issuecomment-22453238
.

@fryguy04
Copy link
Author

Just learning Ruby/SiriProxy this weekend. I wanted to say "Listen to Pandora in Bedroom" then have Siri control my Whole house Audio, configuring Input (Pandora) to Outputs (Bedroom) then launch a control app for the input (Pandora) if applicable ...

After much reading, decided to post this out in case it is useful for anyone else ... Following code will launch an arbitrary Application ... Parameters are passed in at run time, so you can define your Apps to launch in a Hash in config.yml and pass it into your plugin. It requires forcing Siri to browse a page (that I dynamically create) so you'll need to install Apache and have it writable by siriproxy user.

Thanks to:
https://github.com/aecom/SiriProxy-Url
http://applookup.com # fixed broken link
https://github.com/elvisimprsntr/siriproxy-ipcam/blob/master/lib/siriproxy-ipcam.rb
And much thanks to @elvisimprsntr for pointing me this direction!!!

Hope this helps someone!

class OpenLink < SiriObject
    def initialize(ref="")
        super("OpenLink", "com.apple.ace.assistant")
        self.ref = ref
    end
end

def launch(appName, baseUrl, appUrl)

    # Create a URL redirect file to launch App in current host's Apache dir (must be writable by siriproxy user!)
    File.open("/var/www/" + appName + ".html", "w") do |file|
        file.puts "<html><head><title>IU Webmaster redirect</title> <META http-equiv='refresh' content='0;URL=#{appUrl}'> </head> </html>" 
    end

    fullUrl = baseUrl + appName + '.html'
    add_property_to_class(OpenLink, :ref)
    sleep (4)
    view = OpenLink.new(fullUrl.gsub("//",""))
    send_object view
end

# Now to call our function
appName = 'remote'                           # Anything you want to name it
baseUrl= 'http://192.168.0.55/'             # Of your siriproxy server running Apache (siriproxy must be able to write to /var/www)
appUrl = 'remote://'                        # Lookup appUrl here: http://applookup.com # fixed broken link

# This will launch your App
launch(appName, baseUrl, appUrl)

@elvisimprsntr
Copy link
Collaborator

Nice work. I suggest you publish your plugin on GitHub https://github.com/plamoni/SiriProxy/wiki/Plugin-Developer-Guide#publishing-your-plugin-for-others-to-install

Or post your method with the other developer. https://github.com/aecom/siriproxy-url

This will make it easier for others to adopt.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants