i am working on the project named AutoUpdate with package name:com.example. and the apk i am having in my sd card also having same package name :com.example this is my method which is called for instaling the apk.the apk file is in sd card.my code is as:
private void installMarketApk() {
// TODO Auto-generated method stub
String fileName = Environment.getExternalStorageDirectory() + "/myapp.apk";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive");
startActivity(intent);
}
my manifest file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name="com.custom.activity.mspresentation.AutoUpdateDemoActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
when i run this application i am prompted to Replace application dialog "The application you are trying will replace another another application".so i just click ok for installing application.
now i got do you want to install this application .this will change to :
1.Storage
2.network communication
3.phone calls
.......
with install and cancel options.
now i choose install,a progress bar appears with initialising and APPLICATION NOT INSTALLED.
if i have to give some permissions in manifest file?
ANY SUGGESTION ?