How to get SKU code, Buyer Code and CSC in Android Studios - java

I'm developing an Android App and I need to be able to capture the SKU, Buyer Code and CSC of the device (only Samsung smartphones). I guess I only need the Buyer code (Country Code) and the CSC, but I've been searching and it looks like the SKU code already has these two codes.
I need these codes so I can restrict my App to some specific smartphones, specifically those that where bought in a specific country.
I can't find a way or a class that will help me get these information. I'm already capturing the device's IMEI and model, but not the Buyer Code or CSC.
I appreciate if someone can help me with this.

I found that post providing some Basic information.
How to obtain Firmware version of Android programmatically?
Some data like CSC are given by different ways depending on the manufacturer.
For Samsung for example, you will find information about software in /system/SW_Configuration.xml and about buyer in /system/csc/sales_code.dat and /efs/imei/mps_code.dat

Related

Android emulate NFC with Smartphone as reader

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

Select entries that contain information about smartphones among other data

I'm not sure on how to approach the following problem, and I'm looking for some guidance:
I have a File which contains an random Ad Title on each line. What I need to do is to classify each title in smartphone or not-smartphone, depending if the Ad is selling a mobile phone or not.
I'm sorry the file isn't in english, but here is a screenshot showing a little bit of it:
complete file here
Problems I've encountered:
Some Ad titles are related to smartphones, but they aren't actually selling phones, but something related to it (acessory). Example: an ad selling phone cases for Iphone X
Some ad titles doesn't even have the phone brand, but only the model. Example: "White Xiaomi Mi Mix 2s Global 64GB" or "J7 Pro 64gb 4g J730".
It would be perfect if there was a way to extract the exact phone model from the title, but since each ad title is formatted differently, I couldn't find a way to do this.
Usually brands produce a variety of products, and smartphones are just one type of product. So when I filter by the brand name, it often returns me ads which aren't related to smartphones at all (tablets, TVs, chargers, etc). More filtering would be needed
Even though I am allowed to use it, I couldn't find some DB with a list of all smartphone models, or I don't know how to retrieve information from them.
What I've thought so far:
if I had access to a DataBase with a big quantity of smartphone models, I could directly search the file for each model name (example; "Iphone 5s" or "Moto G6").
I tried using FonoAPI https://fonoapi.freshpixl.com (which is a smartphone database for consulting data about the phones using java,php, etc) to search for smartphone models from a specific brand, but the api will only return a max of 100 results per time. So in order to use it, I would need to extract the product model name from the title so I can check if it is listed in the FonoAPI DB
So since each ad title in the file is formatted differently, I'm looking for some ideas on how to do this, because I couldn't find a way to extract the product model from the title to compare with FonoAPI database, neither get access to some big DB containing a vast quantity of models to directly look for them in the file.
My answer is not very precise and more like ideas i wanted to propose (because i like this problem and would be happy to get the file, seems like it is impossible to get it from your link).
First, as all NLP problems you need to ensure all the text is formatted the same way.
To get a phone model database. I would try to get a database with phone brands. Then go on a selling website to do web scraping. This way you would get a lot of phone model.
I would try to use some NLP model like LDA, but with another formatted way (like getting away the words beyond a limit after gb and the phone brands. We can hope all the phone are close to those words).
This can be stupid ideas, but i wanted to share (and i can not comment :D).

Is telephony manager values reliable and changeable (cdma)?

I want to know if I can rely on the telephony values like country, MCC, etc on Android for my app. Can I change them on the run using setprop? I tried changing using setprop it didn't seem to work. From my understanding telephony manager is a class/interface which represents Hardware configuration of GSM or CDMA. In case of GSM this could be sim and in case of CDMA it cud be a hardware. My questions are:
Who update these values in both the cases for the first time?
Are these values are saved by OS as read only?
What if a user travels to different country or zone will some of the values like country code and MCC values updated automatically?
Can I reset these values?
I have no intention of changing any of these values but want to understand its working! I would appreciate if someone can help me on this.
According to android documentation
Provides access to information about the telephony services on the
device. Applications can use the methods in this class to determine
telephony services and states, as well as to access some types of
subscriber information. Applications can also register a listener to
receive notification of telephony state changes.
TelephonyManager is used for reading phone information. Regarding your question about MCC & MNC codes: yes, they will change when phone will be in other country. You can subscribe to receive those events and determine that user now in different country.
#Bo
The way CDMA works is different from GSM. CDMA has always got one home base and many visitor base location. and you can always get to know about visitor Operator using TelephonyManager methods which is considered as unreliable for CDMA.
I decided to add it as answer as well...
I found a way to tackle this problem on CDMA phone.. if it is a CDMA phone , then the phone always has an ICC hardware comparable to SIM cards in GSM. All you gotta do is use the system properties associated with the hard ware . Programmatically you can use Java reflection to get this information . This is not changeable even system is rooted unlike GSM device. Class c=Class.forName("android.os.SystemProperties"); Method get = c.getMethod("get", String.class); String homeOperator = ((String) get.invoke(c, "ro.cdma.home.operator.numeric"));

Android In-App billing - some cards not accepted

I get a lot emails lately that someone tried to pay inside my application with in-app billing and they get a "card not supported" kind of error on the Android in-app billing window. These same people report that they are able to buy other apps directly on Android Market, and with the same card they can't pay in-app.
I tried to contact Google but no response yet (I will post an update if I get an answer).
Have you experienced something similar? And then some people run into the in-app billing bug, where your order is "pending" and you can't do anything. I get negative feedback and this is outside my responsibility.
I think I found a solution for my problem. It was most probably caused after we asked Google to transfer the whole Android account to a new gmail address. I have checked the in-app products in the Android Market console and the the price field was empty on the new account! Only the country specific prices were set. I am pretty sure that the price was set before the account was changed. So I edited the product and entered a price and I asked a customer who previously couldn't pay to try it again. It worked!
So be sure to check if your in-app products have the price set (and not only the country specific price values).
BTW. Google also changed our public key while switching the accounts. People were complaining the whole day that they paid and didn't receive the item. Well Google took the money but the information was delivered signed with a new public key and was not recognized on the devices.

Get device unique ID

Is there a way to get a device's unique identification using MIDP2.0?
I assume you need to get the IMEI number of the device.
According to the information I found there is no J2ME method to do that because the Hardware API is different from a one model to another. But the device manufacturers provide APIs to get the IMEI number.
Have a look on following article.
Get device ID

Categories