I was reading this article about NFC and Kotlin and tried to implement the Code in my App. I want to send a string from one device (from the customer) to the receiving device (supplier) for a faster checking - in (for example if you have booked a table, the device reads the booking-id from the customer-app and displays the regarding information on the supplier-device.
The problem is that:
this.nfcAdapter?.setOnNdefPushCompleteCallback(outcomingNfcCallback, this)
this.nfcAdapter?.setNdefPushMessageCallback(outcomingNfcCallback, this)
both Callbacks from the NFC Adapter are deprecated since API 29.
So is there any other way left to do this?
Google's documentation mentions the following concerning the deprecation:
File sharing can work using other technology like Bluetooth.
Indicating the feature was originally intended for file sharing,
not the sending of short strings.
Two solutions come to mind:
On the customer's device you generate a QR code containing the string you want to send over. With the supplier's device you scan the QR code. This way is often used for mobile payment and customer reward/discount apps.
A web service where the customer sends over their ID and then information is returned from a database.
You can also combine these approaches by for example letting the customer scan a static printed QR code containing the supplier ID. With the supplier ID your app could then submit the customer's booking ID and the supplier ID to your web service after which booking info is returned.
Related
Background
In the "Phone" app of Google, there is an option "Caller ID & spam" :
So, if you get a call from someone or some organization that isn't on the address book, yet it is identified somehow, you get a name for it, as such (called "+972-035283487") :
Ever since Android M (6.0 - API 23) , apps can replace the default phone app, and then also providing alternative UI when you call someone or get a phone call, by extending InCallService class, as demonstrated here which is based on here.
The problem
I want to try to show the same information as on the Phone app, meaning the name of the person/company in case it identified it (and it's not on the address book).
What I've tried
I tried to dig over the various things that I get via the API of the dialer, but failed:
Various fields and functions of: android.telecom.Call class
There is getDetails inside of the Call class, so I tried to get what's inside there, and there is also statusHints and "label" inside the "statusHints" . None of those had any information (returned null). The reason I tried to look at "statusHints" is because that's what I see on the docs :
Contains status label and icon displayed in the in-call UI.
On the "Phone" app, pressing "Learn more" goes to a website (here) full of links that I think might be sources of the data, but I don't think the app itself uses this. Instead I think it uses something of Google.
The questions
Is it possible to get this CallerId information? If so, how?
How does the Phone app do it? It's supposed to be open sourced, so there has to be something that gives it this information, right? Would cloning it somehow get this information? Maybe Google has its own service for CallerID?
What are the "callDetails" and "statusHints" used for? What do they provide?
I believe Android's native phone app is using Google's place search API. As you can easily search for a place by its phone number and get place details like name, place id, formatted_address and many other fields that you can find in the documentation
Request URL:
https://maps.googleapis.com/maps/api/place/findplacefromtext/json
Request method: GET
Request query parameters:
key: Your application's API key.
input: The text input specifying which place to search for (for example a name or phone number).
inputtype: The type of input. This can be
one of either textquery or phonenumber. Phone numbers must be in
international format (prefixed by a plus sign ("+"), followed by the
country code, then the phone number itself).
Example request:
https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=%2B972035283487&inputtype=phonenumber&fields=place_id,name&key=API_KEY_HERE
Example response:
{
"candidates" : [
{
"name" : "מלך העופות",
"place_id" : "ChIJ78ko1zBKHRURpwbgUdWc4nU"
},
{
"name" : "Of Yaakov",
"place_id" : "ChIJv3myn4FMHRURUGffcXgxKuw"
}
],
"status" : "OK"
}
Note:
Such an API is not available at the current moment in Google places SDK for Android, but you can use the HTTP API directly in your app or you can make an API in the backend as a proxy to the places API. I prefer the later version as in the first solution the API key is deployed in the application code and hackers could decompile the APK and use it for malicious reasons. For security reasons you have to restrict the usage of the API key to the IP address of the server in case you are using the backend solution!
I tried to decompile the Dialer app, couldn't find the specific info about how the app is doing it.
But this info could be useful. Please check it.
In Dialer app, there are classes SpamCallDatabase_Impl.smali SpamCallDatabase.smali
and there is service running in package com.google.android.gms app, which provides spam lists
com.google.android.gms/.telephonyspam.sync.SpamListSyncTaskService
and for caller id check this commit
https://gitlab.e.foundation/e/os/android_packages_apps_Dialer/commit/420eb901ed1d64fdaf055cde4cc46d7a5c0b42fc
This looks dialer app of lineage os
and it uses different services for phone num lookup like
https://auskunft.at/
https://www.dastelefonbuch.de/
I believe Google has its own database of spam callers, and the Phone app sends the number to its server, and if there is a match, it shows the name.
Maybe, if your app can read notifications, there is a possibility to retrieve that name. Try this example out and modify it according to your needs
You could check the working of apps like Truecaller for this. Truecaller acts on a give and take scenario... You want those unknown numbers then you have to part with your phone book contacts.. Now apparently everyone who has installed the app has surrendered his phone book. The data is crowd-sourced from the millions of users who have downloaded the truecaller app on their smart phones. As part of the end user agreement, the truecaller app asks the user to allow access to the user's address book/contacts on the smart phone. This data is then uploaded by the app to the company's servers. After going through several data matching/refining algorithms, this data is made available to all truecaller users to search upon.
Google Phone app is provided a feature of Use caller ID & spam protection by default. Some of these steps work only on Android 6.0 and up.
When you make or get a call with caller ID and spam protection on, you can see information about callers or businesses not in your contacts or warnings about potential spam callers.
To use caller ID and spam protection, your phone may need to send information about your calls to Google.
Turn caller ID & spam protection off or back on
Caller ID and spam protection is on by default. You can choose to turn it off.
To use caller ID and spam protection, your phone may need to send information about your calls to Google. It doesn’t control whether your number shows when you make calls.
Caller ID by Google shows the names of companies and services with a Google My Business listing. It also looks for matches in any directory that shows caller information for work or school accounts.
As per your solution, Google does not provide this kind of support as you want. you need to create your own function and save spam and other contact detail at your side.
I've been working with Firebase for 1 month, and now I'm starting to understand how it works.
In my App I've got some supermarket products like fruit, vegetable or others.
In real life I've got some NFC tags applied on the products.
In the database, there is a node which contains products, one node which contains NFC Ids, and one node which contains relations between them.
The Product's keys are pushed Ids while the NFC's are their Ids.
With my phone and the embedded NFC reader I can read the tags and tell the system which product I'm scanning.
Now I'd like to create a record each time a phone reads a NFC.
On the record, I'd like to put the data about the phone, the NFC Id's and the Product Push Id.
Is there a Server Side way, maybe with rules, to query the relation between NFC and Products and put it on my new record, the Product Id instead of the relation Id?
In this way I'll cut a lot of Client Side code which is making may app too complicated.
Thanks.
I have also faced this problem. However, Firebase has introduce Cloud Function a month ago. Try to check the official link out. It allow you to put some logics in server side.
https://firebase.google.com/docs/functions/
I myself haven't done much research on this feature but instead of thinking about the communication as Request and Response you need to see it as Database trigger event.
Is this what you looking for ?
I want to build an android app, that when you put your phone on nfc tag, the app connect to server (I suppose database will be in web server) and get the data from database, and when you put a phone on second nfc tag it connect again to server, but this time gets diffrent data from database(must be there new database).
So basically I' am new to servers and databases and if this is posible what I mention above or at least a similar. Can you provide me with some tutorials that I can learn from and will help me build this.
Please go through the following link,
http://developer.android.com/guide/topics/connectivity/nfc/index.html
It has all the tutorials on how to utilize NFC on Android. It has certain API's available as well which you can use. The part where first it does a different operation and the next time a different one all depends on you on how you deal with it. You can write a condition based on a boolean value to see if its a first time or second.
Hope this helps.
I am asked to develop a mobile POS android application which will read the Chip Card Data from device (like Square) which can be connected to the audio jack of cellphone. Till now I have successfully done the following:
(1) Detected the device on the audio jack.
(2) Read all the data that is there in the Chip.
(3) Read the tags data/ public keys and certificates which are required for transaction processing.
(I am aware that it is not right/illegal to read this user data - I am not going to store any of this on my device)
I know that the next step would be to integrate my application with a payment gateway.
Working on this, I successfully integrated PAYU Money (a Payemt Gateway) with my android application. It directs me to a "form" where the cardholder needs to fill his information such as NAME, CARD NUMBER, EXPIRY DATE etc.
I have already extracted this data from the EMV chip. But I am unable to send it on THAT form. I don't want my clients to fill any of the data except PIN number to complete the transaction.
I tried to look for other Payment gateways which could directly take the data from my app (Point to Point) but haven't found yet.
Now, I am stuck at what do I do now ? Where do i go from here ? What steps do i follow to get this project done ?
I am also wondering if I am headed to right direction ?
All help or guidance would be highly appreciated. Thank you
K,
You may not be able to do it this way. There are two ways to complete a transaction online :
using a webform where you fill in data printed on the credit card : card number, expiration date, cardholder name (which are also accessible by reading the card chip/magnetic track) AND cvv number written behind the card (which is NOT available in the chip).
using a POS application, which will complete an EMV dialog with your card in order to get it to sign and approve the transaction.
It seems you're trying to achieve option 1. Unless someone manually inputs the cvv code, you won't be able to complete the transaction.
However, the mention of a PIN number implies that you want to do an EMV transaction (there's no PIN for webform based transactions). This is a painful process, which will require to use a certified EMV kernel (or a couple of years to code your own), and to get a certification for your application. Most likely not what you're trying to do.
Last option, use the Square Connect API, whil will take care of the payment processing for you. Unfortunately, you would have to switch to iOS, since it's not supported on Android.
First of all, apologies for the lack of code within this question. It's purely for information to further develop my project.
I'm after using nfc tag technology with mobile phones, what I want to achieve is on scanning of an nfc tag, my local or cloud server is updated with the ID and time/date of scan.
I've looked on various forums, done countless searches on the web but for some reason cannot find a clear point to start from.
I'm comfortable with all web languages however I just can't get my head around the process, do you scan a given nfc tag which then loads a url with the ID of the tag in a get method.
Or is there something I can do within an app which will update the server on scan.
Again apologies.
A simple way is to store a URL in the NFC tag which points to your server application. You can add an ID to the URL, which identifies the tag towards the server. The timestamp can come from the server, when he receives the HTTP Request. Your server application can then store the ID together with the time.
This approach will not need any specific app on the mobile, any NFC capable phone will do that out of the box.
Should you need a local timestamp from the mobile phone, then will need an NFC app which takes the NFC intent, formes the proper URL including the locally generated data and send that off to your server.