开发者

Android application packaging

I have two android applications- A and B.

I'm trying to package them as a single unit so that upon installation the system installs both apps. However, I could not find any reliable ans开发者_StackOverflow中文版wer till now.

In A's manifest file I added activity tag of B, resulting in error.

Could anyone guide me on how to package two applications as a single unit?

Thanks in advance!


I do not believe this is possible. An APK corresponds to a single AndroidManifest.xml which corresponds to a single Application.

However, if you want mulitple "launchers" or icons, it is possible by exposing multiple Activities by adding IntentFilters to the ones you want (which take the launcher event). However, they are still, technically, a single application.

Update: Here's how to expose multiple Activities. The main activity would have something similar in the AndroidManifest.xml

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

Copy-paste this inside the other Activities you want to expose. For example:

<activity 
        android:name="com.example.app.FirstActivity" 
        android:label="@string/first_app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
<activity 
        android:name="com.example.app.SecondActivity" 
        android:label="@string/second_app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