App not starting properly when invoked on Android

Hi all, hoping someone has had experience using the Invoke event to add their app as a “share” target on Android.

The Air app I’m building receives text from other apps on the android device via the “share” functionality. It works from some apps, but in others it will only work if there’s not currently an open instance running. In this case, it seems to invoke my Air app and brings it to focus but it displays a blank screen in it’s default colour (that is, not the stage colour, but the default colour set in the android specification of the app).

I’m using Air 33.1 (currently the latest):

<manifest android:installLocation="auto">
    <uses-sdk android:minSdkVersion="8"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>
             <intent-filter  android:launchMode="singleInstance">
                 <action android:name="android.intent.action.MAIN"/>
                 <category android:name="android.intent.category.LAUNCHER"/>
             <intent-filter  android:launchMode="singleInstance">
                   <action android:name="android.intent.action.SEND" />
                    <category android:name="android.intent.category.DEFAULT" />
                    <data android:mimeType="text/plain" />

I’ve tried variations of the android:launchMode attribute, and none of them seem to make a difference. I did read that the “invoking” app can override this setting, which is why I think it’s working from some apps and not others (the ones where it doesn’t work perhaps have a launchMode setting that is taking precedence). It’s just a hunch.

I’m also wondering if it’s something to do with the Harman splash screen that’s blocking the app-proper from loading in this particular scenario.

I’ve tried this with a stripped down app that has nothing in it, I’m merely setting the stage.color value in the document class constructor. When the app loads standalone, or when invoked without any other running instances I see the stage colour change. In the situations where it’s not loading properly, the stage colour does not change. This is a much simplified functionality to what my actual app does and the behaviour is that same.

Has anyone else come across this issue? Am I missing something obvious?

launch mode needs to be on the activity not the intent-filter, I’ve used singleTask like this before:

    <activity android:launchMode="singleTask">

Thanks Michael, oops, yes I had it in the wrong place in that example but I’m getting the same results if I place it where it should be on the Activity tag :frowning:

FWIW - The app that’s giving me the issue is the Real Estate dot Com app.

UPDATE: I purchased a licence from Harman and the problem still persists. That casts doubt on their splash screen being the issue…

REQUEST: If anyone has an Adobe Air app on Android that receives text Share/Send intents, could you please add a link to your app so I can install and test for the same behaviour?

What about changing minSdkVersion?
8 is too low today I think.

Unfortunately that didn’t seem to make a difference, here’s the complete updated application descriptor file:

<?xml version="1.0" encoding="utf-8" ?> 
<application xmlns="">
			<manifest android:installLocation="auto">
			  <uses-sdk android:minSdkVersion="24" android:targetSdkVersion="28" />
				<uses-permission android:name="android.permission.INTERNET"/>
				<uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>
            <activity android:launchMode="singleTask" >
                <intent-filter  >
                    <action android:name="android.intent.action.MAIN"/>
                    <category android:name="android.intent.category.LAUNCHER"/>
                <intent-filter >
                      <action android:name="android.intent.action.SEND" />
                       <category android:name="android.intent.category.DEFAULT" />
                       <data android:mimeType="text/plain" />

				<!-- iPhone support -->
				<!-- iPad support -->
		<!--<depthAndStencil>true</depthAndStencil>--> <!-- required for 3D -->

For interest’s sake, here’s the complete document class being used to test:

package {
	import flash.desktop.NativeApplication;
	import flash.display.MovieClip;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.ui.Multitouch;
	import flash.ui.MultitouchInputMode;

	public class Main extends MovieClip {
		public function Main() {
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			stage.addEventListener(Event.DEACTIVATE, deactivate);
			// touch or gesture?
			Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
			// Entry point
			stage.color = 0xff0000
			NativeApplication.nativeApplication.autoExit = false
			NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, doInvoke)
		private function doInvoke(e:InvokeEvent):void {
			var myApplication:NativeApplication = NativeApplication.nativeApplication
			stage.color = 0x0000ff
		private function doActivate(e:Event):void {
			stage.color = 0x00ff00
		private function deactivate(e:Event):void {		
			NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, doActivate)


What’s interesting is that from previous tests I can tell that actionscript is still running when switching back. I can receive trace outputs added to an onEnterFrame event - it appears that the stage is just not being displayed. This also makes sense as to why the default colour set for the app is displaying, rather than the stage background colour.

You know, in fact, I have the same behavior in my games (didn’t pay much attention to it, but received several 1-star reviews, so, it’s time to fix it).

Here is the sequence of actions.
Open the game
Press “Power off” button on the phone to switch the screen off
Press “Power off” button on the phone to switch the screen on. Phone’s welcome screen appears.
Swipe the welcome screen away.
Game should have appeared, but in fact the black screen is showing. The game is running (we can hear the sounds of button presses)
If we press “Home” button on the phone, and then launch the game again from the tasks list, it shows well.

The same, if we just leave the phone till it switches its screen off, after reopening the phone the game will show black screen.

This problem exists on Samsung A30s (Android 10), but does not exist on Samsung Galaxy S6 (x64, Android 7.0) or Amazon Fire HD 10 7th Gen (x32, Fire OS ~ Android 5.1)

Air version to build the game is
UPD: the problem persists even if we use the newest AIR,

Manifest additions:

		<manifest android:installLocation="auto">
		  <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="29"/>
			<uses-permission android:name="android.permission.INTERNET" />
			<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
				<!-- this lets you support devices larger than 16:9 ratio -->
				<meta-data android:name="android.max_aspect" android:value="2.17" />


I also thought that it might be Starling problem (I use Starling 2.6), but as your app does not use Starling, this possibility was ruled out

I checked some games which as I know were built with AIR, and here’s where the problem exists:
Polytopia - yes
Grow Cube - no (however, on the start there is a warning that the game was build for older Android version). Last game’s update was in 2016
Castle Clicker - yes
Ancient Planet - yes
Moto X3M Bike - no (however, the game has forced landscape orientation, this might be a reason. After several tries once I managed to get black screen in this game, too)
Handless Millionaire 2 - yes (and it is LandScape!)

I know the devs of the last 3 games, hopefully, we will define, what causes this behavior and how to fix it. And will provide a detailed report to Harman, if the fix is needed from that side.

UPD: Tried to set portrait in my game - the problem persists. So, speaking with Moto X3M Bike dev should have the key to the fix

Hi Airrapport, interesting. It might be related but I’m not sure it’s the same problem. If I follow your steps with the bare bones example I’ve posted the code for, I don’t get the issue you speak of. Could you compile the document class and descriptor file I’ve copy/pasted above and confirm?

You should see a primarily blue, red or green screen. This is the stage colour which is being set on different events. If it’s black or a sort of desaturated blue then that means the stage isn’t showing.

Following your steps above I can always see the stage colour.

@Airapport sounds like the black screen issue:

HI Michael - I’m guessing the Application class is from some additional library? I’m not using Starling or any ANE’s, would this help in my above example? What library/package would I need to include?

That is the reference documentation for the Application ANE

Ahh ok gotcha - would this be relevant only for a Starling app or an app that uses direct/gpu mode (as opposed to cpu mode)?

Yes, mine (and the developer who I asked) are using Starling, so, I guess, there are 2 different cases. Still, I’ll try your build on my A30s and will tell you the results.

Hi Airapport - be really keen to see if you see the same behaviour.

I tested an AIR app without Starling on A30s - the back screen still appeared. The developers of Moto X3M Bike (the only AIR game which does not have this issue) say that they used BlackScreenHelper function from