Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 15    Views: 207

tompos
Veteran developer
Profile
Posts: 127
Reg: Oct 19, 2013
Würzburg
7,370
09/29/17 06:36 AM (7 years ago)

Qr Reader error message...

I used the QR Reader plugin in an iOS app... Now I am trying to generate an Android version of this app. I am aware that the Android version uses another QR app (Barcode scanner...) but I did not reach that point yet, because Android Studio gives me an error message "error: incompatible types: Cr_rr_qrreader cannot be converted to Fragment" for the following line in qrButonPressed(): Fragment thisFragment = this; I know that the QR Reader is currently not available in the Plugin market, but perhaps someone knows a shortcut to solving that problem...? Thanks Thomas
 
tompos
Veteran developer
Profile
Posts: 127
Reg: Oct 19, 2013
Würzburg
7,370
like
09/29/17 08:28 AM (7 years ago)
I have solved it... I just had to replace "Fragment" with "BT_fragment" in Cr_rr_qrreader.java, but also in IntentIntegratorSupportV4.java. Now it works... Best wishes Thomas
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
09/29/17 08:38 PM (7 years ago)
Thanks Thomas. I hadn't gotten around to many Android notes or fixes yet... Cheers! -- Smug
 
tompos
Veteran developer
Profile
Posts: 127
Reg: Oct 19, 2013
Würzburg
7,370
like
09/30/17 03:59 AM (7 years ago)
Hi Smug, being mainly focussed on iOS apps, such Android error messages confuse me very quickly. However, the journey was funny... I researched some options to include a QR Scanner library into my app... and landed on the exact solution that Chris had implemented in his plugin... Then only the fragment-line remained... learned a lot on the way ;-). BTW... did you use the QR plugin in one of your apps? My app will be a portrait-only app... but the external QR scanner seems to be in landscape-only orientation. Is this to be accepted as is or can it be changed in some way? My client is not very happy with this orientation-change... at least, it works... Cheers! Thomas
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
09/30/17 06:38 AM (7 years ago)
I was going to use it to demo an app for a local car dealership... Basically the QR Code on the car gave you more information in the app... But it never came to be. Mine are portrait. If I changed it I don't recall, but it shouldn't be too hard; they use xib files, you can just modify that if you wish, or add more for each type of device, etc... Cheers! -- Smug
 
tompos
Veteran developer
Profile
Posts: 127
Reg: Oct 19, 2013
Würzburg
7,370
like
10/06/17 07:17 AM (7 years ago)
Yes, I completely changed the xib files for my iOS project. But the Android version loads the external "Barcode Scanner" app that is in landscape mode. I might include the corresponding library into my project and search for the orientation parts... but calling the scanning app from the QR Reader by intent seems so much easier ;-). Perhaps I have to go the extra mile... Cheers! Thomas
 
ArthurDent
Apple Fan
Profile
Posts: 6
Reg: Jan 16, 2012
Sweden
9,860
like
10/18/17 12:48 PM (7 years ago)
Is it possible to buy the Barcode scanner plug-in?
 
tompos
Veteran developer
Profile
Posts: 127
Reg: Oct 19, 2013
Würzburg
7,370
like
10/19/17 03:24 AM (7 years ago)
Hi, the plugin does not show in the plugin market... I had purchased it 2-3 years ago, so I am able to use it in my current projects... with some minor adjustments it still works fine. As the author of this plugin – Chris – is responsible for the plugin market as well, chances are that it will re-appear in the market someday. I guess that Chris is interested to get a feedback on which of the old plugins is most wanted... Best wishes Thomas
 
ArthurDent
Apple Fan
Profile
Posts: 6
Reg: Jan 16, 2012
Sweden
9,860
like
10/19/17 11:39 AM (7 years ago)
Hi Thomas, And thanks for your quick reply, I will notify Chris and hopefully it will be avaliable soon again. I did find a solution yesterday that I'm working on right now. https://github.com/appcoda/QRCodeReader Best Regards, Joakim
 
