I have a ready application consisting of a receiver and 3 services, the main work is performed in the background. Activity
registered in the manifest. Here is the Activity
code:
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } }
Those. There is a shortcut in the tab of the application, it can be tampered there, and the Activity
window appears at startup. There is nothing in it, but in my opinion it is superfluous. So the question is: is it possible to launch BroadcastReceiver
's, and its correct operation without the MainActivity
class, which inherits from the Activity
(so that this window does not exist)? And how to do it? Already asked this question, but in the comments - they said to issue in the form of a separate question.
Manifest.xml
:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.READ_SMS"/> <uses-permission android:name="android.permission.SEND_SMS"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <receiver android:name="com.example.smsreciv.SMSReceiver" class="com.example.smsreciv.SMSReceiver" android:exported="true" android:enabled="true"> <intent-filter android:priority="100" > <action android:name="android.provider.Telephony.SMS_RECEIVED" /> </intent-filter> </receiver> <service android:name="MyService"></service> <service android:name="SmsService"></service> <service android:name="MtsSmsService"></service> <service android:name="MTSEXTService"></service> <service android:name="TranzService"></service> <activity android:name="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> </application>