BroadcastReceiver can be registered either in Activity (dynamically) or statically (registered in the manifest). With the first questions no. The second method fails. I read on the site that in order for the manifest to register, you need to start the Activity , but this also does not work. I decided to ask you for help. Here is the source code:
JustBroadcastReceiver.java: public class JustBroadcastReceiver extends BroadcastReceiver { public static Context mContext; @Override public void onReceive(Context context, Intent intent) { if(mContext==null) mContext=context; StringBuilder strb=new StringBuilder("Текущая дата: "); Format fformat=new SimpleDateFormat("hh:mm:ss a"); strb.append(fformat.format(new Date())); Toast.makeText(context, strb, Toast.LENGTH_LONG).show(); } } withoutactitivity.xml: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.withoutactitivity" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".JustBroadcastReceiver" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <receiver android:name=".JustBroadcastReceiver" android:enabled="true" android:exported="false" > <intent-filter> <action android:name="android.intent.action.TIME_TICK" /> </intent-filter> </receiver> </application> </manifest>