How to make an option to IMEI in CN1? - codenameone

I am clear that in ANDROID there are restrictions to obtain the IMEI, but I need to guarantee that the project I have is installed only on allowed cell phones. For this I think that a unique code is necessary that is generated from the cell phone (equal to the IMEI) and that is stored in parallel in the server's database to validate that it is correct.
Is there any way to simulate this condition from CN1?

Google play will block the installation of your app. If you still want to do it you can use:
String IMEI = Display.getInstance().getProperty("IMEI");
Notice that you would need to add the "read phone state" permission to the manifest for this to work.
I don't think this is a good idea though. How will you find the IMEI in the first place to perform the restriction?
Blocking installation isn't a practical option, you should block access so unauthorized users won't be able to launch the app and that's more portable too.

Thank you Mr. Shai, my project blocks access to unauthorized users, but there is the alternative of installing the application on another cell phone and that is what I want to avoid.

Something important, the following link talks about an alternative to have a unique code, but it is totally oriented to android and I do not handle it and I do not know how to implement it in CN1. I copy the link to see if its integration is possible.
Android 10: IMEI no longer available on API 29. Looking for alternatives

Related

Prevent from duplicate installation in different devices

We provide a subscription to our app.
Are there any standard technics to prevent users from duplicate installations in different devices?
In app payment requires that you let a user restore his purchases on a different device. I'm not aware of a standard way to verify that the previous devices content was removed.
If you're asking about just copying the files then there's storage encryption which you can read about here. Notice that it is breakable if someone tries.
You can collect device information from each device and then just compare if the new device is trying to install the app with the same account as in another device.

How to get current system DNS resolvers ip-addresses in codename one?

Is there a way to get all current system DNS resolver ip-addresses in codename one?
The classes NetworkManager and ConnectionRequest don't provide these information.
In general Codename One seems not to provide any way to access a devices communication status information like "Wi-Fi Mac address", "IMEI", "Mobile network type" etc. Am I right?
Do you mean something like Socket.getHostOrIP()?
There is no standardized explicit DNS lookup API though.
Most of these things aren't available across platform or even consistently within the platform. You can use Display's getProperty with "IMEI", "UDID" & "MSISDN". But that will only have any chance of working on Android and you will probably need to add the build hint for permissions.
You can also always use native code calls as explained in the developer guide and the How Do I? video.
I would suggest that you revisit your need to get these values and evaluate a way around them. E.g most advertisers no longer require them as they aren't provided by all mobile OS's.

What is equivalent usage of sendmessage()[WINDOWS] in MAC OS X?

I have a ContextualMenuPlugin and an application. When user clicks the option from context menu i need to send a message to my app. In windows i achieved this using sendmessage() function. But i'm new to MAC OS X. Can any one please help me, by giving some api's or functions which will enlighten this situation?
You have plenty of choices on how to get messages into an application on your Macintosh.
The ways I'm thinking of include Apple Events or sockets or kqueues, but there's other stuff I've never even worked with that might even be more useful & appropriate (such as Distributed Objects). Check out this duplicate and/or related question and maybe you'll see a useful answer in there for you that you can build upon.
B.T.W.: how did you construct your Contextual Menu Plugin? Is it in Carbon or Objective C or is it some codeless plugin or plist or? The answer to that question probably will dictate a lot towards how you will be able to talk from your plugin to your app.
If you want to control just your application you might want to look into AppleScript. Using that solution has the added benefit that your users could also use it to automate things via scripting.

How to switch users in a smooth way in a Point-Of-Sale system?

