Android emulate NFC with Smartphone as reader - java

I'm looking for a way to use my phone instead of a nfc card. To do that I would create an Android App.
I live in Switzerland and the national rail company uses a nfc card called "Swisspass" to load annual tickets, ... on it for conductors to read it and look if the ticket is valid. A year ago they issued a new function called "Swisspass Mobile" where in your app you can display a QR code for the conductors to scan. You can also add your pass to Google Pay as a loyalty program card. If you do so it shows you a url which looks like that:
HTTP://1SP.CH?S=SXXXXXXXXXXX
Where the SXXXXXXXXXXX is your member id. The problem with the QR code is that it takes way longer for the conductor to check and it is in general difficult to do so, as the train is constantly moving. If you take this url and generate a QR code form it in any other app it works as well.
So my thought was to use my phone to send this URL to the smartphone the conductor uses to make their and my life easier. I had a look at this
https://developer.android.com/guide/topics/connectivity/nfc/hce
but I can't really figure out what AID I would have to use or if I even need to use HCE in that case as it's not a NFC tag reader but a smartphone. Do you know any more information? Could I use peer to peer or just send the url by nfc to the conductors smartphone? How would I do that?
Thanks a lot in advance

Related

Can't read Google Pay Pass event card through another phone's NFC reader

I need to make an app that is able to read the Google Pay Pass event ticket through NFC. But I can't find any way how to deal with it. I saw some top apps in Google Play, as PassWallet and Passes, which works with such event tickets.
But they all could add a new ticket through scanning barcode only, not through NFC touch. I tried to open a ticket in Google Pay app and read it through another phone's NFC reader but didn't receive any information about the ticket, I always receive my default credit card info even when I open needed card.
So my question is that is it possible to read Google Pay Pass event ticket through another phone's NFC, as in the picture below?
If yes, could you share with me some example codes on how to do it?
Yes it is possible.
For a Google Pay issued pass the pass must be saved to google pay on the mobile device and that passes class must be set to enable smart tap and the pass itself must have the smartTapRedemptionValue field set as below:
{
...
"smartTapRedemptionValue": "Value to Transmit",
...
}
The device acting as the terminal (reads the pass) must implement the Smart Tap Protocol and present the collector id, and signed payload to the mobile device to authenticate the terminal and send passes that it can redeem.
The passes class also has the field redemptionIssuers can specify which terminal's collector id can redeem it.
In order to implement Smart Tap Protocol you can request access to the NDA protected docs via a form and that has the details on how to configure a device acting as a terminal to read passes.
There are also already certified supported terminal providers available.

Android Automotive CarSensorManager for SRS sensors

Does in Android Automotive exists a way to read sensors from OBD2 or SRS. Or in any other android OS for cars.
I have searched in CarSensorManager but didn't find anything.
Currently not from AOSP implementation.
To read a sensor data usually you need to access/read data from vehicle network (CAN bus) that mean you need someone to transfer that data to Android Stack first and make it visible in Android IVI domain.
Normarly Vehicle HAL suppose to be doing it... but it highly depend on OEM if they offer that signal or not.

Salesforce: Which API to use without Login required?

