title: Display layout from service
body: <p>I want to start an activity when the service is ran for the first time displaying a layout.</p>
  
  <p>I have the following xml file :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.display.helper"
        android:versionCode="1"
        android:versionName="0.1.124"&gt;
  &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_SETTINGS" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.MODIFY_PHONE_STATE"&gt;&lt;/uses-permission&gt;
  &lt;uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"&gt;&lt;/uses-permission&gt;
  &lt;uses-permission android:name="android.permission.WRITE_SETTINGS"&gt;&lt;/uses-permission&gt;
  &lt;uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"&gt;&lt;/uses-permission&gt;
      &lt;uses-permission android:name="android.permission.GET_ACCOUNTS"/&gt;
      &lt;uses-permission android:name="android.permission.READ_PHONE_STATE"/&gt;
      &lt;uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt;
      &lt;uses-permission android:name="android.permission.TELEPHONY"/&gt;
      &lt;uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" /&gt;
      &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
        &lt;activity android:name=".GpsTrackActivity" android:label="@string/app_name"&gt;
        &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.MAIN" /&gt;
  
        &lt;/intent-filter&gt;
      &lt;/activity&gt; 
         &lt;service android:name=".dhaService" &gt;
         &lt;intent-filter&gt;
         &lt;action
         android:name = "com.display.helper.dhaService"&gt;
         &lt;/action&gt;
         &lt;/intent-filter&gt;
         &lt;/service&gt;
         &lt;receiver android:name=".dha"&gt;
         &lt;intent-filter&gt;
         &lt;action
         android:name ="android.intent.action.BOOT_COMPLETED"&gt;
  ...
  </code></pre>
  
  <p>And i do this in the StartService method:</p>
  
  <pre><code>public class dhaService extends Service 
   {
      @Override
      public ComponentName startService(Intent service) {
          // TODO Auto-generated method stub
          Notification note = new Notification(R.drawable.icon,"sadasd",System.currentTimeMillis());
          note.setLatestEventInfo(this, "Tracking device", "Tracking", null);
          note.flags |= Notification.FLAG_NO_CLEAR;
          this.startForeground(1212,note);
          Intent dialogIntent = new Intent(getBaseContext(),GpsTrackActivity.class);
          dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          getApplication().startActivity(dialogIntent);
          return super.startService(service);
  
      }
  </code></pre>
  
  <p>The layout is never displayed what am i doing wrong ?</p>