Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2914] Android: Intent data and type aren't correctly set

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T02:00:26.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M06
ComponentsAndroid
Labelsandroid, defect, intent, release-1.6.0, reported-1.6.0
ReporterMarshall Culpepper
AssigneeMarshall Culpepper
Created2011-04-15T03:32:47.000+0000
Updated2011-04-17T02:00:26.000+0000

Description

We're using set setData and setType for the data/type coming from the proxy, but each of they overwrite each other. If you have both data and type you're supposed to call setDataAndType.

Comments

  1. Marshall Culpepper 2011-04-15

    (from [0db802484cf4abc6b3a473c228e8f527667c8597]) setData() and setType() are mutually exclusive in the Intent API, we need to call setDataAndType() when both are supplied in the
    Intent proxy. Use the system's external storage API instead of
    hardcoding "/sdcard" [#2914 state:fixed-in-qa] [#2915 state:fixed-in-qa]
    https://github.com/appcelerator/titanium_mobile/commit/0db802484cf4abc6b3a473c228e8f527667c8597"> https://github.com/appcelerator/titanium_mobile/commit/0db802484cf4...

  2. Marshall Culpepper 2011-04-15

    Tested by using a PDF View intent:

       
       var xhr = Ti.Network.createHTTPClient();
       xhr.onload = function() {
           var f = Ti.Filesystem.getFile("appdata://test.pdf");
           f.write(this.responseData);
           var intent = Ti.Android.createIntent({
               action: Ti.Android.ACTION_VIEW,
               type: 'application/pdf',
               data: f.getNativePath()
           });
           Ti.Android.currentActivity.startActivity(intent);
       };
       
       xhr.open("GET", "http://www.appcelerator.com/assets/The_iPad_App_Wave.pdf");
       xhr.send();
       
  3. Opie Cyrus 2011-04-15

    verified droid2 2.2

JSON Source