Home › Forums › Ask the Flomies › FloBLE URL to Webview
Tagged: FlomioBLE URL Launch
-
AuthorPosts
-
July 5, 2016 at 5:23 pm #55896
We have the Flomio BLE unit and want to use it to launch a URL in a web view upon a tap. I worked with the SDK and am having some trouble doing this. I am using Type 2 Tags.
Is there a project that does this functionality that you can send the Xcode project for?
Is this something you could develop for us?
July 5, 2016 at 11:05 pm #55897Hi Nathan,
I will need to ask you a few questions to get this sorted.
What tag are you working with exactly? This is only currently supported with Type 4 tags and Mifare Ultralight.
In terms of how it’s done, is currently being improved upon to make it easier for developers. But assuming you have the latest release, you need to store the FmDevice from the delegate method ‘didUpdateConnectedDevices’. You then need to present a tag, and then finally sent ‘[device getDataBlocks]’ to read data blocks from this device.
This will provide you with an object called a ‘NdefMessage’ in the ‘didFindADataBlockWithNdef’ delegate method which will have your URL stored.
NOTE: At the next release (which should be next week), you will be able to immediately see your url immediately upon tapping a tag, and it will a LOT easier to configure. 🙂
NOTE: This is for FlomioSDKv2.0
For instructions for FlomioSDKv2.1 (beta) see my next post in this thread.@implementation ViewController { FmDevice *device; } - (void)didUpdateConnectedDevices:(NSArray *)connectedDevices { device = connectedDevices[0]; //this needs to be stored for future use } //Next present a tag, and use the method [device getDataBlocks]; to read the URL from the tag - (void)didFindADataBlockWithNdef:(NdefMessage *)ndef fromDevice:(NSString *)device withError:(NSError *)error{ dispatch_async(dispatch_get_main_queue(), ^{ //Use the main queue if the UI must be updated with the tag UUID or the deviceId //Your URL will be here in the NDEF Object NSURL *url = nil; for (NdefRecord *record in ndef.ndefRecords){ if (record.url){ url = record.url; } } }); }
July 5, 2016 at 11:23 pm #55901I am using MiFare Ultralights and other type 2 tags such as NXP NTAG213.
Will this work with NTAG213? We only store about 46 bytes to the tag.
Please let me know when the new release is available. Being able to have that functionality will enable us to order more devices after we can prove the concept to a few of our customers that wish to use apple products.
July 6, 2016 at 4:28 pm #55907Ok thanks for the info about your tags. I do not have any NXP NTAG213 at the moment, I will add these to the pipeline and will begin adding support for NDEF on that tag type when the shipment arrives.
Flomio SDK v2.1 (beta)
Here is a 2.1 (beta) for you to try. Please read the README to open URLs from NDEF tags. Here is a brief tutorial on how to open URLs from Mifare Ultralight NDEF tags using your FloBLE Plus.//Store the device from this delegate method - (void)didUpdateConnectedDevices:(NSArray *)connectedDevices { //The list of connected devices was updated self.device = connectedDevices[0]; //store whichever device you need, but first you need to declare @property //(nonatomic, strong) FmDevice *device in your UIViewController's header file. } //change the reader state of the device in question. Call this method within your //application. Do not call this within didUpdateConnectedDevices [self.device setReaderState:kReadData]; //kReadUUID is the state to return to read UUID // Now, next time a NDEF tag is presented, it will read the data and trigger the // didFindADataBlockWithNdef delegate method. // The tag must have NDEF data for this to work //To get a url from a NDEF messsage //This is only supported for FloBLE Plus with Mifare Ultralight and NFC Forum Type //4 tags - (void)didFindADataBlockWithNdef:(NdefMessage *)ndef fromDevice:(NSString *)device withError:(NSError *)error{ dispatch_async(dispatch_get_main_queue(), ^{ // Second dispatch message to log tag and restore screen NSURL *url = nil; for (NdefRecord *record in ndef.ndefRecords){ if (record.url){ [[UIApplication sharedApplication] openURL:record.url]; } } }); }
July 6, 2016 at 4:33 pm #55911Scott, if you want, we own a NFC tag software and distribution company. Want me to mail you tags? Give me an address and i’ll send a few free samples.
Best Regards,
NathanJuly 6, 2016 at 5:00 pm #55913That would be great! I have just send you an email with my shipping details.
Please let me know how you get on with integrating the beta SDK into your project.
Cheers,
ScottJuly 7, 2016 at 4:07 pm #55929Hi Nathan,
I have added the ability to open the URL externally using Safari in the instructions above. If you would like to open a URL within your app, there are many tutorials online to use a UIWebView. For example: this Link
I hope this helps.
Kindest Regards,
ScottJuly 8, 2016 at 12:32 am #55934Got it working with the behavior I wanted and I made the UI easy to use! It worked with both my MiFare and NXP213 tags.
Thank you for your help!
If you go to https://www.proximityshop.com/product/nfc-starter-kit-28-units-ntag213-mifare-ntag203/ you can order a 28 tag sample kit to test a variety of tag types for your use cases. Use code flomio16 and it will take 16% off the order.
-
AuthorPosts
The topic ‘FloBLE URL to Webview’ is closed to new replies.