I'm currently working on a native Android app for my company and ran into some problems with Salesforce lately.
I hope I can find some help here.
What I want to achieve:
The company has a lot of Accounts in Salesforce with 3 important fields for the app: Name, Business (Workshop or Parts Dealer) and location(latitude, longitude)
I would like to show those Accounts(Workshops/Parts Dealers) as markers on a google map in my Android app based on a radius around the user's current location. So it would be more than sufficient to get the data as JSON or XML(i read about sObjects, which would be nice too)
The app will be freely available on Google Play Store and every user should be able to see all the Workshops/Parts dealers around the world.
The problem I'm facing is that I can't find a way to fetch the data inside my app without authenticating every user with a Salesforce-Login. 
Which API is the best to use in this case?
It would be so awesome if anybody could help me with this problem.
What I tried so far: 
- SalesforceMobileSDK: If i extend SalesForceApplication() i always end up with the Salesforce-Login Screen.
It seems that every client has to be authenticated for API-calls to work. I tried using the method peekUnauthenticatedRestClient(), but this method only works on full path URL's(e.g. "https://api.spotify.com/v1/search?q=James%20Brown&type=artist"), which isn't really practical for my Use-case.
I feel like I read nearly all docs about salesforce API, but can't quite get my head around how to solve this problem, although it seems like to be a pretty common use-case.  
would a salesforce-apex method which would select all records inside a set radius around the user's location to be accessible without authentication?
Thanks for your help in advance!
Roman
Try asking on salesforce.stackexchange.com. Your question is more about licensing model than a particular programming problem. It might even be the case that you don't really need Salesforce for your project, you'd be better off on Heroku (even free tier) if the login piece is an issue...
All Salesforce APIs require some form of authentication. If you're positive you don't want to hardcode "Integration user" credentials in the app and you don't want to pay for (self-)registered user licenses in your org...
Try to read about these:
Site - piece of Visualforce running under specific "guest user", letting you view & interact with SF data without having to log in. You expose SF data to the world but that means it's your job to handle security (if any) and craft the API. You want to really display the data to human? Or just return JSON content or what...
Sites are meant to be displayin some incentive to contact you. Your product catalog / basic order form. Some map of nearby locations. Maybe a "contact us" form. There's limit on the traffic so eventually they'll explode as your app gets popular:
Customer Community - typically you need named licenses (even if they're fairly cheap) to let your customers log in to your SF. You create a Contact, click magic button - boom, this Contact now has a real matching User record with its own license. Think of it as some kind of step up from Sites - it'll still have some limits but will offer more than just raw API access and you'll have better control on what's going on.

Having problems getting Weight Data with Android from a BLE Scale

I'm currently developing an android app for a weight scale I received that transmits data through bluetooth low energy.
I was looking at documentation and if I got the information correctly, there are specific UUIDs for data. I received a BLE scale with a Chinese protocol document found here: http://www.anj.fyi/protocol.pdf
I found and was able to get a functioning scanner working that lists the device name and the UUIDs it broadcasts.
Lets say I want just the weight data to show up in the UI, nothing else and nothing more.
I don't know what UUID they used for the weight data, and there are a lot of UUIDs. Probably 20+. I checked a UUID compilation and the usual weight data UUID does not show up.
How do I get the data from those UUIDs?
I'm thinking it might be the ones that are notifications, indications or read properties.
Looking at the UUID for example, f000ffc2.
How would I get data from that characteristic? Would anyone have an example code to grab the data from those UUIDs, or tutorials because I'm terribly lost right now.
I really appreciate it.
There are no weight information on the document you list http://www.anj.fyi/protocol.pdf, it is only shows the BLE module hardware interface spec, i.e. it does not specify the detailed service and characteristic.(I an a native Chinese speaker).
Regarding to the UUID you want to know which is the one to represent the weight, yes you are right it should be the read/notification feature without write permission. Can you use the apps e.g. lightblue on iOS to receive the notification(meanwhile change the value on your device) to test it? this will help you to understand which characteristic is the one you want.

Reading and writing to EMV card

This is something new and I've never done any coding related to online transaction or debit/credit cards. I was told to study about EMV(EuroPay Master Visa) card to implement it in Android App.
So far, I have collected info about
APDU
file structure
"APDU Command" is sent to get useful info from card.
APDU fields (CLA, INS, P1, P2, Lc, Data, Le)
"APDU response" is sent back from card to card reader.
All these processes happen between the card and the card reader.
In my case, the card reader is attached to an android device. I may need to display card details to user in android app (Ex: Displaying last 4 digit of card number).
My questions are
what are the possible values in APDU command fields if i want to authenticate card.?
How to communicate between card reader and device using Java.
PS: I don't need any codes. I just need a simple explanation, I will continue R&D once i understand the concept.
What you are asking for is an EMV course, that's a lot for a SO question.
As outlined by #kushal, you'll have to go through the EMV Specifications, they contain a lot of command samples, and will describe the sequence of commands required to complete a transaction.
But by doing so, what you're trying to achieve is to write an EMV Kernel, which is costly and time consuming, as outlined in this SO question. Count a couple of years of development for this, not taking into account the bank integration part... If what you want to achieve is just to process transactions, what you want to do is to buy an EMV kernel (ex : from level2kernel, verifone, Ingenico, etc.).
You can take a look to an example of a an Interac Flash transaction (contactless EMV) here, that will give you an overview of the complexity of the protocol.
EMV Card SpecificationFirstly you have understand the EMV 4.2
Then You have to communicate with the reader to android device by the help of UsbManager Class. then send the specific APDU`s to the Card then the card give the Following information.

Categories