我每12个小时在我的应用程序中执行同步,之前我在android 4.4下面试过版本同步适配器工作正常,但是kitkat及以上的periodics甚至没有触发请帮助我。
public static void configurePeriodicSync(Context context, int syncInterval, int flexTime) {
Account account = getSyncAccount(context);
String authority = context.getString(R.string.content_authority);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// we can enable inexact timers in our periodic sync
SyncRequest request = new SyncRequest.Builder().
syncPeriodic(syncInterval, flexTime).
setSyncAdapter(account, authority).build();
ContentResolver.requestSync(request);
} else {
ContentResolver.addPeriodicSync(account,
authority, new Bundle(), syncInterval);
}
}
答案 0 :(得分:4)
我已经解决了这个问题,对于kitkat及以上我们需要编写单独的代码
代码:
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: <?php echo LINKEDIN_API_KEY . PHP_EOL; ?>
authorize: true
</script>