Ich habe Activity
Aktivität nicht startet beim Booten nicht abgeschlossen
public class I1 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_main);
}
}
und BroadcastReceiver
public class I2 extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Intent mIntent = new Intent(context, I1.class);
mIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(mIntent);
}
}
Warum nicht meine Tätigkeit beim Booten beginnt abgeschlossen? Das ist Code von AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mypackage"
android:versionCode="1"
android:versionName="1.6" >
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="25" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" >
<activity
android:name=".I1"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name=".I2"
android:enabled="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>
und Code von Layout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true"
android:background="#000000"
tools:context="com.mypackage.Main" />
Können Sie mir bitte helfen, was mit meinem Code falsch?
Bitte geben Sie den Gerätenamen mit dem Betriebssystem an. –
Die Absicht wird empfangen? Gibt es eine Ausnahme? Und zuletzt, ist die App auf einer SD-Karte? – AxelH
Keine Ausnahme protokolliert. Ich benutze USB-Debugging-Logcat. Ich habe versucht, App am Telefon und auf SD-Karte zu installieren. Absicht wurde nicht erhalten. Telefon - Philips Android 4.0.3. –