Associating a file type with an app

The place to discuss anything and everything about running your LiveCode on Android

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
KimD
Posts: 211
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

Associating a file type with an app

Post by KimD » Fri Dec 11, 2015 12:24 am

Using Livecode - how would I go about associating a particular file type with my Android app?

1) User has my app ABC on their Android device.
2) User receives an email on their Android device. The email has an attachment of type XYZ.
3) When the user opens the attachment of type XYZ, Android automatically starts up my app ABC (which is the appropriate app to work with attachments of type XYZ).

Thanks in advance

rblackmore245
Posts: 67
Joined: Fri Jun 12, 2015 9:42 am

Re: Associating a file type with an app

Post by rblackmore245 » Fri Dec 11, 2015 3:58 pm

You could do this with a custom URL scheme, so within the email you have a link that launches the app and passes a reference code which the app then downloads the data from a web server.

I think that would be the only way you could do this unfortunately.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5770
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Associating a file type with an app

Post by jacque » Sat Dec 12, 2015 10:39 am

You can enter a custom scheme in the Android standalone settings. When the user clicks the link, your app will receive a message with the link included as a parameter. I'm not at the computer right now so I can't look up the message name but I'll try to remember to do that tomorrow if no one one else does.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

KimD
Posts: 211
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

Re: Associating a file type with an app

Post by KimD » Mon Jan 11, 2016 10:38 pm

Thanks both. Sorry about the delay in acknowledging your replies. I moved house and went on holiday. The 2nd was much more fun than the first. Next week I will experiment with the custom URL scheme feature in the Android standalone settings.

Regards

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5770
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Associating a file type with an app

Post by jacque » Tue Jan 12, 2016 8:45 pm

Your reply reminded me I was going to look up the message your app will get when the custom url is clicked: urlWakeUp.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

KimD
Posts: 211
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

Re: Associating a file type with an app

Post by KimD » Tue Jan 19, 2016 4:12 am

What I've tried is:
1) download the Launchee stack from the following livecode lesson -

http://lessons.livecode.com/m/4069/l/58 ... rl-schemes

This lesson includes teh statement - Once the "launchee" app is on your device you can also launch it from a browser, by going to any URL that starts with the custom URL of the app.

2) Save the Launchee stack as a standalone application, then load the resulting apk file onto my android phone. Note that under the Android Application Settings, the custom URL field contains the text "webme".

3) Go into the Chrome browser on my phone, and type "webme://" in the address bar. I'm deleting everything else from the address bar "http....."; "webme://" becomes the only content, then I press the tick key that substitutes for an Enter Button on my phones browser.

I had been expecting (hoping) that this would result in the Launchee app being launched on my phone, but this does not occur. All that happens is that Chrome reports that it can't find any results for "Webme", and gives me some other recommended results instead.

What am I getting wrong, or have I completely misunderstood how this is supposed to work?

Regards

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5770
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Associating a file type with an app

Post by jacque » Tue Jan 19, 2016 6:17 pm

Just a guess, but I suspect a browser needs a full URL. Typing only the designator is the equivalent of entering only "http://" and the browser doesn't think there's anywhere to go. Try adding some extra content to it.

webme://go.cd.1

The lesson uses a LC stack to do the launch, which apparently doesn't have the same limitation.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

rblackmore245
Posts: 67
Joined: Fri Jun 12, 2015 9:42 am

Re: Associating a file type with an app

Post by rblackmore245 » Tue Jan 19, 2016 6:33 pm

The only way I have ever been able to get this to work is via a HTML URL link does not seem to work in email applications unless you have a webpage that does a instant redirect to your URL scheme.

KimD
Posts: 211
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

Re: Associating a file type with an app

Post by KimD » Tue Jan 19, 2016 10:10 pm

Thanks both

I tried webme://go.cd.1 on Chrome but it didn't work. Same result.

Then because I'd run out of other things to try I downloaded a different browser. On Android 5.1:
Chrome - FAILS to launch the Launchee App when "webme://: is entered in the address line
Dolphin - also FAILS to launch the Launchee App
Firefox - SUCCEEDS in launching the Launchee App when "webme://: is entered in the address line
Opera - also SUCCEEDS in launching the Launchee App

So - some progress

Now to try and get the App to launch from a link embedded in an email, which is what I really want.

Regards

KimD
Posts: 211
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

Re: Associating a file type with an app

Post by KimD » Wed Jan 20, 2016 12:19 am

FYI

I tried embedding the custom url "webme://" into a gmail and sending it to a phone which had the Launchee app installed on it. Gmail stripped out the custom url and replaced it with plain text.

I did some research on the internet and discovered that, on Android, Gmail and Chrome don't like custom urls. Which also explains why I couldn't get the custom url to work when I typed it into the address bar on Chrome. The work around suggested for Android was:
1) embed a link to a webpage that you control into your email; then
2) embed the custom url as a clickable link on that webpage.

Which, unless I'm mistaken, is what rblackmore was saying.

To test this I temporarily inserted a link with the contents "webme://" into my blog, and emailed a link to the blog to myself. That worked fine. The email link took me to the blog, and when the blog opened and I clicked on the word which linked to "webme://" - and the Launchee App started on my phone. This creates one extra step for the users, but I think that I can still make it work. I will just need to create a website to work in conjunction with my app - and possibly also use temporary unique pages on the website to pass parameters between the instances of my app which are running on different android phones.

Thanks for the advice that you have provided.

Post Reply

Return to “Android Deployment”