2015-02-23 38 views
0

我遇到了一個奇怪的行爲。也許有人可以澄清它。 當我從GooglePlay下載我的應用時,會添加2個圖標。一個去主屏幕作爲一個快捷方式,另一個去App Drawer(我的設備上安裝了所有不同的已安裝應用程序的屏幕)。從HomeScreen(快捷方式)和應用程序抽屜啓動應用程序,是不一樣的

現在這裏是事件的流程:

  1. 我從GOOGLEPLAY安裝應用程序
  2. 我啓動的應用程序安裝完成後,也從GOOGLEPLAY(有一個開放的按鈕) - >這將啓動該應用程序顯示啓動畫面並進入我的主屏幕
  3. 我在我的應用程序中導航到不同的屏幕
  4. 我單擊主頁按鈕以轉到主屏幕。

現在最有趣的部分:

  • 我按下主屏幕快捷方式圖標GOOGLEPLAY創造了我要回我的應用程序 - >這需要我去完全相同的屏幕我在。
  • 我再次單擊主頁按鈕轉到主屏幕。
  • 這一次,我按下應用程序抽屜快捷方式圖標返回到我的應用程序 - >這再次顯示啓動畫面,並將我帶到我的主屏幕。
  • 這種情況經常發生。每個快捷方式啓動到不同的狀態(或屏幕)。 請注意,最近列表中只有一個應用程序。

    另一方面。如果我自己創建主屏幕快捷方式,當我從兩個圖標啓動應用程序時,我會得到相同的結果。 GooglePlay爲我創建的快捷方式有所不同。

    任何想法?

    編輯 這裏是AndroidManifest.xml中 哪裏改變一些名字。有些信息(即是不相關的意圖過濾器)已被刪除..

    <?xml version="1.0" encoding="utf-8"?> 
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" 
        xmlns:tools="http://schemas.android.com/tools" 
        package="com.xxxx.xxxxjh" 
        android:installLocation="internalOnly"> 
    
    <uses-permission android:name="android.permission.WAKE_LOCK" /> 
    <uses-permission android:name="android.permission.INTERNET" /> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
    <uses-permission android:name="android.permission.READ_CONTACTS" /> 
    <uses-permission android:name="com.android.vending.BILLING" /> 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 
    
    <application 
        tools:node="replace" 
        android:name=".xxxxgggApplication" 
        android:allowBackup="true" 
        android:icon="@drawable/icon" 
        android:label="@string/app_name" 
        android:largeHeap="true" 
        android:hardwareAccelerated="true" 
        android:theme="@style/AppTheme" > 
    
        <activity 
         android:name=".view.activities.StartupActivity" 
         android:theme="@style/AppThemeNoBar" 
         android:windojhoftInputMode="adjustResize|stateHidden"> 
         <intent-filter> 
          <action android:name="android.intent.action.MAIN" /> 
    
          <category android:name="android.intent.category.LAUNCHER" /> 
         </intent-filter> 
        </activity> 
    
        <activity 
         android:name=".view.activities.WelcomeActivity" 
         android:theme="@style/WelcomeActivityStyle"/> 
    
        <activity 
         android:name=".view.activities.AccountActivity" 
         android:theme="@style/AppThemeNoBar" 
         android:windojhoftInputMode="adjustResize|stateHidden"/> 
    
        <activity 
         android:name=".view.activities.UrlSchemeHandlerActivity" 
         android:launchMode="singleInstance"> 
         <intent-filter> 
          <action android:name="android.intent.action.VIEW" /> 
    
          <category android:name="android.intent.category.DEFAULT" /> 
          <category android:name="android.intent.category.BROWSABLE" /> 
    
          <data android:scheme="xxxx" /> 
         </intent-filter> 
         <intent-filter> 
          <action android:name="android.intent.action.VIEW" /> 
    
          <category android:name="android.intent.category.DEFAULT" /> 
          <category android:name="android.intent.category.BROWSABLE" /> 
    
          <data android:scheme="xxxx5.4" /> 
         </intent-filter> 
        </activity> 
    
    
        <activity 
         android:name=".view.activities.FileManagerActivity" 
         android:label="@string/app_name" 
         android:launchMode="singleTask" 
         android:logo="@drawable/fm_drawer" 
         android:theme="@style/AppThemeBar" 
         android:windojhoftInputMode="adjustPan|stateHidden"/> 
    
        <activity 
         android:name=".view.activities.ViewerActivity" 
         android:label="@string/launcher_activity_label" 
         android:theme="@style/AppThemeNoBar" 
         android:windojhoftInputMode="adjustResize|stateHidden" 
         android:parentActivityName=".view.activities.FileManagerActivity" > 
         <!-- The meta-data element is needed for versions lower than 4.1 --> 
         <meta-data 
          android:name="android.support.PARENT_ACTIVITY" 
          android:value=".view.activities.FileManagerActivity" /> 
        </activity> 
    
        <activity 
         android:name=".view.activities.DemoActivity" 
         android:label="@string/launcher_activity_label" 
         android:theme="@style/WelcomeActivityStyle" 
         android:windojhoftInputMode="adjustResize|stateHidden" /> 
    
        <activity 
         android:name=".view.activities.ApplicationSettingsActivity" 
         android:logo="@drawable/fm_drawer" 
         android:label="@string/AG_Settings" 
         android:windojhoftInputMode="adjustResize|stateHidden"> 
         <meta-data 
          android:name="android.support.PARENT_ACTIVITY" 
          android:value="com.xxxx.xxxxjh.view.activities.FileManagerActivity" /> 
    
        </activity> 
    
        <activity 
         android:name=".view.activities.WebViewActivity" 
         android:logo="@drawable/fm_drawer" 
         android:theme="@style/AppThemeBar" /> 
    
        <service android:name="com.xxxx.sdk.controller.service.account.AccountService" > 
         <!-- Actions and meta data goes here... --> 
        </service> 
        <service android:name="com.xxxx.sdk.controller.service.storage.StorageService"> 
         <!-- Actions and meta data goes here... --> 
        </service> 
        <service android:name="com.xxxx.sdk.controller.service.designFeed.DesignFeedService"> 
         <!-- Actions and meta data goes here... --> 
        </service> 
        <service android:name="com.xxxx.sdk.controller.service.ConfigService"> 
         <!-- Actions and meta data goes here... --> 
        </service> 
    
        <meta-data 
         android:name="com.google.android.gms.version" 
         android:value="@integer/google_play_services_version" /> 
    
    </application> 
    

    +0

    這似乎與您在清單文件中設置的意圖過濾器有關。如果您提供文件的內容,我會仔細看一下。 – 2015-02-23 16:50:33

    +0

    Dr. Dreave謝謝你的時間。我更新了問題並提供了清單。我不得不重新命名一些活動並刪除一些信息,但不是與意圖過濾器相關。感謝您的幫助! – 2015-02-24 08:36:08

    回答

    1

    我很遺憾地告訴你,這是不是在你的項目中的錯誤,但在Android的默認行爲。我做了一些研究,最終在以下線程中完成。也許你可以過濾出一些有用的信息,並在你的項目中測試這些方法。

    App completely restarting when launched by icon press in launcher

    Android application restarts when opened by clicking the application icon

    格爾茨。

    +0

    啊,我明白了。非常感謝你的幫助。 希望這個行爲最終將由Google解決。 – 2015-02-24 16:29:29

    相關問題