I am facing a problem that when the Time changes the TIME_TICK only called when the app is running. But i want to get it called even when app is running or not using broadcast receivers.
Main Activity
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toast.makeText(getApplicationContext(), "Checking", Toast.LENGTH_LONG).show();
}
}
MyBroadastReceivers
public class MyBroadastReceiversextends BroadcastReceiver
{
@Override
public void onReceive(Context arg0, Intent arg1) {
Toast.makeText(arg0, "Toast Receive", Toast.LENGTH_LONG).show();
}
}
Menifest File
<receiver android:name="com.example.serviceschecking.MyBroadastReceivers" android:enabled="true" android:exported="true">
<intent-filter >
<action android:name="android.intent.action.TIME_TICK"/>
</intent-filter>
</receiver>