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

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.

Related

Implementing google smart action with custom device trait

I have been trying for a while now to create a kind of "controller" for my windows pc which is integrated with google assistant.
I would like to have actions like "Turn off the internet", "Shutdown" or "Open program".
However in trying to implement this with Google smart action API I see that it "only" supports a set of traits. I know I can "reuse" different traits for different actions, like "OnOff" to control pc power, but how about starting programs on my pc?
I would like to use natural commands (Hey Google, open Word), instead of the conversational API which is (Hey Google, talk to my pc -> open Word), but I would understand if that is not possible, since the traits are how Google HomeGraph knows which devices supports the users query.
Am I going into a rabbithole of impossibilities and should I just bite the bullet and use the Conversational API?
Any open source projects which is doing this would also be appreciated, end goal is implementing something myself, but inspiration is always nice.
I previously built my own PC integration with the smart home platform and gave it a few commands.
Going through smart home means that you cannot add custom device traits. Whichever exist in the platform are it. However, there are quite a few traits available for use.
In your set of use cases, there is an AppSelector trait and a NetworkControl trait. You may be interested in using both of these.

How to make an option to IMEI in CN1?

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

Systems that Access AD Attributes

I have been assigned a task to export the AD Attributes than find out what systems are using these attributes. I have not had much luck in scripting or a tool that can provide just that. Is this feasible and if so how? I have already exported attributes. Just need to find what systems are using them.
This isn't possible with any reasonable accuracy, especially if "using" isn't defined for you.
The event logs on the domain controllers will tell you where login events are coming from, but only by IP. That doesn't tell you which application is authenticating. You would have to do monitoring on that computer and see which application is making the connection. But then the logs would be cluttered with connections made by Windows itself, or Exchange (if you use Exchange for email). It it would be very difficult to identify what is coming from an 3rd-party application rather than Windows itself.
Also, applications can request more information than they need. It's very easy when programming with LDAP to request every attribute for an object, even if you only intend to use one. For example, take this C# code:
var de = new DirectoryEntry("LDAP://example.com");
Console.WriteLine(de.Properties["name"].Value);
That only "uses" the name attribute. But because of the way LDAP works, it actually requests every non-constructed attribute that has a value. (there is a way to specifically ask for only one attribute, but you have to know that and use that)
So even if you could find logs saying that "this IP requested all of these attributes", and then figure out which application made that request, that doesn't mean it "used" all of those attributes.

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.

Who supports WTAI (Wireless Telephony Application Interface)

Does anyone know how widely WTAI is supported in mobile phones, or can point to a list of supported devices.
The great majority of device support some WTAI primitives (because they are include in WAP). Those are current supported: WTAPublic.makeCall, WTAPublic.sendDTMF and WTAPublic.addPBEntry
More information here and here.
I came across a couple resources on device capabilities today.
DeviceAtlas
and
WURFL
It depends on what you are hoping to use WTAPI for.
If it is for a wap site then check out Device Atlas or WURFL, or Mobile elements
The next problem that we have is after you have the click to call link, you need to track it we have done this in the past using a service like OnSip.
Whereby each call goes to OnSip then they forward the call onto the correct number they then call to a url hosted on our servers whenever a call comes through enabling us to track the number of people who clicked on the click to call link

Resources