For the share API afaik you have to register a dbus service, and launch your app with file path through that.