Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Dean Ellis
    @dellis1972
    na its ok.
    Jonathan Pobst
    @jpobst
    @mattleibow_twitter for #1 and #2 in xamarin/java.interop#464, do you propose we just ignore those types/methods?
    Matthew Leibowitz
    @mattleibow_twitter
    @jpobst I don't think so. I removed them because I knew they were deprecated. But sometimes it is actually just an overload in kotlin with a hash suffix.
    We actually need to query the cotlin visibility and name and then rename correctly
    I have been hacking on a build step that tries to do this and it appears to clean up a lot of this. But, it actually needs to be done properly https://github.com/xamarin/XamarinComponents/tree/master/Util/Xamarin.Kotlin.BindingSupport
    AwsomeCode
    @AwsomeCode
    I am getting this error "LayoutResultCallback() is not public in LayoutResultCallback; cannot be accessed from outside package
    public class MyLayoutResultCallback"
    Jonathan Pryor
    @jonpryor
    @AwsomeCode: for starters, wow that’s a bad API. There’s no documented constructor at all! The type is borderline useless!
    thus you need to “port” the answer into C#: https://stackoverflow.com/a/47905537/83444
    so what you need to do is: [Register ("android/print/MyAsesomeCallback")] public partial class MyAsesomeCallback : PrintDocumentAdapter.LayoutResultCallback { // ... }
    and i can’t spell “awesome”. go figure.
    @AwsomeCode: the [Register] causes the generated Java Callable Wrapper to be placed into the android.print package, which will allow it to access the package-private LayoutResultCallback constructor
    AwsomeCode
    @AwsomeCode
    @jonpryor Thank its building properly now but now crashing without any exception.
    Jonathan Pryor
    @jonpryor
    hard to diagnose things without an exception. :disappointed:
    AwsomeCode
    @AwsomeCode
    AwsomeCode
    @AwsomeCode
    @jonpryor constructor is not getting called of MyLayoutResultCallback
    this is how i am calling it "new MyLayoutResultCallback(printAdapter, file, fileName, JNIEnv.Handle, JniHandleOwnership.DoNotRegister)"
    new MyLayoutResultCallback(printAdapter, file, fileName, JNIEnv.Handle, JniHandleOwnership.DoNotRegister)
    '[Register("android/print/MyLayoutResultCallback")]
    public class MyLayoutResultCallback : LayoutResultCallback
    {
    PrintDocumentAdapter printDocumentAdapter;
    File path;
    string fileName;
    public MyLayoutResultCallback(PrintDocumentAdapter printDocumentAdapter, File path, string fileName, IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
    {
    this.printDocumentAdapter = printDocumentAdapter;
    this.path = path;
    this.fileName = fileName;
    }
        public override void OnLayoutCancelled()
        {
            base.OnLayoutCancelled();
        }
    
        public override void OnLayoutFailed(ICharSequence error)
        {
            base.OnLayoutFailed(error);
        }
    
        public override void OnLayoutFinished(PrintDocumentInfo info, bool changed)
        {
            ParcelFileDescriptor fileDescriptor = GetOutputFile(path, fileName);
            printDocumentAdapter.OnWrite(new PageRange[] { PageRange.AllPages }, fileDescriptor, new CancellationSignal(),
             new MyWriteResultCallbackt(JNIEnv.Handle, JniHandleOwnership.DoNotRegister));
    
            base.OnLayoutFinished(info, changed);
        }
    
    
    
        public ParcelFileDescriptor GetOutputFile(File path, string fileName)
        {
            bool success = true;
            if (!path.Exists())
            {
                success = path.Mkdir();
            }
            if (success)
            {
                File file = new File(path, fileName);
                try
                {
                    success = file.CreateNewFile();
                    if (success)
                    {
                        return ParcelFileDescriptor.Open(file, ParcelFileMode.ReadWrite);
                    }
    
                }
                catch (System.Exception e)
                {
                    //AnalyticsHandlerAdapter.getInstance().sendException(e);
                }
            }
            return null;
        }
    }'
    Jonathan Pryor
    @jonpryor
    it’s probably failing because the constructor can’t be found.
    why does your constructor have added , IntPtr javaReference, JniHandleOwnership transfer parameters?
    oof
    AwsomeCode
    @AwsomeCode
    LayoutResultCallback is an abstract class
    Jonathan Pryor
    @jonpryor
    new MyLayoutResultCallback(printAdapter, file, fileName, JNIEnv.Handle, JniHandleOwnership.DoNotRegister) will not work
    JNIEnv.Handle is a JNIEnv* handle, not a JNI object reference to a MyLayoutResultCallback instance
    there’s no need to have those two parameters…normally
    but this isn’t normal
    /me sighs
    AwsomeCode
    @AwsomeCode
    There is no argument given that corresponds to the required formal parameter 'javaReference' of 'PrintDocumentAdapter.LayoutResultCallback.LayoutResultCallback(IntPtr, JniHandleOwnership)'
    Jonathan Pryor
    @jonpryor
    @AwsomeCode: you should instead do: public MyLayoutResultCallback(PrintDocumentAdapter printDocumentAdapter, File path, string fileName) : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) { /* ... */ }
    AwsomeCode
    @AwsomeCode
    ok
    Jonathan Pryor
    @jonpryor
    and then use new MyLayoutResultCallback(printAdapter, file, fileName)
    AwsomeCode
    @AwsomeCode
    Yes, building. Let's see
    AwsomeCode
    @AwsomeCode
    Now I am having "Java.Lang.NullPointerException: 'Attempt to invoke virtual method 'void android.print.PrintDocumentAdapter$LayoutResultCallback.onLayoutFinished(android.print.PrintDocumentInfo, boolean)' on a null object reference'
    'public override void OnLayoutFinished(PrintDocumentInfo info, bool changed)
    {
    ParcelFileDescriptor fileDescriptor = GetOutputFile(path, fileName);
    printDocumentAdapter.OnWrite(new PageRange[] { PageRange.AllPages }, fileDescriptor, new CancellationSignal(),
    new MyWriteResultCallbackt(JNIEnv.Handle, JniHandleOwnership.DoNotRegister));
    base.OnLayoutFinished(info, changed);
    }'
    Above method is not getting called
    and error is at this line ' printDocumentAdapter.OnLayout(null, printAttributes, null, new MyLayoutResultCallback(printAdapter, file, fileName), null); '
    Swiftloke
    @Swiftloke
    Hey, could someone take a gander at this, or send it along to James Montemagno? I'm not really sure how to get a hold of him, maybe someone in here knows how? https://stackoverflow.com/questions/57936383/in-app-billing-plugin-fails-on-xamarin-android-with-a-vague-error-message-some
    Jonathan Peppers
    @jonathanpeppers
    @Swiftloke he should see it if you file an issue: https://github.com/jamesmontemagno/InAppBillingPlugin/issues
    Swiftloke
    @Swiftloke
    It's been a few days and no one responded to my issue on GitHub (jamesmontemagno/InAppBillingPlugin#244), so I'll ask again- does anyone here know anything about in app purchases and what might be going wrong with the In-App Billing Plugin library?
    Jon Douglas
    @JonDouglas
    It would probably be worth asking Google Play Support
    That is a server side error it seems
    IoTFier
    @IoTFier
    Hi @JonDouglas , to my knowledge my android studio (SDK , plugin) and even VS 2019 is upto date.. then I am not sure why do I keep getting this error .. Can you please help ?
    image.png
    Jon Douglas
    @JonDouglas
    i think this is an issue on googles side. you are using platform tools 29.0.2?
    IoTFier
    @IoTFier
    yes
    29.0.4
    Jon Douglas
    @JonDouglas
    yeah i got this recently in android studio too with latest everything
    i think it's an issue on their end
    IoTFier
    @IoTFier
    cool. thank you for confirming that for me