Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by AndreasX12 · Oct 07, 2014 at 05:48 AM · androidwwwlinkopenurl

OpenURL not working on Android

Hi. My code below works perfectly in the editor, but on Android, it doesn't work. I have a debugging plugin so that I can see log errors/warnings/messages on Android too.

This is my code for a very simple button:

 IEnumerator FindUrl(WWW www)
 {
     yield return www;
     
     // check for errors
     if (www.error == null)
     {
         
         //Assign the data that was fetched to the variable answer
         string answer = www.text.ToString();
         print(answer);
 
         yield return new WaitForSeconds(10f);

         Application.OpenURL(answer);
 
         // working        //Application.OpenURL("http://www.estate-maeglerne.dk/maegler/pages/property-presentation/property.action?caseno=470-2614&shopno=220079&utm_campaign=boligsiden&utm_source=boligsiden_dk&utm_medium=exitlinks&csref=boligsiden_website");



     } else {
         Debug.Log("WWW Error: " + www.error);
     }

 }

 // Update is called once per frame
 void Update () {

     if(Input.GetMouseButtonUp(0)) {

         if(transform.guiTexture.HitTest(Input.mousePosition) && transform.name != "") {

             WWW get_www = new WWW("http://danico.dk/Boligapp/Maegler.php?url=" + "http://www.boligsiden.dk/" + "/viderestilling/305d8d3ac029427d8dfc53f4a88b8552"); 
             //Start the Coroutine
             print("http://danico.dk/Boligapp/Maegler.php?url=" + "http://www.boligsiden.dk/" + "/viderestilling/305d8d3ac029427d8dfc53f4a88b8552");
             StartCoroutine(FindUrl(get_www));

         }
 
     }


The answer string is a URL including http:// It is working perfectly in the Editor. The browser is not opening on Android.

However, if I change the code to this: Application.OpenURL("http://www.estate-maeglerne.dk/maegler/pages/property-presentation/property.action?caseno=470-2614&shopno=220079&utm_campaign=boligsiden&utm_source=boligsiden_dk&utm_medium=exitlinks&csref=boligsiden_website");

It works on Android, but not when the URL is recieved from WWW.

How can this be fixed? Feel free to add this script to a GUITexture to see it in action.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Nabeel Saleem · Jan 23, 2015 at 11:25 AM 0
Share

check if this can help you! unity open url

3 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by tanuj0092 · Oct 07, 2014 at 07:41 AM

Hi,

Check the URL in the response. I guess the format of the URL must be incorrect. Check if there is http:// in your response?

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image AndreasX12 · Oct 07, 2014 at 08:04 AM 0
Share

This is the response on my Android phone:

" http://www.estate-maeglerne.dk/maegler/pages/property-presentation/property.action?caseno=470-2614&shopno=220079&utm_campaign=boligsiden&utm_source=boligsiden_dk&utm_medium=exitlinks&csref=boligsiden_website"

$$anonymous$$aybe the space in the beginning is the problem. I will try to remove it.

avatar image tanuj0092 · Oct 07, 2014 at 10:03 AM 1
Share

Yes it can create an issue here..

avatar image
1

Answer by mole1984 · Sep 02, 2015 at 09:29 PM

I found the solution!

For Android it is important that you add "http://" in WWW.

 //Not correct: 
 string post_url = "http://www.testdomain.de/display.php";
 WWW hs_post = new WWW(post_url);
 
 //correct: 
 string post_url = "www.testdomain.de/display.php";
 WWW hs_post = new WWW("http://"+post_url);


In my example you must not add the "http://" to the string, because the WWW variable hs_post will cut it. You have to add it at WWW hs_post.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by RandomCharacters · Sep 01, 2016 at 06:32 PM

On android go to player settings and change internet access from auto to required. Otherwise it will work on windows but not android.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

32 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

WWW class in unity doesn't load the image file from android gallery. 0 Answers

access to a folder inside apk 2 Answers

Apply texture to object from device gallery 0 Answers

WWW Buffer allocation failed 0 Answers

go back to the app after leaving it to the Android main screen 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges