Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25363] Android: Intents should use ContentProvider

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-10-26T21:21:21.000+0000
Affected Version/sRelease 6.2.2
Fix Version/sRelease 6.3.0
ComponentsAndroid
Labelsconsider-6.2.3
ReporterGary Mathews
AssigneeGary Mathews
Created2017-10-02T21:39:38.000+0000
Updated2017-11-10T22:15:55.000+0000

Description

- As of Android 7.0, Intents should use a ContentProvider to provide the DATA URI of created Intents. *TEST CASE*
var extFile = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory, 'test.pdf'),
    openPDF = function(pdf) {
        Ti.Android.currentActivity.startActivity(
            Ti.Android.createIntent({
                action : Ti.Android.ACTION_VIEW,
                type : 'application/pdf',
                data : pdf.nativePath
            })
        );
    };

if (extFile.exists()) {
    openPDF(extFile);
} else {
    var httpClient = Titanium.Network.createHTTPClient({
        onload: function() {
            extFile.createFile();
            extFile.write(this.responseData);
            openPDF(extFile);
        }
    });
    httpClient.open('GET','https://github.com/mozilla/pdf.js/raw/master/examples/helloworld/helloworld.pdf');
    httpClient.send();
}

Comments

  1. Gary Mathews 2017-10-02

    master: https://github.com/appcelerator/titanium_mobile/pull/9500
  2. Gary Mathews 2017-10-03

    6_3_X: https://github.com/appcelerator/titanium_mobile/pull/9504
  3. Lokesh Choudhary 2017-10-04

    FR's passed, PR's merged.
  4. Raef Akehurst 2017-10-10

    Hi Guys. Not sure if I should bring this up here or add another JIRA task. The same issue applies in other areas. For example, when you attach a file to an email the same error occurs. (Interestingly, I could attach a file to an email using Android 7.0/7.1 but not Android 8.0). The same error appears in the logs as when trying to open a PDF. It looks like there are a handful of other occurrences throughout the source code that it might apply. Sorry, my Java skills are not up to fixing this myself. If possible it would be great to get this fixed at the same time as the PDF fix. :)
  5. Lokesh Choudhary 2017-10-18

    Verified the fix in SDK 7.0.0.v20171017155825 & 6.3.0.v20171017063048 Closing. Studio Ver: 4.10.0.201709271713 SDK Ver: 7.0.0.v20171017155825, 6.3.0.v20171017063048 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.10-2 Appc CLI: 6.3.0-master.14 Ti CLI Ver: 5.0.14 Alloy Ver: 1.10.5 Node Ver: 7.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Pixel --- Android 7.1.1 ⇨ google Nexus 5 --- Android 6.0.1
  6. Hans Knöchel 2017-10-25

    Reopening because of a regression reported by the community:
       var intent = Ti.Android.createIntent({
               action: Ti.Android.ACTION_DIAL,
               data: 'tel:01112223334'
       });
       Ti.Android.currentActivity.startActivity(intent);
       
    crashes with Message: Uncaught No Activity found to handle Intent
  7. Gary Mathews 2017-10-26

    master: https://github.com/appcelerator/titanium_mobile/pull/9559 6_3_X: https://github.com/appcelerator/titanium_mobile/pull/9560
  8. Lokesh Choudhary 2017-10-26

    FR passed for both master & backport PR. Waiting for merge to get enabled.
  9. Lokesh Choudhary 2017-10-31

    Verified the fix with SDK 6.3.0.v20171030135813. Studio Ver: 4.10.0.201709271713 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.10-2 Appc CLI: 6.3.0-master.15 Ti CLI Ver: 5.0.14 Alloy Ver: 1.10.6 Node Ver: 7.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 6P --- Android 8.0.0 ⇨ google Nexus 5 --- Android 6.0.1
  10. Lokesh Choudhary 2017-11-10

    Master PR merged. Closing.

JSON Source