Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27862] Android: Add callback support to Ti.Platform.openURL()

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2020-07-29T21:07:46.000+0000
Affected Version/sn/a
Fix Version/sRelease 9.1.0
ComponentsAndroid
Labelsandroid, callback, openUrl, parity
ReporterJoshua Quick
AssigneeJoshua Quick
Created2020-04-22T00:29:23.000+0000
Updated2020-07-29T21:07:46.000+0000

Description

*Summary:* On Android, the Ti.Platform.openURL() method only supports the URL argument. The 2 optional arguments, "options" dictionary and callback, are ignored and only supported on iOS. https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Platform-method-openURL We should add support for the callback argument for consistency with iOS.
// Add support for the callback argument.
var result = Ti.Platform.openURL("https://www.google.com", function(e) {
	Ti.API.info("### openURL() callback event.success: " + e.success);
});

// We should still support returned boolean for backward compatibility.
Ti.API.info("### openURL() returned: " + result);
*Note:* The "options" dictionary should continue to be ignored since it only supports iOS settings. Meaning that the below should work on Android without issue.
var result = Ti.Platform.openURL("https://www.google.com", {/* Ignore Me */}, function(e) {
	Ti.API.info("### openURL() callback event.success: " + e.success);
});

Comments

  1. Joshua Quick 2020-04-29

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/11668
  2. Satyam Sekhri 2020-05-13

    FR Passed
  3. Satyam Sekhri 2020-07-29

    Verified on: Mac OS: 10.15.4 SDK: 9.1.0.v20200727104531 Appc CLI: 8.1.0-master.7 JDK: 11.0.4 Node: 10.17.0 Studio: 6.0.0.202005141803 Device: Pixel3(v10.0) emulator

JSON Source