Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4454] Android: Ti.App.getArguments() returns empty string

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionWon't Do
Resolution Date2020-01-09T19:12:45.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterPaul Dowsett
AssigneeEric Merriman
Created2011-06-18T16:13:26.000+0000
Updated2020-01-09T19:12:45.000+0000

Description

As reported by [this user in the Q&A](http://developer.appcelerator.com/question/121261/getarguments-returns-empty-string-on-android) and demonstrated in the following code, Ti.App.getArguments() returns an empty string.
var args = Ti.App.getArguments();
Ti.API.debug('args is: ' + args);
Ti.API.debug('stringified args is: ' + JSON.stringify(args));

var win = Ti.UI.createWindow({
	backgroundColor : "blue",
	exitOnClose:true
});

win.open();

Comments

  1. asghar ali 2011-09-06

    any updates..
  2. Y M 2011-10-01

    are there any work-arounds to this? or a fix locally?
  3. Don Thorp 2011-10-02

    This is a carry over API from Desktop. It needs to be removed from the API on mobile. No arguments can be passed to a mobile application at launch.
  4. Y M 2011-10-02

    Thanks for the quick update, Don. However, this feature works in Appcelerator apps on iOS without issues (please do not remove it!!). Android also supports this feature natively through Intents, viz., getIntent().getData() returns the URI that started the current activity, which can be parsed to retrieve the parameters. Removing this API would severely affect user experience, in that the ability to launch an app from a browser with a specific action request would not be available. Please reconsider. Cheers. YM
  5. Y M 2011-10-02

    Also, Don, please see the question posted in the Q&A for more details. Link is in the bug report above. Thanks.
  6. Jerod Fritz 2011-11-01

    On Android I was able to get launch parameters read using code below but as of release 1.7.3 this no longer works:
       var currActivity = Titanium.Android.currentActivity;
       var myIntent = currActivity.getIntent();
       var cmd = myIntent.getData();
       
    That code now throws an exception on getData() because the currActivity.getIntent() returns null . Is this something that can be looked at?
  7. Tim Poulsen 2013-03-14

    Old ticket, but I just came across it. This works for me:
       var activity = Ti.Android.currentActivity;
       activity.addEventListener("create", function(e) {
         var args = activity.getIntent().getData();
       }
       
  8. Shannon Hicks 2014-06-26

    @ingo you can close this one
  9. Ingo Muschenetz 2014-06-27

    Should I be marking this "fixed"? If so, against which version?
  10. Shannon Hicks 2014-06-27

    wontfix.... the ticket is that Ti.App.getArguments() doesn't work on android. In reality, it's iOS only: http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.App-method-getArguments On android, you use Ti.Android.Intent.getData().
  11. Ingo Muschenetz 2014-09-09

    Should we make Ti.App.getArguments() on Android call Ti.Android.Intent.getData()? Is there a reasonable cross-platform API we could promote?
  12. Shannon Hicks 2014-09-09

    I don't think that a symbolic-link from one method to another is a good idea. Perhaps deprecating Ti.App.getArguments() and moving it to Ti.iOS namespace is a better option?
  13. Ingo Muschenetz 2014-09-09

    Well, it doesn't have to be a symbolic link. It could be a new API. But I'm trying to get cross-platform parity where reasonable, and perhaps this is a place.
  14. Alan Hutton 2020-01-09

    It has been decided that this issue should be closed as “Won’t do.” This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. Updating, or creating code may not reproduce the issue reported, or be a valid test case. If community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.

JSON Source