Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
# Steps to reproduce
JobInfo.Builder builder = new JobInfo.Builder(0, new ComponentName(context, serviceName));
// Look for specific changes to images in the provider.
// !!! Below no constructor exists : new JobInfo.TriggerContentUri(...)
builder.AddTriggerContentUri(new JobInfo.TriggerContentUri(MediaStore.Images.Media.ExternalContentUri, TriggerContentUriFlags.NotifyForDescendants));
// Also look for general reports of changes in the overall provider.
//builder.addTriggerContentUri(new JobInfo.TriggerContentUri(MEDIA_URI, 0));
var jobInfo = builder.Build();
My solution references Mono.Android 7.1, and targets Android 6.0 at minimum.
# Expected behavior
Android link: https://developer.android.com/topic/performance/background-optimization.html#media-broadcasts
I want to convert a simple code provided by google for android, allowing me to create a jobservice which triggers when a new media is created (source).
# Actual behavior
I can convert almost all without any problem, but it seems impossible to create a new TriggerContentUri, because no constructor exists.
# Supplemental info (logs, images, videos)
# Test environment (full version information)
This looks like it is indeed missing. We need to expose a ctor similar to the following:
It seems a question has been asked on Stack Overflow and was not answered(Same poster based on similar code):
This API was added in API level 24. The only constructor available that I see is:
internal TriggerContentUri(IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer)
The interesting part is that there is an existing method map:
Here's a quick decompilation of the android.jar:
public class JobInfo
public static final int BACKOFF_POLICY_EXPONENTIAL = 1;
public static final int BACKOFF_POLICY_LINEAR = 0;
public static final class TriggerContentUri
public TriggerContentUri(Uri uri, int flags)
throw new RuntimeException("Stub!");
Thus I am marking this issue as CONFIRMED.
This appears to be fixed in d15-4.
> $ monodis --method /Library/Frameworks/Xamarin.Android.framework/Versions/7.4.0-19/lib/xbuild-frameworks/MonoAndroid/v7.0/Mono.Android.dll
> ########## .TriggerContentUri
> 132180: instance default void '.ctor' (native int javaReference, valuetype Android.Runtime.JniHandleOwnership transfer) (param: 141252 impl_flags: cil managed )
> $ monodis --method /Library/Frameworks/Xamarin.Android.framework/Versions/8.0.0-13/lib/xbuild-frameworks/MonoAndroid/v7.0/Mono.Android.dll
> ########## .TriggerContentUri
> 129757: instance default void '.ctor' (native int javaReference, valuetype Android.Runtime.JniHandleOwnership transfer) (param: 139882 impl_flags: cil managed )
> 129758: instance default void '.ctor' (class Android.Net.Uri uri, valuetype Android.App.Job.TriggerContentUriFlags 'flags') (param: 139884 impl_flags: cil managed )
As per our understanding user could not found contructor for class TriggerContentUri using 15.3 version of XVS.
We have verified the defect on latest 15.4 VS 2017 build and were able succesfuly created the instance of TriggerContentUri by invoking constructor of TriggerContentUri
Our findings in the build version VS 15.4
We were able to locate the class TriggerContentUri at Android.App.Job.JobInfo.TriggerContentUri
We were found the constructor signature as -
[Register(".ctor", "(Landroid/net/Uri;I)V", "")]
public TriggerContentUri(Net.Uri uri, [GeneratedEnum] TriggerContentUriFlags flags);
We succesfuly created the instance of TriggerContentUri by invoking constructor of TriggerContentUri as below-
var uri = Android.Net.Uri.Parse("http://google.com");
var job = new JobInfo.TriggerContentUri(uri, TriggerContentUriFlags.NotifyForDescendants);
Note- While trying to reproduce the issue on 15.3.3 VS2017 build. Our findings is there is no class definition found for TriggerContentUri at Android.App.Job.JobInfo. This is overall issue which customer have reported it.
Defect Fixed on 15.4 VS 2017
Xamarin 18.104.22.168 (54942a671)
Xamarin.Android SDK 22.214.171.124 (HEAD/7a6a056e8)
Xamarin.iOS and Xamarin.Mac SDK 126.96.36.199 (9a9f054)
Device: Nexus 6P OS 8.0