void startForegroundCompat(int id,Notification notification){
  if (mStartForeground != null) {
    mStartForegroundArgs[0]=Integer.valueOf(id);
    mStartForegroundArgs[1]=notification;
    invokeMethod(mStartForeground,mStartForegroundArgs);
    return;
  }
  mSetForegroundArgs[0]=Boolean.TRUE;
  invokeMethod(mSetForeground,mSetForegroundArgs);
  mNM.notify(id,notification);
}

void startForegroundCompat ( int id , Notification notification ) { if ( mStartForeground != null ) { mStartForegroundArgs [ 0 ] = Integer . valueOf ( id ) ; mStartForegroundArgs [ 1 ] = notification ; invokeMethod ( mStartForeground , mStartForegroundArgs ) ; return ; } mSetForegroundArgs [ 0 ] = Boolean . TRUE ; invokeMethod ( mSetForeground , mSetForegroundArgs ) ; mNM . notify ( id , notification ) ; }
this is a wrapper around the new startforeground method , using the older apis if it is not available .
