java - Multiple Instances of Android Application open - ONLY on Touchwiz -


i have been working on application android devices - , have noticed perplexing issue occurs on devices running samsung touchwiz!

when application running on touchwiz device bug occurs. bug can reproduced pressing "back" button while application in foreground - , launching again home screen (or anywhere else icon may be). looking in multi-tasking menu clear system launches second instance of application! second instances totally independent first instance , 2 not seem connected in way.

i thought prevent behavior adding singleinstance applications manifest, did not appear trick. manifest:

  <application     android:allowbackup="true"     android:icon="@mipmap/ic_launcher"     android:label="@string/app_name"     android:supportsrtl="true"     android:theme="@style/apptheme"     android:launchmode="singleinstance">     <activity         android:name=".mainactivity"         android:screenorientation="portrait"         android:launchmode="singleinstance">          <intent-filter>             <action android:name="android.intent.action.main" />              <category android:name="android.intent.category.default" />         </intent-filter>      </activity>     <activity         android:name=".settings_area"         android:screenorientation="portrait" />     <!--          api key google maps-based apis defined string resource.          (see file "res/values/google_maps_api.xml").          note api key linked encryption key used sign apk.          need different api key each encryption key, including release key used          sign apk publishing.          can define keys debug , release targets in src/debug/ , src/release/.      -->     <meta-data         android:name="com.google.android.geo.api_key"         android:value="aizasydiextcafoil0kj_im4umbsql3snn92awm" />      <activity         android:name=".mapsactivity"         android:label="@string/title_activity_maps" />     <activity android:name=".splash"         android:launchmode="singleinstance">          <intent-filter>             <action android:name="android.intent.action.main" />              <category android:name="android.intent.category.launcher" />         </intent-filter>      </activity>     <activity android:name=".aboutpageactivity" />     <activity android:name=".turnofffromnotification"         android:nohistory="true"></activity> </application> 

it interesting note second instance "freezes" @ applications splash screen - until second instance clicked multi - tasking menu.

this how handling splash screen:

 new handler().postdelayed(new runnable(){         @override         public void run() {             /* create intent start menu-activity. */             intent mainintent = new intent(splash.this,mainactivity.class);             splash.this.startactivity(mainintent);             splash.this.finish();         }     }, splashdisplaylength); 

i over-rode buttons action in main activity:

public void onbackpressed() {     movetasktoback(true); } 

this bug only occurs on devices touchwiz. have tested application on several devices , bug not able reproduced on device except samsung devices running touchwiz.

any suggestions appreciated.

thank much!

the issue seems intent filters in mainactivity. remove intent filters mainactivity solve issue.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -