title: Android/Java - Why am I getting a "Cannot find symbol method startForground"?
body: <p>I am getting a:</p>
  
  <pre><code>Error:(393, 9) cannot find symbol method startForeground(int,android.app.Notification)
  </code></pre>
  
  <p>I am trying to run my GPS/Commuting app in the Foreground so that it is always treated as a foreground app. Here is my code snippet where I attempt to start the foreground service:</p>
  
  <pre><code>@Override
  public void onStart() {
      Intent intentForeground = new Intent(this, Activity.class);
      intentForeground.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
      PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intentForeground,0);
      pendingIntent.cancel();
      pendingIntent = PendingIntent.getActivity(this, 0, intentForeground,0);
  
      NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext())
              .setSmallIcon(R.drawable.ic_launcher)
              .setContentIntent(pendingIntent)
              .setContentTitle(getString(R.string.app_name))
              .setContentText("Yup1")
              .setTicker("Yup2")
              .setAutoCancel(false);
  
      Notification notification = mBuilder.build();
      startForeground(123, notification);
  }
  </code></pre>
  
  <p>My build.gradle:</p>
  
  <pre><code>android {
      compileSdkVersion 19
      buildToolsVersion "19.0.3"
  
      defaultConfig {
          minSdkVersion 9
          targetSdkVersion 19
          versionCode 1
          versionName "1.0"
      }
      buildTypes {
          release {
              runProguard false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
          }
      }
  }
  
  dependencies {
      compile 'com.android.support:appcompat-v7:+'
      compile 'com.google.android.gms:play-services:5.0.77+'
      compile fileTree(dir: 'libs', include: ['*.jar'])
      compile 'com.sothree.slidinguppanel:library:+'
      compile 'com.firebase:firebase-client:1.0.16+'
  }
  </code></pre>