2014-04-26 15 views
0

나는 택시 주문을위한 신청서를 작성 중입니다. 드라이버의 응용 프로그램에서 푸시 컨텐트에 따라 푸시 서비스 인스턴스 2 작업이 있습니다. 고객으로부터 전화가 왔을 때 승객이 활동을 시작하면 활동 1이 시작됩니다. 2. 활동 2 외에는 전화 또는 활동을 시작하는 기능이 있지만 전화 나 활동을 할 때마다 3 반환 활동으로 돌아갈 때 1전혀 새로운 의도로 돌아 가기 이전 활동으로 돌아 가기

내 매니페스트는 다음과 같습니다

<activity 
     android:label="@string/app_name" 
     android:name=".MainActivity" 
     android:screenOrientation="portrait" 
     android:launchMode="singleTop" 
     android:alwaysRetainTaskState="true" 
     android:configChanges="orientation|keyboardHidden|screenSize"> 
    </activity> 
    <activity 
     android:label="@string/app_name" 
     android:name=".RouteActivity" 
     android:screenOrientation="portrait" 
     android:alwaysRetainTaskState="true" 
     android:configChanges="orientation|keyboardHidden|screenSize"> 
    </activity> 

내 푸시 서비스;

NotificationManager mNotificationManager =  
      (NotificationManager)  getSystemService(Context.NOTIFICATION_SERVICE); 
NotificationCompat.Builder mBuilder = 
     new NotificationCompat.Builder(this) 
      .setSmallIcon(R.drawable.ic_launcher) 
      .setContentTitle("MyTaxi") 
      .setContentText(msg) 
      .setUsesChronometer(true); 
    if(GlobalPersist.getGlobalPersist("tipoPush").equals("nueva")&& GlobalPersist.getGlobalPersist("carreraencurso").equals("false")) 
    { 
     Intent notIntent = new Intent(this, MainActivity.class); 
     MainActivity.from=1; 
     notIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 

     this.startActivity(notIntent); 

    } 
    else if(GlobalPersist.getGlobalPersist("tipoPush").equals("cancelacion")) 
    {  GlobalPersist.getGlobalPersist("carreraencurso").equals("false"); 
      Intent notIntent = new Intent(this, MainActivity.class); 
      MainActivity.from=1; 
      MainActivity.carreras.clear(); 
      notIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP); 

      this.startActivity(notIntent); 
    } 
    else 
    { 


     Intent notIntent = new Intent(this, RouteActivity.class); 
      //MainActivity.from=1; 
      MainActivity.timer.cancel(); 
      MainActivity.isTimerActivo=false; 
      notIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK| 
        Intent.FLAG_ACTIVITY_SINGLE_TOP); 
      this.startActivity(notIntent); 
    } 

답변

0

startActivity()를 호출 한 후, 바로 finish()를 호출합니다. 이렇게하면 활동이 중지되고 탐색을 관리 할 수 ​​있습니다.

+0

이미 시도해 봤지만 작동하지 않았습니다. ( – PabloPasten

+1

어디서 전화를했는지 표시 할 수 있습니까? 작동하지 않아야하는 이유는 없습니다. – jmcdonnell40