禁用应用的多个实例

时间:2018-01-03 16:01:33

标签: android android-activity single-instance

我的原生Android应用程序在某些手机上有多个实例(三星galaxy note 2 - android 5.0三星galaxy note 4 - android xx小米Redmi 4x - android 7.1.2。)。在其他大多数手机上都可以。该应用程序消耗了大量的内存和CPU,因此我不能运行多个实例,否则它很慢。

我尝试使用android:launchMode =" singleInstance"在我的每个活动的清单中。但这没有帮助。我附上了Manifest文件和截图。

如果你能帮助我,我会很高兴的。欢呼声。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pekostudio.dogtrace">

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

<uses-feature android:name="android.hardware.location.gps" />
<uses-feature android:name="android.hardware.bluetooth_le" />

<application
    android:allowBackup="true"
    android:hardwareAccelerated="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:roundIcon="@mipmap/ic_launcher"
    android:supportsRtl="true"
    android:launchMode="singleInstance"
    android:resizeableActivity="false"
    android:theme="@style/AppTheme">

    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key" />

    <receiver
        android:name=".Bluetooth.GetAllCollarsService$GetRawBluetoothDataReceiver"
        android:enabled="true">
        <intent-filter>
            <action android:name="pekostudio.dogtrace.BLUETOOTH_RAW_DATA" />
        </intent-filter>
    </receiver>

    <service
        android:name=".Utils.LocationFinder"
        android:exported="false" />
    <service
        android:name=".Bluetooth.GetAllCollarsService"
        android:exported="false" />

    <service
        android:name=".Bluetooth.BluetoothLeService"
        android:enabled="true"
        android:stopWithTask="true" />

    <service
        android:name=".MapDownload.DownloadService"
        android:enabled="true"
        android:exported="true" />

    <activity
        android:name=".Activities.GoogleMapActivity"
        android:configChanges="orientation"
        android:label="@string/app_name"
        android:launchMode="singleInstance"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />

    <activity
        android:name=".Activities.SplashActivity"
        android:configChanges="orientation"
        android:screenOrientation="portrait"
        android:theme="@style/SplashTheme"
        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=".Activities.OfflineMap"
        android:configChanges="orientation"
        android:launchMode="singleInstance"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />

    <activity
        android:name=".Activities.CompassActivity"
        android:configChanges="orientation"
        android:launchMode="singleInstance"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />

    <activity
        android:name=".Activities.AnimalDetailActivity"
        android:configChanges="orientation"
        android:launchMode="singleInstance"
        android:parentActivityName=".Activities.GoogleMapActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"/>

    <activity
        android:name=".Activities.SettingsActivity"
        android:configChanges="orientation"
        android:launchMode="singleInstance"
        android:parentActivityName=".Activities.GoogleMapActivity"
        android:screenOrientation="portrait">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="pekostudio.dogtrace.Activities.GoogleMapActivity" />
    </activity>

    <activity
        android:name=".Activities.EditAnimalsActivity"
        android:configChanges="orientation"
        android:launchMode="singleInstance"
        android:screenOrientation="portrait" />

    <activity
        android:name=".Activities.EditAnimalActivity"
        android:configChanges="orientation"
        android:launchMode="singleInstance"
        android:screenOrientation="portrait" />

    <activity
        android:name=".Activities.DeviceScanActivity"
        android:configChanges="orientation"
        android:screenOrientation="portrait"
        android:launchMode="singleInstance"
        android:theme="@style/AppTheme.NoActionBar" />

    <activity android:name=".Activities.AvailableMapsListActivity"
        android:configChanges="orientation"
        android:launchMode="singleInstance"
        android:screenOrientation="portrait"/>

    <activity android:name=".Activities.AboutActivity"
        android:configChanges="orientation"
        android:launchMode="singleInstance"
        android:screenOrientation="portrait"/>

    <activity android:name=".Activities.CalibrateActivity"
        android:configChanges="orientation"
        android:launchMode="singleInstance"
        android:screenOrientation="portrait"/>

    <activity
        android:name=".Activities.MapMarkerPreview"
        android:configChanges="orientation"
        android:launchMode="singleInstance"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />

</application>

0 个答案:

没有答案