[TIMOB-25363] Android: Intents should use ContentProvider
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-10-26T21:21:21.000+0000 |
Affected Version/s | Release 6.2.2 |
Fix Version/s | Release 6.3.0 |
Components | Android |
Labels | consider-6.2.3 |
Reporter | Gary Mathews |
Assignee | Gary Mathews |
Created | 2017-10-02T21:39:38.000+0000 |
Updated | 2017-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();
}
master: https://github.com/appcelerator/titanium_mobile/pull/9500
6_3_X: https://github.com/appcelerator/titanium_mobile/pull/9504
FR's passed, PR's merged.
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. :)
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
Reopening because of a regression reported by the community:
crashes with
Message: Uncaught No Activity found to handle Intent
master: https://github.com/appcelerator/titanium_mobile/pull/9559 6_3_X: https://github.com/appcelerator/titanium_mobile/pull/9560
FR passed for both master & backport PR. Waiting for merge to get enabled.
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
Master PR merged. Closing.