如何在PhoneGap应用启动时启动一个Android活动?

4
我创建了一个MainActivity类,它继承自Activity(也尝试过继承CordovaActivity),希望在PhoneGap应用启动时立即显示此活动。问题是,无论我尝试在各种配置文件中进行调整,清单文件都会被部分覆盖,并且会显示加载www\index.html的Webview。
我可能不需要这个应用程序的原始PhoneGap功能,但我想使用build.phonegap.com构建和部署它。
重写Cordova Webview类以使其在新意图中启动我的活动可能是一个解决方案,但肯定有另一种(配置)方法来解决这个问题?
AndroidManifest.xml(在build.phonegap.com之前):
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="1.0.0" android:windowSoftInputMode="adjustPan" package="com.mystuff.myapp" xmlns:android="http://schemas.android.com/apk/res/android">
        <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
        <uses-permission android:name="android.permission.INTERNET" />
        <application android:allowBackup="true" android:debuggable="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
            <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="com.mystuff.myapp.MainActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
        <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
    </manifest>

AndroidManifest.xml (在 build.phonegap.com 后,在 ManifestViewer 上的手机上):

<?xml version="1.0" encoding="utf-8"?>
    <manifest
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:versionCode="42"
        android:versionName="1.0.0"
        android:windowSoftInputMode="stateUnspecified|adjustPan"
        android:installLocation="auto"
        package="com.mystuff.myapp">
        <supports-screens
            android:anyDensity="true"
            android:smallScreens="true"
            android:normalScreens="true"
            android:largeScreens="true"
            android:resizeable="true"
            android:xlargeScreens="true"/>
        <uses-permission
            android:name="android.permission.INTERNET"/>
        <uses-permission
            android:name="android.permission.ACCESS_NETWORK_STATE"/>
        <application
            android:label="@2130968576"
            android:icon="@2130837504"
            android:debuggable="true"
            android:hardwareAccelerated="true">
            <activity
                android:label="@2130968576"
                android:name=".MyApp"
                android:screenOrientation="unspecified"
                android:configChanges="locale|keyboard|keyboardHidden|orientation|screenSize"
                android:windowSoftInputMode="stateUnspecified|adjustUnspecified">
                <intent-filter>
                    <action
                        android:name="android.intent.action.MAIN"/>
                    <category
                        android:name="android.intent.category.LAUNCHER"/>
                </intent-filter>
            </activity>
            <activity
                android:label="@2130968576"
                android:name="com.phonegap.DroidGap">
                <intent-filter/>
            </activity>
        </application>
        <uses-sdk
            android:minSdkVersion="7"/>
    </manifest>
网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接