Skip to main content
Inspiring
April 10, 2019
Answered

Air Android native extensions preserve other activity to be destroyed

  • April 10, 2019
  • 1 reply
  • 705 views

Hello,

I created an Air native extension on Android, I launch my other activity in the ane :

Context context = divExtContext.getActivity().getApplicationContext(); 

Intent myIntent = new Intent(context, OtherActivity.class); 

myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 

context.startActivity(myIntent);

if my app is in background and I click on the app buton or I launch a custom URI, my activity is destroyed.

I tried to add in the app descriptor android:launchMode="singleTop" :

<android>

  <manifestAdditions>

    <![CDATA[

      <manifest>

        <uses-permission android:name="android.permission.PERMISSION_NAME" />

        <application>

          <activity android:launchMode="singleTop">

            <intent-filter>

              <action android:name="android.intent.action.MAIN"/>

              <category android:name="android.intent.category.LAUNCHER"/>

            </intent-filter>

          </activity>

          <activity android:name="com.nativeExtensions.OtherActivity" android:theme="@android:style/Theme.Dialog"/>

        </application>

      </manifest>

    ]]>

  </manifestAdditions>

</android>

but when my app is in background and I click on the app buton or I launch a custom URI, my activity is not destroyed but I have a black screen.

Is there a workaround ?

Thanks

This topic has been closed for replies.
Correct answer pol2095

I find a workaround using singleInstance, it's necessary to reorder the activity.

1 reply

pol2095Author
Inspiring
April 13, 2019

You can vote for this bug here

pol2095AuthorCorrect answer
Inspiring
April 14, 2019

I find a workaround using singleInstance, it's necessary to reorder the activity.