제가 궁극적으로 구현하고 싶은 기능은 다음과 같습니다.


1. a.apk와 b.apk가 있습니다.

2. a.apk를 설치합니다.

3. a.apk 설치가 완료되었으면 b.apk를 설치합니다.


제가 구현하고 싶은 기능은 3번 과정의 a.apk 설치가 완료 되었음을 인식하고자 하는 것 입니다.


다음은 a.apk에 해당하는 apps의 AndroidManifest.xml 입니다.

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"		package="com.inervit.test"		android:versionCode="1"		android:versionName="1.0">
	<uses-sdk android:minSdkVersion="8"/>
	<uses-permission android:name="android.permission.BROADCAST_PACKAGE_REMOVED"/>
	<uses-permission android:name="android.permission.DELETE_PACKAGES"/>
	<uses-permission android:name="android.permission.INSTALL_PACKAGES"/>
	<application android:icon="@drawable/icon"		android:label="@string/app_name">
		<receiver android:name=".InstallRecev" >
			<intent-filter>
				<action android:name="android.intent.action.PACKAGE_ADDED" />
				<action android:name="android.intent.action.PACKAGE_INSTALL"/>
				<action android:name="android.intent.action.PACKAGE_REMOVED"/>
				<action android:name="android.intent.action.PACKAGE_REPLACED"/>
				<data android:scheme="package" />
			</intent-filter>
		</receiver>
	</application>
</manifest>


그리고 다음 코드는 a.apk에 대당하는 Receiver 코드 입니다.

 

package com.inervit.test;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;
public class InstallRecev extends BroadcastReceiver  {	@Override	public void onReceive(Context mCont, Intent intent) {   
		Log.d("TEST", "Receive Data");
		String action = intent.getAction();
		Toast.makeText(mCont, "action => " + action, Toast.LENGTH_LONG).show();
		final String packageName = intent.getData().getSchemeSpecificPart();


		Toast.makeText(mCont, "Package Name => " + packageName, Toast.LENGTH_LONG).show();


		if (action.equals(Intent.ACTION_PACKAGE_INSTALL)) {
			Toast.makeText(mCont, "Intent.ACTION_PACKAGE_INSTALL => " + Intent.ACTION_PACKAGE_INSTALL, Toast.LENGTH_LONG).show();
		}else if(action.equals(Intent.ACTION_PACKAGE_ADDED)){
			Toast.makeText(mCont, "Intent.ACTION_PACKAGE_ADDED => " + Intent.ACTION_PACKAGE_ADDED, Toast.LENGTH_LONG).show();
		}else if(action.equals(Intent.ACTION_PACKAGE_REMOVED)){
			Toast.makeText(mCont, "Intent.ACTION_PACKAGE_REMOVED => " + Intent.ACTION_PACKAGE_REMOVED, Toast.LENGTH_LONG).show();
		}else if(action.equals(Intent.ACTION_PACKAGE_REPLACED)){
			Toast.makeText(mCont, "Intent.ACTION_PACKAGE_REPLACED => " + Intent.ACTION_PACKAGE_REPLACED, Toast.LENGTH_LONG).show();
		}
	}
}



이와 같이 구현을 하였습니다.

그런데, 설치가 완료 되었는데도 Toast도 화면에 안 나오고, Logcat으로도 아무것도 출력이 되지 않네요.


그래서 혹시 자기 자신의 설치/삭제 여부에 대해서는 인식 못하는 것 아닌가? 싶어서 새로운 apps도 설치해보았지만, 마찬가지로 인식이 되질 않습니다.


혹시 원인이 뭔지? 또는 다른 좋은 방법은 뭔지? 알수 있을까요?


신한 카드 Apps의 경우는 V3 Apps를 asset Folder에 Copy해 두고, 신한 카드 Apps 설치가 완료 되면 자동으로 V3 Apss를 설치하던데, 이와 같이 구현할 수 있는 방법이 무엇인지요?


고수님들의 답변 기다리겠습니다.


감사합니다.