Discussion Forums  >  Uncategorized

Replies: 5    Views: 430

Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
07/04/11 02:06 PM (14 years ago)

Hyperlink in custom url doesn't work in app but works ok in phone browser (Android)

As title. I have a 'Download' button on a custom url screen, pressing the button does nothing when it's in the app. If I navigate to the url in my phone browser it works ok. (It's to download a .apk file). There is a similar problem here, only with phone numbers, but no solution: http://www.buzztouch.com/forum/thread.php?tid=480CDF01CEBCA7E4CF91329&status=&searchInput=hyperlink&sortColumn=FT.dateStampUTC&sortUpDown=DESC¤tPage=1&doViews=1
 
mutzy
Aspiring developer
Profile
Posts: 841
Reg: Nov 03, 2010
Medford, MA
9,860
like
07/04/11 02:33 PM (14 years ago)
Are you using version 1.5? Have you tried playing with the document behavior section in advanced properties? There's an option for detecting phone numbers and links, make sure it's turned on. That's all the advice I have, good luck!
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
07/04/11 03:21 PM (14 years ago)
Damn, sorry, I forgot... 1.4 Android :-(
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
07/05/11 01:07 AM (14 years ago)
Without looking into this further, I would be very VERY suprised if the build-in browser knew what to do with an .apk file. Have not tried this but a hunch. Not knowing how to handle the link isn't a limitation of the buzztouch code, I'm thinking it's a limitation imposed on us by the usefulness of the built in browser offered by the Android platform. Try this... see if it makes any sense. In the Screen_CustomURL.java class file you'll see a bunch of 'checks' or lines of code that look for certain file extensions. Staring at around line 90 of this file you'll see a bunch of places where it looks for certain characters in the URL like .mp3, youtube, .zip etc. In these cases, a flag is being set (useNativeIntent = 1) to tell the software to NOT try to open the link in the built in browser but instead tell Android to try to handle the file in the application it thinks is best. In your case, checking for a .apk file then opening it in the native browser may work? To do this, add a few lines of code like this: //anything with an .apk extension if(url.contains(.apk)){ useNativeIntent = 1; } You could add that after the .mp3 check, on like line 100 or so. That means 'hey android, do what you think is best with this file' and hope it opens the native browser. Give it a try?
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
07/05/11 03:00 AM (14 years ago)
Result!!! Thank you, thank you! It works perfectly using the above code. Just out of interest, would this work for stuff like ebooks with .epub .amz etc extensions? I'll be trying it out anyway. All excited now...
 
pefdore
I hate code!
Profile
Posts: 11
Reg: Jun 14, 2011
location unknow...
110
like
09/16/11 08:46 AM (14 years ago)
Hi, i have the same question than RAVEYD and read your post with lot interest BUT it doesn't work!! Well, i recap what i made, 1- I open my project in eclipse 2- open src => com.V1_4 => Screen_CustomURL.java 3- i put exactly this code after //anything with an .mp3 extention if(url.contains(.mp3)){ useNativeIntent = 1; } //anything with an .apk extension if(url.contains(.apk)){ useNativeIntent = 1; } 4- Then i go to my buzztouch Manage this app's menus & screens 5- I creat custom URL webpage 6- And then i put the adress of my apk in proprieties of custom URL Is it correct??? Because it doesn't work i have exactly the same problem than before!! Thanks sooooooooo much Buzztouch!!!!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.