My Game is crashes when calling Application.OpenURL , if i remove this line game works perfectly.
This works on editor , but in PC.
↧
Application.OpenURL crashes on PC
↧
Application.OpenURL open local file with special characters on android
On android i just want to open a video. Application.OpenURL works perfectly, until the filepath have special characters in it. All this also work fine on windows, doesnt matter which filepath's i have. I talk here only about android.
/mnt/xxx/2014/project.mp4 # works perfectly fine, opens the video in the native player
/mnt/xxx/2014/project cool.mp4 # doesnt work at all
So i have tried many things like (i write fixed path's here because i want exclude the way to convert filenames, that's the easy part)
/mnt/xxx/2014/project cool.mp4 # doesn't launch anything at all, logcat show only one "start u0" command, nothing more
/mnt/xxx/2014/project+cool.mp4 # doesn't launch anything at all, logcat show only one "start u0" command, nothing more
/mnt/xxx/2014/project\ cool.mp4 # doesn't launch anything at all, logcat show only one "start u0" command, nothing more
/mnt/xxx/2014/project%20cool.mp4 # launch video player, but video player cannot find the file, logcat shows that the file later get converted to /mnt/xxx/2014/project%2520cool.mp4 in some java routine from android
So, i have absolutely no idea how to use this correctly. I guess the %20 version is fine but this seems to not work later in android.
I've inspected the gallery app of android, how they do it. Well, the have "proxy" urls like "content://media/external/video/382". Is there any possibilty in unity for such file proxy?
↧
↧
open another app from ours?
Hi,
I want to open gallery from my android app. I found somewhere that you can do it using`Application.OpenURL`having gallery URI path in it. But I don't have a sun beam of idea to do it anyway. Can somebody know how to achieve it, opening certain app from our application.
Thanks!
↧
Browse to folder on Android via File Explorer
I'm using System.IO to read and write to a text file kept in the root of Application.persistentDataPath for my Unity Android app. Once the user is done making changes in the app, I would like them to be able to click a button and be taken straight to the folder where they can email themselves, or someone else, the text file. (This process is necessary. I am unable to use a database to store this data for unrelated reasons.)
Using Application.Openurl() I can browse directly to the text file which opens the file contents:
Application.Openurl(Application.persistentDataPath + filename);
but from here the user is unable to share the file or go back a level to the folder the file is kept in.
What I want is this to work:
Application.Openurl(Application.persistentDataPath);
Notice how I've removed the file name. I've tried using the "file://" protocol and adding "/" at the end but nothing seems to work. The error I get when attempting to open the folder is: "Cannot display PDF: (file is of invalid format)" which is strange because there are no pdf documents in my persistent data folder and the path is just to a folder.
Any ideas on making this work? **Everything work's fine on desktop including opening just the folder.** Opening the folder on Android is what I need help with.
↧
Unity C# Application.OpenURL not working with variable input
Also posted on Stack Overflow at: https://stackoverflow.com/questions/45039888/unity-c-sharp-application-openurl-not-working-with-variable-input
I'm building an application in Unity and I have a button that uses Application.OpenURL() to bring the user to a certain page when clicked. Up until now, I was using the fully typed out url name in double quotes as the parameter for the OpenURL function, and it was working as I intended. When I pressed the button the page was opened in the browser.
In order to incorporate multiple possible urls, I have changed the parameter to a string variable called url_name. Since this change, nothing happens when the same button is pressed. My code currently looks like this:
IEnumerator alertPopUp(string metaData_Content){
if (alertDelay)
{
yield return new WaitForSeconds (alertDelayLength);
}
string[] tokens = metaData_Content.Split (',');
string sign_name = tokens [0];
string url_name = tokens [1];
string template = "You discovered {0}";
string data = sign_name;
string message = string.Format(template, data);
MNPopup popup = new MNPopup ("Honorary Chicago", message);
popup.AddAction ("Find out more!", () => {Application.OpenURL(url_name);});
popup.AddAction ("Not now", () => {Debug.Log("action 2 action callback");});
popup.AddDismissListener (() => {Debug.Log("dismiss listener");});
popup.Show ();
}
Notes:
The block that starts with MNPopup takes advantage of a plugin I got from the asset store that builds formatted pop ups. I don't believe it has anything to do with the problem, especially since the script worked as intended when I had a string typed out.
I have tried testing with Debug.Log(url_name) in place of Application.OpenURL(). The log displayed the correct url as intended, so it appears that url_name is the value I intend it to be.
Question:
Why is the Application.OpenURL() function working when I type out a string, yet not working when a string variable is inputted?
↧
↧
Open screenshot in file location Android
I have a button that takes a screenshot which saves into my Android device in the folder "sdcard/DCIM/Camera".
I then have a separate button with the code:
Application.OpenURL ("/sdcard/DCIM/Camera");
This button is meant to open up the filing system so the user can view the screenshot that was taken.
When I test this, it briefly opens a filing system then returns to the App, it doesn't have time to load anything other then the folder name and the related GUI (search, options etc buttons).
Does anyone know why it doesn't stay on the folder?
↧
Application.OpenURL not working in Android 6 & 7
Hi,
I am trying to open the URL externally in Play Store using Application.OpenURL(url).
But from Android 6.0 , this causes the game application crash at first launch of the app.
But the same is working in Android 4.x.
How can we solve this?
I am in need to go for production.
If anyone has solution, kindly provide and help me.
Thank You..
↧
Using Application.OpenUrl to open a URL in a String variable
Hi,
I'm currently trying to build a simple program in Unity which gets a string from a URL, strips out the html and then passes that String variable to Application.OpenUrl to open a site I specify.
However when i tell Application.OpenUrl to open the link it does nothing, doesn't even open the browser, like it has no data. If i hard code the link it works fine leading me to think that the way Unity handles Strings is more complex than raw text, am I right? and is there a way around this problem?
Thanks
↧
How can I open an URL without using Application.OpenURL?
I am calling an URL in the `Start()` function. But I don't want to open it using `Application.OpenURL()`. I don't want to open a browser window explicitly.
Basically, I have a PHP file in the URL, which posts score to the database, How can I do this? Please, any suggestions?
↧
↧
Unity "Application.OpenURL" Doesnt work.
Hi,
I'm trying to use this code to open up email composer:
Application.OpenURL("mailto:email@hotmail.com?subject=Email&body=Unity");
but the problem is it doesn't work. I replaced the url with "www.google.com" and it works fine but as soon as I replace it with mailto, doesnt work.
I even used "mailto:email@hotmail.com?subject=Email&body=Unity" on my browser and it works.
Can someone please help me with this. Is there anything I should do in Unity before using "mailto"?
Thanks.
↧
How do I type in a URL without commenting out the rest of the line?
It seems like a really dumb question but it's got me stuck...
As soon as I type in
Application.OpenURL ("http://
everything after the // becomes a comment. My workaround was to create a string "http:/" and then add "/myurl.net/whatever.html" to the end of it, but there's got to be a less stupid way to do it...?
↧
C# Android Application.OpenURL() sends email, but app hangs after
I use this
Application.OpenURL("mailto:" + formEmail + "?subject=MySubject Consent&body=Mymsg");
The message sends that's great, it even returns to the app which calls Application.LoadLevel(); after calling Application.OpenURL, which for a split second I see the menu that loads when the level starts. However, it just hangs and turns black. Not sure what is going on. I can see the app is running, I tried going to open the app again to ensure it knows it isnt paused. Not sure. On PC, it does call Outlook and loads level, but maybe it is a multitasking issue do I need to call a Pause of Yield maybe? Thoughts? Need more info?
Thanks in advance. I am doing this for a school project and nearing the end. I have a workaround, but it would be nice to show this feature.
↧
Open Url in browser on button click
Hello I am new to unity .
I am developing an app in unity 3d .
Their is one functionality in which I want to open the weburl in browser through the game .
On completing the browsing if user wants to go back their must be one button .
On clicking that button the previous state of the game must open i.e. the state where the user clicks the button to go to that webpage.
How to accomplice this task .It must not be difficult.
I am using Application.OpenURL(); to open webpage .
Here it opens in browser and their is no way to go back to the state of the game....
Thanks ...
↧
↧
Application.OpenURL causing crashes on Android?
I am working on a very basic app demo right now, that simply opens a webpage when you press a button in the scene. However, every time OpenURL gets called, the app crashed and says it stopped unexpectedly. This happens even if the only URL call is a hardcoded one in an input handler script.
↧
Application.OpenURL not working with Data URI
If you enter the following URI in the browser:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==
it will show a 5x5 pixels red circle.
I'm trying to do this inside Unity with `Application.OpenURL` or `Application.ExternalEval("window.open(url,'_blank')")` but it does nothing. It doesn't work on editor nor on Mac build, but strangely it works on the Web Player (and that's why I think my code is working).
↧
Mailto with attachment
Application.OpenURL("mailto:?subject=test&body=test&attachment=" + filePath);
it does open the mail program, but do not include the file.
Am I doing something wrong? There's any way to do that with unity?
↧
How do I open a URL after a private static var hits a certain amount.
Hi Guys
I've been learning basic coding and have found all the answers really helpful, Kudos. But I'm stumped on this one. I've got an onmousedown function set up so when you tap an object it destroys it and increases the score. I'm trying to make it so when the score hits five a URL opens.
Destroy and count work fine, but website won't open at five. (or anything).
static var score = 0;
private static var numKills : int;
var killsDisplay : GUIText;
function OnMouseDown ()
{
Destroy(gameObject);
numKills++;
killsDisplay.text = ("Bitcoins Found: "+ numKills + "/5");
score = score+1;
guiText.text = ""+score;
if(numKills == "5") { Application.OpenURL("https://ww.google.com"); }
}
If I get rid of everything and just do onmousedown - openapplication and it works fine so I'm guessing it's either my if statement or my counting.
If anyone could help me i would be super stoked.
↧
↧
How to open a pdf on android device from streaming assets folder
Hi,
I've been banging my head against the wall trying to figure this out. I've scoured the forums and have implemented what I think is the correct solution, but it is still not working.
I'm trying open a pdf in the device's web browser. The PDF is located in my streaming assets folder. I'm calling the following from OnGUI when a button is pressed.
string path;
//set the correct path to the rules files
if (Application.platform == RuntimePlatform.Android) {
path = System.IO.Path.Combine(Application.streamingAssetsPath, Tag.rulesFilename);
WWW www = new WWW(path);
while (!www.isDone) { //I will replac e this with a Coroutine once its working
Debug.Log ("LOADING FILE: " + www.progress); //returns 0 for a few iterations
};
Debug.Log ("FILE LOADED: " + www.progress); //returns 1
Debug.Log ("FILE EXISTS: " + (System.IO.File.Exists(path)?"YES":"NO")); //returns NO
Debug.Log("ANDROID PATH " + path); //returns ANDROID PATH jar:file:///mnt/asec/com.me.app-1/pkg.apk!/assets/file.pdf
Application.OpenURL(www.url); //intent launches but nothing happens
}
else {
path = System.IO.Path.Combine(Application.streamingAssetsPath, Tag.rulesFilename);
Application.OpenURL(path);
}
The non-android portion works fine in the editor and a standalone windows exe. I've also check that the following will open a web browser on android.
Application.OpenURL("www.google.com");
Anyone have any ideas?
Thanks
↧
Application.OpenURL not working as a Facebook Canvas Game?
I'm testing a web build of a game as a Facebook Canvas app, but once the game is on Facebook, all external links stop working. If I click a link, the game stops showing but the browser remains on the Facebook app page. The links work fine when playing in the Unity editor or as a published web game on my website, it's only once it's on Facebook that it stops working.
Is there an alternative to OpenURL, or something else I can try to get this working?
EDIT: I've got it working using -
Application.ExternalEval("window.open('http://www.google.com','_blank')");
but this opens in a new window/tab which is usually blocked on a browser. It does however at least work, you just get the popup prompt in the browser.
↧
Application.OpenURL not working
I'm trying to get my app to link to my other app using a popup. I have a UI button with the following code linked to its OnClick event:
public void PopupClick(){
Application.OpenURL ("https://play.google.com/store/apps/details?id=com.UltimateStudios.MuffinClicker");
}
I don't know why, but in the editor and on my android phone when I click the button it doesnt open the URL.
↧