Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xamarin 对Evernote'具有约束力;安卓的工作_Xamarin_Xamarin.android - Fatal编程技术网

Xamarin 对Evernote'具有约束力;安卓的工作

Xamarin 对Evernote'具有约束力;安卓的工作,xamarin,xamarin.android,Xamarin,Xamarin.android,有人为Evernote的android工作做过绑定吗 有趣的是,Xamarin文档在一个示例中提到了这一点: 我试着跟随,但它没有为GitHub上的android作业生成JobManager类Xamarin绑定 这是什么? 允许您利用Android,在后台高效、稳健地运行作业。库检查客户端设备上的Android版本,以确定执行预定后台工作的最佳方法。它将为操作系统使用最合适的方法,如作业调度器,GcmNetworkManager,报警管理器或工作管理器 如何使用它: 第1步: 下载 第二步:

有人为Evernote的android工作做过绑定吗

有趣的是,Xamarin文档在一个示例中提到了这一点:

我试着跟随,但它没有为GitHub上的android作业生成JobManager类

Xamarin绑定 这是什么?

允许您利用Android,在后台高效、稳健地运行作业。库检查客户端设备上的Android版本,以确定执行预定后台工作的最佳方法。它将为操作系统使用最合适的方法,如
作业调度器
GcmNetworkManager
报警管理器
工作管理器

如何使用它: 第1步:

下载

第二步:

在发布模式下构建绑定项目,然后从
bin/Release
文件夹中获取
android job.dll
文件。将此dll添加到您自己的项目并引用它

第三步:

将以下内容添加到应用程序节点内的Android清单中,以使服务和接收器正常工作

<service android:name="com.evernote.android.job.v21.PlatformJobService" android:exported="false" android:permission="android.permission.BIND_JOB_SERVICE"/>
<service android:name="com.evernote.android.job.v14.PlatformAlarmService" android:exported="false" android:permission="android.permission.BIND_JOB_SERVICE"/>
<service android:name="com.evernote.android.job.v14.PlatformAlarmServiceExact" android:exported="false"/>
<receiver android:name="com.evernote.android.job.v14.PlatformAlarmReceiver" android:exported="false">
  <intent-filter>
    <!-- Keep the filter for legacy intents -->
    <action android:name="com.evernote.android.job.v14.RUN_JOB"/>
    <action android:name="net.vrallev.android.job.v14.RUN_JOB"/>
  </intent-filter>
</receiver>
<receiver android:name="com.evernote.android.job.JobBootReceiver" android:exported="false">
  <intent-filter>
    <action android:name="android.intent.action.BOOT_COMPLETED"/>
    <action android:name="android.intent.action.QUICKBOOT_POWERON"/>
    <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
    <action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
  </intent-filter>
</receiver>
<service android:name="com.evernote.android.job.gcm.PlatformGcmService" android:enabled="false" android:exported="true" android:permission="com.google.android.gms.permission.BIND_NETWORK_TASK_SERVICE">
  <intent-filter>
    <action android:name="com.google.android.gms.gcm.ACTION_TASK_READY"/>
  </intent-filter>
</service>
<service android:name="com.evernote.android.job.JobRescheduleService" android:exported="false" android:permission="android.permission.BIND_JOB_SERVICE"/>
第6步:

为作业创建工厂方法:

using Com.Evernote.Android.Job;

namespace MyNamespace
{
    public class MyJobCreator : Java.Lang.Object, IJobCreator
    {
        public Job Create(string tag)
        {
            switch (tag)
            {
                case MyJob.TAG:
                    return new MyJob();
                default:
                    return null;
            }
        }

    }
}
第7步:

初始化
JobManager
singleton,最好是在您的
globalaapplication.OnCreate
方法中。如果你做不到,那就有一个

第8步:

安排你的工作!您可以从开始的活动
OnCreate
方法或任何您喜欢的地方执行此操作。例如:

MyNamespace.MyJob.ScheduleJob();

提示:
  • OnRunJob(…)
    方法中完成的工作应该是同步的,否则在所有工作完成之前不会返回
    结果
  • 注意不要多次实例化同一作业。在作业生成器上使用
    SetUpdateCurrent
    ,或者通过调用
    JobManager.Instance().GetAllJobRequestsForFlag(MyJob.TAG)
    检查作业是否已经存在

  • 信用证和参考证:
    • 对于和Android清单配置说明,请参见
    • 归功于

    你好。谢谢你花时间写这篇文章。你自己用过绑定吗?是的,我在写那篇文章之前就实现了它。它工作得很好。。
    using Com.Evernote.Android.Job;
    
    namespace MyNamespace
    {
        public class MyJobCreator : Java.Lang.Object, IJobCreator
        {
            public Job Create(string tag)
            {
                switch (tag)
                {
                    case MyJob.TAG:
                        return new MyJob();
                    default:
                        return null;
                }
            }
    
        }
    }
    
    JobManager.Create(this).AddJobCreator(new MyJobCreator());
    
    MyNamespace.MyJob.ScheduleJob();