Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1343] Android intent filter not receiving file data

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionInvalid
Resolution Date2017-03-07T22:44:23.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK
Labelsn/a
ReporterIvan Skugor
AssigneeBruce Wayne
Created2015-12-10T11:57:05.000+0000
Updated2018-03-07T22:28:25.000+0000

Description

Hi. I'm having weird issue when trying to share file with my app. I used code from Ti docs and it works fine with classical Ti app, but when I try to use it with Alloy, app receives no file data. The problem can be seen if app is running, if app is shut down before sharing, it works fine. To see this issue, download this zip file: https://drive.google.com/file/d/0B3_U6pYkC0P6andCTUdUdGFGZ1E/view?usp=sharing There are two projects in there, one is classical Ti, the other is Alloy project. Run project and install app on device (ti build -p android -T device) and then try to share image with installed app (go to Photos app, press Share icon and pick installed app). Try to do the same with classical app. You'll see that, if installed app is put in the background, share does not work with Alloy app. And if you check out source code, you'll see code is virtually identical, therefore that should work in both cases.

Comments

  1. Sharif AbuDarda 2015-12-14

    Hello [~ivan.skugor], Use the below code for alloy
       index.js
       
       function oopen() {
       	var intent = Ti.Android.currentActivity.getIntent();
       	var iname = Ti.Android.EXTRA_STREAM;
       	if (intent && intent.hasExtra(iname)) {
       		// Create ImageView from TiBlob
       		var blob = intent.getBlobExtra(iname);
       		$.win.add(Ti.UI.createImageView({
       			image: blob,
       			height: 300,
       			width: 300,
       			left: 0,
       			top: 0
       		}));
       	} else {
       		Ti.API.info('No extra named "' + iname + '" found in Intent ...');
       	}
       };
       
       $.win.open();
       
       
       index.xml
       
       <Alloy>
       	<Window id="win" onOpen="oopen"></Window>
       </Alloy>
       
       
    I have tested it and it works. Thanks.
  2. Ivan Skugor 2015-12-14

    Hi Sharif AbuDarda. I tried your code but it doesn't work (tried on two Android devices and it doesn't work on both). Think you didn't follow steps to reproduce the issue. So, your app has to run, do not close it before trying to share image. 1) Run app on device 2) Minimise app so it runs in the background (don't push Back button to close it) 3) Go to Photos app and try to share image
  3. Feon Sua Xin Miao 2017-03-07

    The Alloy example should be getting the intent of the root activity: var intent = Ti.App.Android.launchIntent;
  4. Eric Merriman 2018-03-07

    Closing as invalid. If this is incorrect, please reopen.

JSON Source