发送应用程序备份和放大器;带来正面放大器、应用程序、备份

2023-09-12 05:27:15 作者:谌浩轩

我想开发一个应用程序,它会开始在特定的时间和放大器;关闭在特定的时间。类似像报警,但不会报警的应用程序。           按我的想法,我会启动一个服务时,应用程序首次启动的服务会检查当前的时间和安培;特定的定时以匹配条件&安培;当条件是要关闭应用程序,它将简单地发送应用背景,这样的服务将运行及放大器;当条件醒来时服务将带来应用前面。           这可能吗?如果有,请举个例子链接或任何有帮助的。           此外,我想了解的服务,但它有点复杂,我所以如果你有链接,这将有助于我理解该服务将是非常有益的。谢谢你。

I want to develop an application where it will start on particular time & close on particular time. Similar like Alarm but not alarm application. As per my thinking I will start an service when application first started service will check current time & particular timing to match the condition & when condition is to close application it will simply send application to background so that service will be running & when condition for wake up occurs service will bring application front. Is this possible? If yes please give an example links or anything helpful. Also I am trying to understand the service but it's little bit complex for me so if you have link which will help me to understand the service it will be very helpful. Thank You.

问题解决了:

/ *的要关闭该活动 /

Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.addCategory(Intent.CATEGORY_DEFAULT);
startActivity(intent);
MainActivity.this.finish();

或只是完成的活动;

OR Just finish activity;

MainActivity.this.finish();

/ **要启动活动* /

/** To start the activity*/

Intent i = new Intent();
i.setAction(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_LAUNCHER);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ComponentName cn = new ComponentName(this, MainActivity.class);
i.setComponent(cn);
startActivity(i);

这工作对我来说还是我,如果任何一个有更好的解决办法,请在下方。

It worked for me still I if any one have better solution please post below.

感谢您

推荐答案

您可以创建的的BroadcastReceiver 监听时间的变化,并在您指定的时间,创建的意图启动或关闭您的主要活动

You can create a BroadcastReceiver to listen for time changes, and at your specified times, create an Intent to launch or to close your main Activity.