2015-02-04 2 views
2

내 응용 프로그램에 경보가 있지만 문제가 있습니다 - 내 경보는 대화 상자와 같으며 전체 화면을 차지하지 않습니다. 내 문제는 내 알람 활동과 함께, 내 애플 리케이션은 사용자가 내 애플 리케이션에 있던 마지막 장소를 보여주는뿐만 아니라 열립니다.응용 프로그램을 시작하지 않고 경보 활동 시작

활동은 서비스에서 호출됩니다

@Override 
public int onStartCommand(Intent intent, int flags, int startId) { 

    if (intent != null) { 
     Intent alarmIntent = new Intent(getBaseContext(), AlarmScreen.class); 
     alarmIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
     alarmIntent.putExtras(intent); 
     getApplication().startActivity(alarmIntent); 
     AlarmManagerHelper.setAlarms(this); 
    } 
    return super.onStartCommand(intent, flags, startId); 

} 

은 내가 그냥 알람 활동을 열려는 내 앱에서 알람 활동을 열려하지 않습니다. 내가 어떻게 할 수 있니?

감사합니다. 편집 : 심지어 필터 의도를 사용하고 AlarmActivity를 주요 활동 (실행기)처럼 만들려고했지만 작동하지 않았습니다.

이 내가 menifest 내 AlarmActivity 및 AlarmService를 설정하는 방법입니다

<activity 
     android:name="com.ezlist.tasks.AlarmScreen" 
     android:label="" 
     android:screenOrientation="portrait" 
     android:theme="@style/Theme.Transparent" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
</activity> 

    <service 
     android:name="com.fgdvir.ezlist.AlarmService" 
     android:enabled="true" /> 
+0

'알람 활동으로 앱을 열지 않고 알람 활동을 열어보기를 원합니다'라는 의미는 무엇입니까? –

답변

2

앱에 대한 고유 한 값으로 알람 활동의 android:taskAffinity을 설정합니다.

예컨대

android:taskAffinity="uk.co.packagename.alarmactivity" 

그 것이다 다음 자신의 작업에서 열고 응용 프로그램의 나머지 부분과 관련이 없습니다. 즉 앱이 열릴 때 나머지 앱을 포 그라운드로 가져 오지 않습니다.

+0

탱크가 너무 많아 !! .. 나는 이것을 오랫동안 찾았다 .. 나는 그게 단순하다는 것을 믿을 수 없다. –

관련 문제