我的应用程序,从GetActivity活动的MySQL中获取数据,并保存在mysqlite和创造的通知现在,我多么希望我的应用程序运行自动化,并开始GetActivity在后台获取数据自动启动和充分利用网络数据背景
1
A
回答
3
你我们想看看Services这是在Android的后台运行的线程。从那里你可以从你的SQL数据库加载你的数据。
要照顾自动启动,您需要查看BroadcastReceivers,特别是BOOT_COMPLETED接收器。
2
首先你需要添加这个。
public class MyBroadcastreceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
///// Add your Background Service that Sync your data from database or internet//////////
//// I do the same work it fine work to me.///////
context.startService(new Intent(context, service_ReloadSqlDB.class));
/* Intent i = new Intent(context, MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);*/
}
}
其次,你需要这个帮助添加此清单中
<receiver
android:name="com.b2mtech.wrapper.MyBroadcastreceiver"
android:enabled="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
希望你。享受
相关问题
- 1. Android:启用/禁用自动同步和背景数据
- 2. 从网络背景启动应用程序可用性
- 3. 充分利用网络API的数据AutoCompleteTextView定制适配器
- 4. 视网膜平铺背景启动Screen.nib
- 5. 充分利用数据库
- 6. 充分利用数据库
- 7. 填充Imageview背景动画
- 8. 如何网络刮自动填充textfield
- 9. 背景broadcastreciever不启动
- 10. Android自动填充网络登录用户名和密码
- 11. 页面背景滚动,但股利不
- 12. 充分利用活动记录关系
- 13. 使用主动网络流在iOS4上输入背景
- 14. 动态CSS背景网址
- 15. 启动“背景”Windows应用程序
- 16. 充分利用自参照表分层数据在SQL 2005
- 17. Android自动同步和背景
- 18. 网络连接能力未得到充分利用,为什么?
- 19. 充分利用动态页的DISQUS评论数量和填充的MySQL
- 20. 充分利用数据库铸错误
- 21. 充分利用AJAX数据在Python
- 22. 充分利用数据库视图
- 23. 充分利用数据库与C#
- 24. 网络驱动器不提供启动
- 25. 使背景图像自动滑动
- 26. 动画自动更改背景图像
- 27. Resposive背景不填充移动屏幕
- 28. 动画从图像中填充背景
- 29. 充分利用
- 30. 充分利用网站JSON数据返回“字符串(0)”
您的代码是哪里? –
谢谢,问题解决了 – sadegh