activity 없이 service 만 실행하기(앱 화면 없이 실행하기)
화면 없이 서비스만 동작하는 앱을 만드려면 이렇게.. AndroidManifest.xml 파일 <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.abc.abc.Main…
화면 없이 서비스만 동작하는 앱을 만드려면 이렇게..
AndroidManifest.xml 파일
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.abc.abc.MainActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
액티비티 테마 타이틀바 없게 코딩~
android:theme="@android:style/Theme.Translucent.NoTitleBar"
MainActivity.java 파일
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//서비스 실행
this.startService(new Intent(this,MyService.class));
finish();
}
}
끝!