Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2474] Calling Ti.Platform.openURL throws Unknown Java Exception

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-01-19T08:06:12.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandroid, defect, studio3
ReporterVan Thompson
AssigneeShak Hossain
Created2013-11-22T12:42:29.000+0000
Updated2016-03-08T07:41:31.000+0000

Description

I am just trying to open a browser using the following command: Ti.Platform.openURL("http://www.google.com"); Really nothing fancy. I've tried without 'http' and with different URLs. This happens on the emulator and a device. I've tried with Android 4.0.3 and 4.2 with the same result.

Attachments

FileDateSize
openURL.PNG2013-11-22T12:42:29.000+000091996
stack.PNG2013-11-22T15:25:15.000+00009489
studioStack.PNG2013-11-22T16:17:28.000+000035819
Titanium openURL problem.docx2013-12-16T20:23:11.000+0000226960

Comments

  1. Van Thompson 2013-11-22

    More information: If I put Ti.Platform.openURL on my first window, it works as expected. I placed the same code on the second window in the app and I get the Unknown Java exception.
  2. Mauro Parra-Miranda 2013-11-22

    Hello, as you mentioned, when we test, it just works. Please share with us the structure of your code or similar, so we can reproduce this. Best, Mauro
  3. Van Thompson 2013-11-26

    I've uploaded the code without images. The offending line is on controller/OrdersController.js line 32.
  4. Mauro Parra-Miranda 2013-12-10

    Hello, I'm testing your code and: - We don't have any login/user. - In the line before the openURL, you are building a url with a local prefix for a maps app, right? Did you tried to open that one directly in the browser or similar to see if that's the problem? - Please add a try-catch so you can get more info on what failed in the openURL. Your app is not suitable to be used as testcase, because of its complexity. If possible, please remove it from this ticket, since you have a lot of information that looks like is private, and this is a public forum. Best, Mauro
  5. Van Thompson 2013-12-11

    I have removed the source code. I've tried a simple url such as http://www.google.com with the same result (as shown in 'openURL.png'). Any stack trace info I was able to retrieve is in the other two images I posted. I also built the url, copied it, and pasted it into a browser. It loaded fine.
  6. Van Thompson 2013-12-11

    One other thing...I get the same error when my URL is a telephone number (tel://7705551212).
  7. Mauro Parra-Miranda 2013-12-11

    Hello Van, if you create a simple testcase with Titanium, and use the openURL, are you able to reproduce the issue? i.e., is it a windows 8 focused issue? If that doesn't fail for you, then is something else in your code, but let's test the above sample and then we decide how to proceed on this. Thanks! Best, Mauro
  8. Van Thompson 2013-12-11

    Mauro I did that as well and it's hit or miss. I've placed code on the first window of the app that opens google via openURL. I proceeded to the next window and did the same. It worked. I can't find a rhyme or reason for it. Initially I thought it had something to do with the code being in a custom event but I tried that as well. I will try a few other simple scenarios. Thanks Van
  9. Van Thompson 2013-12-16

    Mauro I've attached a document containing the results of adding very simple buttons that attempt to open google.com using Ti.Platform.openURL('http://www.google.com'). I hope it will be helpful. Thanks Van
  10. Mostafizur Rahman 2013-12-22

    We tried to reproduce this issue with the code below. We can't reproduce this problem with latest 3.2.0 GA release. Please try this sample code and let us know if the issue persists.

    Testing Environment:

    Android SDK: 4.2.2 Titanium SDK: 3.2.0.GA Titanium CLI Version: 3.2.0

    Test Code

        var win = Ti.UI.createWindow({
        		title : 'URL TEST',
        		navBarHidden : false
        	});
         
        	// Create a Button.
        	var go = Ti.UI.createButton({
        		title : 'URL TEST',
        		height : Ti.UI.SIZE,
        		width : Ti.UI.SIZE,
        		top : 10,
         
        	});
         
        	// Listen for click events.
        	go.addEventListener('click', function() {
         
        		Ti.Platform.openURL("http://www.google.com");
         
        	});
         
        	win.add(go);
        	win.open();
        
        

    Steps to Test:

    1. Create a sample project, 2. Paste this code in app.js file. 3. Run this with testing environment. 4. Click on URL test button
  11. Van Thompson 2013-12-23

    I will do this, however, I have already done something similar and the code does work. I have placed similar code in the app in question and have seen openURL work as expected (see 'Titanium openURL problem.docx' attachment). The problem is I still get the previously reported java exception. I fully acknowledge it has something to do with my application, however, I do not believe the exception is being thrown because of the way I am calling openURL. I updated to 3.2.0.GA today hoping it would fix the issue. No luck.
  12. Ritu Agrawal 2013-12-25

    [~vandert] We have been unable to reproduce this issue with numerous permutations. We need a minimal but complete test case that can reproduce this issue. We would be happy to investigate this issue further once we have a reproducible test.
  13. Shak Hossain 2014-01-27

    Closing since we can't reproduce the issue with our sample and the reporter has not provided a sample to reproduce the error.

JSON Source