I found out that the reason is a delay, to get the apId, it takes some time, therefore, in your IntentReceiver class, you have to wait for `PushManager.ACTION_REGISTRATION_FINISHED to fire. From there, you can get the apId:
if (action.equals(PushManager.ACTION_REGISTRATION_FINISHED)) {
Log.i(logTag,"Registration complete. APID:" + intent.getStringExtra(PushManager.EXTRA_APID)+ ". Valid: "+ intent.getBooleanExtra( PushManager.EXTRA_REGISTRATION_VALID, false));
// Notify any app-specific listeners
String apid = PushManager.shared().getAPID();
Intent launch = new Intent(UAirship.getPackageName()+ APID_UPDATED_ACTION_SUFFIX);
UAirship.shared().getApplicationContext().sendBroadcast(launch);
}