2014-02-21 28 views
0

在IOS中,我有2個應用程序(應用程序A和應用程序B)將執行不同的目標,但在1點時,應用程序A將使用uri方案調用應用程序B來執行功能,應用程序A沒有。Android應用程序在使用uri方案後打開錯誤的頁面

我想將這個功能實現到Android,並且目前已經開發了一個用於啓動對應用程序B的調用的演示。現在我正在研究將從演示應用程序接收uri方案的應用程序B.

問題:

後應用B返回到使用URI方案演示程序我關閉演示應用程序。 當我回到主頁,打開多任務(通過圖標或打開應用B)重新打開應用程序B,它重新打開頁面是用於演示應用程序,但我想要的是應用程序B的登錄頁面功能。

這是意圖過濾

<activity 
     android:name="com.apps.MasterActivity" 
     android:label="@string/app_name" 
     android:screenOrientation="portrait" 
     android:clearTaskOnLaunch="true" 
     android:windowSoftInputMode="adjustPan" > 

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

     <category android:name="android.intent.category.LAUNCHER" /> 
    </intent-filter> 
    <intent-filter> 
     <data 
      android:host="x-callback-url" 
      android:scheme="myapp" /> 

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

     <category android:name="android.intent.category.DEFAULT" /> 
     <category android:name="android.intent.category.BROWSABLE" /> 
    </intent-filter> 
</activity> 

艙單的一部分。這是我回電話給演示程序

Intent sendIntent = new Intent(Intent.ACTION_VIEW, responseUri); 
sendIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
finish(); 
startActivity(sendIntent); 

回答

0

顯然我找到了一個解決方案,可以強制應用程序在返回演示應用程序後顯示登錄頁面。通過把這個代碼在activity.java文件。

@SuppressWarnings("deprecation") 
@Override 
public void onDestroy() 
{ 
    super.onDestroy(); 
    System.runFinalizersOnExit(true); 
    System.exit(0); 
} 

我知道了,我使用,但會盡力解決這個問題時,有什麼問題在今後一個過時的功能或當我爲它找到一個更好的解決方案。

編輯: 找到一個更好的解決方案,不需要使用我已經忘記了其設置爲false棄用的功能。

我有一個標誌被設置爲true,當應用程序通過Uri Scheme連接時,我只需將其設置爲false並將其修復。這是我所做的更改位置

Intent sendIntent = new Intent(Intent.ACTION_VIEW, responseUri); 
sendIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
finish(); 
startActivity(sendIntent); 
Util.isUriScheme = false; 
0

嘗試增加這在AndroidManifest您的活動標籤.XML

android:clearTaskOnLaunch="true" 
+0

添加該行後仍然是相同的 –

相關問題