2012-07-11 64 views
3

我有2个应用程序:使用一个apk安装两个应用程序

1 - ContentProvider;

2 - 使用此ContentProvider的应用程序。

我需要使用单个apk文件安装这2个应用程序。我想在Eclipse中同时推送这两个应用程序,如果我添加到一个应用程序的另一个项目的构建路径,并在清单中添加几行。是否可以使用一个apk同时安装两个应用程序(其中一个是ContentProvider)?

+0

你能详细说明你的要求吗? – sunil 2012-07-11 10:59:08

+0

这是不可能的.. – 2012-07-11 11:28:32

回答

2

是否可以使用一个apk同时安装两个应用程序(其中一个是ContentProvider)?

不,对不起。

2

您可以在一个manifest.xml中定义多个活动,服务等。因此,如果您要将两个应用程序都移动到一个项目中,然后将它们都添加到清单中,则可以在一个apk中安装多个应用程序。

在这里寻找有关清单的详细信息:http://developer.android.com/guide/topics/manifest/manifest-intro.html

然而,正如已经指出的那样,只能出现一次,应用标签。

1

是的,可以在一个API中安装两个应用程序(内部活动)。

延伸到dac2009的答案..

这里是一个示例清单文件,做这个。

`<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.dualapp" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk 
     android:minSdkVersion="8" 
     android:targetSdkVersion="19" /> 

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name_people" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name="com.example.dualapp.MeetPeopleActivity" 
      android:icon="@drawable/ic_launcher" 
      android:label="@string/app_name_people" 
      android:taskAffinity="com.example.dualapp.MeetPeopleActivity" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 

     <activity 
      android:name="com.example.dualapp.MeetTechieActivity" 
      android:icon="@drawable/ic_tech" 
      android:label="@string/app_name_techie" 
      android:taskAffinity="com.example.dualapp.MeetTechieActivity" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 

    </application> 

</manifest>` 

安装时会在手机中放置两个应用程序图标。

相关问题