sarahk
Code is Art
Profile
Posts: 159
Reg: Jul 16, 2014
Auckland
10,290
like
08/16/18 10:43 PM (6 years ago)
Hi Thomas... I know it's been 10 months, but I'm just getting my apps updated. Which reference to Fragment/fragment in IntentIntegratorSupportV4 needs to be edited?
 
tompos
Veteran developer
Profile
Posts: 127
Reg: Oct 19, 2013
Würzburg
7,370
like
08/17/18 02:16 AM (6 years ago)
Hi Sarah(K), sorry, I had described my solution much too short. Here it is. The original code in Cr_rr_qrreader.java had been public void qrButonPressed() { BT_debugger.showIt(fragmentName + ": qrButtonPresed"); Fragment thisFragment = this; IntentIntegratorSupportV4 scanIntegrator = new IntentIntegratorSupportV4(thisFragment); scanIntegrator.initiateScan(); } and I changed that to public void qrButonPressed() { BT_debugger.showIt(fragmentName + ": qrButtonPresed"); final BT_fragment thisFragment = this; IntentIntegratorSupportV4 scanIntegrator = new IntentIntegratorSupportV4(thisFragment); scanIntegrator.initiateScan(); } In IntentIntegratorSupportV4.java the original code had been public final class IntentIntegratorSupportV4 extends IntentIntegrator { private final Fragment fragment; /** * @param fragment Fragment to handle activity response. */ public IntentIntegratorSupportV4(Fragment fragment) { super(fragment.getActivity()); this.fragment = fragment; } @Override protected void startActivityForResult(Intent intent, int code) { fragment.startActivityForResult(intent, code); } } ... and I changed it to... public final class IntentIntegratorSupportV4 extends IntentIntegrator { private final BT_fragment fragment; /** * @param fragment Fragment to handle activity response. */ public IntentIntegratorSupportV4(BT_fragment fragment) { super(fragment.getActivity()); this.fragment = fragment; } @Override protected void startActivityForResult(Intent intent, int code) { fragment.startActivityForResult(intent, code); } } Hope this will work for you as well. Best wishes Thomas
 
sarahk
Code is Art
Profile
Posts: 159
Reg: Jul 16, 2014
Auckland
10,290
like
08/18/18 11:47 PM (6 years ago)
One little extra bit in the Intent Integrator add import com.androidscanner.ui.bt_screens.BT_fragment; and I'm back in business. Thank you so much!!!
 
tompos
Veteran developer
Profile
Posts: 127
Reg: Oct 19, 2013
Würzburg
7,370
like
08/19/18 01:42 AM (6 years ago)
Ah, you got me! Even now too short ;-)
 
sarahk
Code is Art
Profile
Posts: 159
Reg: Jul 16, 2014
Auckland
10,290
like
08/26/18 08:39 PM (6 years ago)
I've just found a big chunk of code missing from Cr_rr_qrreader.java that handles when a number is returned, appends it to the "nextScreen" and opens it. I'll post a link to a document with all the little changes I've needed to do, and why, once I've got this sorted.
 
tompos
Veteran developer
Profile
Posts: 127
Reg: Oct 19, 2013
Würzburg
7,370
like
08/27/18 03:28 AM (6 years ago)
Sounds great... so you are using the itemId of the screens to jump to a specific content of your app...? Lets revive that good-old-BT-forum ;-) Thomas
 
sarahk
Code is Art
Profile
Posts: 159
Reg: Jul 16, 2014
Auckland
10,290
like
08/27/18 02:27 PM (6 years ago)
I'm scanning membership cards as people arrive at a meeting and displaying their membership status, highlighting issues like "no email", "lapsed". Has been working well but needed upgrading and that's raised a few gotchas - I'd left reportToCloud alone, not realising it's actual role, so I now have my own version of that.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.