I am designing a Point-Of-Sale system for a small shop. The shop just have one Point-Of-Sale but often they are one to three users (sellers) in the shop. Each user have their own user account in the system so they login and logout very often. How should I design the login/logout system in a good way?
For the moment the users don't use passwords, because it takes so long time to type the password each time they login.
The Platform is Windows Vista but I would like to support Windows 7 too. We use Active Directory on the Network. The system is developed in Java/Swing for the moment, but I'm thinking about to change to C#.NET/WPF.
I am thinking about an SmartCard solution, but I don't know if that fits my situation. It would be more secure (which I like) but I don't know if it will be easy to implement and smooth to use, i.e. can I have the POS-system running in the background or started very quickly when the users switch? Are SmartCard solutions very expensive? (My customers are small shops) Is it preferred to use .NET or Java in a SmartCard solution?
What other solutions do I have other than passwords/no passwords/smartcards?
How should I design the login/logout system in a good way?
Is there any good solution using SmartCards for this purpose?
I would like suggested solutions both for C#.NET/WPF and Java/Swing platforms.
I would like suggested solutions both for Active Directory solutions and solutions that only use one user profile in Windows.
How is this problem solved in similar products? I have only seen password-solutions, but they are clumsy.
An interesting solution is to use "Fast User Switching", i.e. the capability to have multiple user sessions open on the same PC. The POS software could be launched through the Startup folder of each seller account and would stay active in each seller session.
I thought that being in a domain (i.e. using Active Directory) disables Fast User Switching, but according to The old new thing, this was true on XP only. I just checked with my Win7 machine at work: it is in a domain but still has the "switch user" menu item.
The main advantage is that if your software is already multi-user aware, you don't need to change it.
I should have made the Fast User Switching check before writing what is below, because this seems to be the simplest solution. Here are other ideas, anyway.
Another solution is what you mention of having a single Windows user but several "virtual users" that your application manages. A smart card is a good way to implement a pseudo-login. In C++, the API allows detecting the removal or insertion of a card, so the application could detect this and read the card after insertion to know who's currently in front of the computer. .NET can easily call this API through P/Invoke; I don't know much of Java, except that JNI could be a solution to call the native API if there is no managed library that publishes this capability.
What should be done is researching the different types of card and how to talk to them, as your app should use a card that does not require a PIN to be accessed (or you are back to the slow login system, except if tying a 4-digit number is not considered too slow).
I've seen restaurants where waiters insert a key into the cash register in order to be identified. I googled "cash registers" but could only find a complete solution package, rather than the components like a key reader.
An almost idiotic question is: how much security do you need ? Does it make sense to have big buttons on the first screen of the app, where people click in order to tell the system who they are ? When they are done, they click on a "Finish" button and the app goes back to the "identify" screen. I've put this at the end because it is so simplistic that it has a low probability of being useful.
I'm not familiar with a broad range of smart card provider solutions, but I know Gemalto has a .Net friendly setup. Most others are geared to Java, but support is widening.
With regards to switching user sessions and your application, it depends on how "heavy" your application is. If your app requires quite a bit of start-up time / resources then you might consider creating the basic application as a service on the machine which can run in the background continuously and then you can load a light-weight UI to interact with the service with each user session (maybe launch via Startup menu).
There is a C# project on CodeProject which provides a framework for interacting with smart card services in windows - might be interesting reading.
I had a chance to work with the Open Source Computer Vision library (OpenCV)
in one of my past projects and its "Face-Recognition" is what you're after. It is written using native code, but can be easily used with Java, .NET, Android, iOS. All you need is a webcam and a button "Switch User" with the onClickListener that will take a picture and compare it with the images of your employees. Advantage? Once the picture's taken, it gets processed in less than 10ms. And as Timores mentioned earlier, once the face is recognised, you simply switch the session. Simple yet effective solution. Good luck!
maybe you want to think about using barcode scanner... probably you already have this device on POS ... my software for bars and restaurants use barcode scanner to recognize users. You have 2 options for using: first, user must log in with own barcode card, then he can use the application ... the second is better, everyone can use application, but to print the receipt user must use barcode card. After then he is responsible for that amount on this receipt.

Any way to get the location of a cell phone?

Is there any way to get the location of a cell phone (i.e. latitude/longitude) automatically when the user views a web page? This will primarily be used outside of the United States, so if there is some international standard that the US may or may not follow, that's what I'd need to know.
You can use their IP address to get a general idea. It's not very specific, but it works.
This place has a web service that will let you get their location with PHP or another server side scriping language.
http://www.geobytes.com/IpLocator.htm?Getlocation
There is no standard. The GSM and CDMA phone systems can easily be traced as per their design but you as a non government / network operator cannot trace a cellphone without a user's permission.
Do the words invasion of privacy come to mind?
I know that google has a service that can publish your GPS location if you wish, but this is opt in and you are able to switch it off.
As a iPhone user, I know that there is some applications that actually ask the user permission before geolocating there position. So there might be something in the iPhone SDK.
That way, it is reasonable to think that there is some way to do it.
Firefox 3.5 now supports geolocation, but it's not a very popular mobile browser.
http://en-gb.www.mozilla.com/en-GB/firefox/geolocation/
I'll probably try using Latitude with it's JSON feed.
See Yahoo's Fire Eagle service. Your user would require a Fire Eagle account.

Resources