コード:
setContentView(R.layout.splashscreen);
Thread timer = new Thread() {
@Override
public void run() {
// TODO Auto-generated method stub
try {
sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
intent=new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.google.com/"));
startActivity(intent);
}
}
};
timer.start();
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
this.finish();
}
}
ご覧のとおり、これは非常に単純なプログラムで、スプラッシュ スクリーンを表示し、ブラウザで URL を開きます。ここまでは大丈夫です。戻るボタンを使用して、アプリを終了します。しかし、インストールされたアプリのアイコンを押そうとするとすぐに、システムは私に"app is not installed on your phone"
.
実行中のサービスを確認すると、常にそこにあり、次のようにlogcat
述べています"Launcher does not have permission to launch the intent"
。
私の最初の質問:メソッドfinish()
でを呼び出したのに、アプリが常に実行されているのはなぜですか?onPause()
Q2. このlogcat
メッセージは何を示していますか?
ここに私のマニフェストがあります(あなたは私がインターネット用に追加していないと思っていると思いますが、私は持っていましuses-permission
た):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.abc.xyz.main"
android:versionCode="1"
android:versionName="1.0.1" >
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:icon="@drawable/app_icon"
android:label="@string/app_name" android:permission="android.permission.INTERNET" android:description="@string/appdescription">
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
は次のlogcat
とおりです。
04-29 23:17:56.745: I/ActivityManager(68): Starting activity: Intent {act=android.intent.action.MAIN cat[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.vayyoo.epost.main/.SplashActivity }
04-29 23:17:56.745: W/ActivityManager(68): Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.vayyoo.epost.main/.SplashActivity } from ProcessRecord{45cfc0f8 240:com.android.launcher/10025} (pid=240, uid=10025) requires android.permission.INTERNET
04-29 23:17:56.785: E/Launcher(240): Launcher does not have the permission to launch Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.vayyoo.epost.main/.SplashActivity }. Make sure to create a MAIN intent-filter for the corresponding activity or use the exported attribute for this activity. tag=ApplicationInfo(title=ePost) intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.vayyoo.epost.main/.SplashActivity }
04-29 23:17:56.785: E/Launcher(240): java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.vayyoo.epost.main/.SplashActivity } from ProcessRecord{45cfc0f8 240:com.android.launcher/10025} (pid=240, uid=10025) requires android.permission.INTERNET
04-29 23:17:56.785: E/Launcher(240): at android.os.Parcel.readException(Parcel.java:1247)
04-29 23:17:56.785: E/Launcher(240): at android.os.Parcel.readException(Parcel.java:1235)
04-29 23:17:56.785: E/Launcher(240): at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1298)
04-29 23:17:56.785: E/Launcher(240): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1373)
04-29 23:17:56.785: E/Launcher(240): at android.app.Activity.startActivityForResult(Activity.java:2817)
04-29 23:17:56.785: E/Launcher(240): at com.android.launcher2.Launcher.startActivityForResult(Launcher.java:1053)
04-29 23:17:56.785: E/Launcher(240): at android.app.Activity.startActivity(Activity.java:2923)
04-29 23:17:56.785: E/Launcher(240): at com.android.launcher2.Launcher.startActivitySafely(Launcher.java:1462)
04-29 23:17:56.785: E/Launcher(240): at com.android.launcher2.AllApps2D.onItemClick(AllApps2D.java:178)
04-29 23:17:56.785: E/Launcher(240): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
04-29 23:17:56.785: E/Launcher(240): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696)
04-29 23:17:56.785: E/Launcher(240): at android.os.Handler.handleCallback(Handler.java:587)
04-29 23:17:56.785: E/Launcher(240): at android.os.Handler.dispatchMessage(Handler.java:92)
04-29 23:17:56.785: E/Launcher(240): at android.os.Looper.loop(Looper.java:123)
04-29 23:17:56.785: E/Launcher(240): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-29 23:17:56.785: E/Launcher(240): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 23:17:56.785: E/Launcher(240): at java.lang.reflect.Method.invoke(Method.java:521)
04-29 23:17:56.785: E/Launcher(240): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-29 23:17:56.785: E/Launcher(240): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-29 23:17:56.785: E/Launcher(240): at dalvik.system.NativeStart.main(Native Method)
04-29 23:17:59.855: W/KeyCharacterMap(240): No keyboard for id 0
04-29 23:17:59.855: W/KeyCharacterMap(240): Using default keymap: /system/usr/keychars/qwerty.kcm.bin