Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid app crashes on Device Boot
    primarykey
    data
    text
    <p>I am working on an Application that requires to start a <code>BackgroundService</code> on Android Boot</p> <p>This is the code that I am using to start the <code>BroadcastReceiver</code> on Android Boot</p> <pre><code>public class StartOnBootService extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) { Intent serviceIntent = new Intent(); serviceIntent.setAction("com.package.myApplicationPackage.BackgroundService"); context.startService(serviceIntent); } } catch(Exception e) { e.printStackTrace(); } } } </code></pre> <p>This is my <code>BackgroundService.class</code></p> <pre><code>public class BackgroundService extends Service { @Override public IBinder onBind(Intent intent) { return null; } @Override public void onCreate() { //code to execute when the service is first created Toast.makeText(getBaseContext(), "BACKGROUND SERVICE STARTED", Toast.LENGTH_LONG).show(); } @Override public void onDestroy() { //code to execute when the service is shutting down } @Override public void onStart(Intent intent, int startid) { //code to execute when the service is starting up } } </code></pre> <p>This is the error log that I managed to snipe from the CatLog while my Android was Booting.</p> <pre><code>12-21 10:28:01.279: E/EmbeddedLogger(1710): App crashed! Process: com.package.myApplicationPackage 12-21 10:28:01.289: E/EmbeddedLogger(1710): App crashed! Package: com.package.myApplicationPackage v1 (1.0) 12-21 10:28:01.289: E/EmbeddedLogger(1710): Application Label: myApp Label </code></pre> <p>My <code>AndroidManifest.xml</code> file</p> <pre><code> &lt;/service&gt; &lt;service android:name=".BackgroundService"&gt; &lt;intent-filter&gt; &lt;action android:name="com.package.myApplicationPackage.BackgroundService" /&gt; &lt;/intent-filter&gt; &lt;/service&gt; &lt;receiver android:name=".receiver.StartOnBootService" android:enabled="true" android:exported="true" android:label="StartOnBootService"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload