I have a C# app running on my windows machine. The app can detect a specific phone (over bluetooth) and according to the phone's presence or not, it popups a message to the user. The C# app checks for the phone's presence periodically. So far so good.
I want to add a third "player" in the game i.e. an NFC smart card.
Now, I want the Android phone to act as an intermediate; it will receive the periodically sent request from the C# (windows machine) application, will check if a certain smart card is close (over NFC) and get back the answer to the C# application. So, now the C# app checks for both the phone's and (indirectly) the card's presence.
I want the application on the Android to constantly listen to the bluetooth interface and if the request from the C# (windows) application arrives, to check if the card is close. The answer ("yes" the card is here - "no" the card is not here) should be sent back to the C# application. I currently don't care about security or anything else. Only the existence of the card.
Do you think that this can be done?
Thank you!
The problem is, NFC in Android does not work that way. Its not as if the phone is "checking" if there are some cards near. Its event driven, not polling. When a card is put close enough to the phone, an aproriate intent is fired. your app can handle it.
As for your particular problem, the solution would seem to be setting up a flag each time a card is detected and feeding it to C# app via bluetooth. Remember tho, NFC isnt putting a card into a contact reader. The card may have been near the phone a second ago, but it might as well already be gone. Also, eep in mind, that NFC range is small - you have to almost touch the phone with the card.
On handling NFC intents check out http://developer.android.com/guide/topics/connectivity/nfc/nfc.html and http://developer.android.com/guide/topics/connectivity/nfc/advanced-nfc.html
I did not work with NFC-Tech or Android this far, but it should be possible.
Having the C#-Code constantly listening to the Android device is ok, like you said, you will need your android device to route the NFC-Listener.
When the Android device detects an NFC-Card, it should be easily given to the C# Code via some custom method.
Related
Context: I'm working on a Windows 10 app that will allow users to quickly connect to a Bluetooth device. Because the native API is difficult to work with, I'm using the 'In The Hand' library. Anyway, back to the point: whenever I make a connect request. Before allowing me to connect, I receive this Pair a device notification.
I'm wondering if I can set Windows to automatically accept this permission for connecting the device. Is there a method in the Windows API that I can use to accomplish this?
Here is the link to the code: https://github.com/hasham7861/bluetooth-le-experiment/blob/master/Program.cs
In the picture I make a connect request to a bluetooth headset and then I get the notification on the bottom right, and only if I click allow to pair device then it pairs the device.
I hope this link helps you.
I apologize in advance if I misunderstood the question or if the data were meaningless
Windows 10 Connect to Bluetooth Classic Device without Pairing
https://github.com/microsoft/Windows-universal-samples/blob/main/Samples/DeviceEnumerationAndPairing/cs/Scenario9_CustomPairDevice.xaml.cs
I'm implementing a game in Unity and I have a problem that I need advise for. I want to connect a tablet and a computer. The scene that is on the computer is supposed so send an event once an object is collected so that a special scene can be shown on the tablet. So based on what is happening on the computer there is a different scene shown on the tablet.
I only have no idea how to achieve that.
First, you need to create 2 different applications (for desktop and mobile). Second, you need to determine what protocol you want to connect desktop app and mobile app. The easiest way to implement this I think by using WebSocket/internet but not HTTP. Yes, you need to write code for the backend so it likes creating 3 different apps. But you can use firebase to simplify this process.
I recommended you use firestore from firebase. Connect booth app to firestore. When desktop app sends data to firestore, firebase will automatically notify mobile app and send that data. But you need to figure out yourself how to pair a desktop app and a mobile app otherwise, your firestore will receive data from all connected desktop app and send the same data to all connected mobile app.
This tutorial to use firestore:
https://www.youtube.com/watch?v=b5h1bVGhuRk
But before that, you need to add firebase to your project before you add firestore:
https://firebase.google.com/docs/unity/setup
You can use any wireless protocol available. You can even use Bluetooth if you want your app offline. But I don't know how to use Bluetooth...
It may seems to be an unusual question at first but let me explain what I try to do.
I've developed a program which is able to hook into a 3rd party program called PS4 Remote Play. The PS4 Remote Play program only allows you to use a real Dualshock gamepad for controlling your games.
So my program is hooking into low level APIs from Windows (kernel32.dll, hid.dll) to bypass this limitation. What my hooks are doing is whenever CreateFileW is called for an HID device my program returns a custom dummy pointer and the corresponding hooked hid.dll methods which are called afterwards are acting like this dummy pointer is a Dualshock gamepad.
So far so good. But recently I got some reports from users of my program that the "emulated" Dualshock is not working and the inputs send to this virtual Duashock are not processed. It took me some time to figure out why. Whenever a user is using a laptop or a PC without an HID device connected, the PS4 Remote Play program never calls the CreateFileW, at least not for creating an HID handle.
I don't want to install a dummy driver with my application for just making Windows think an HID device is connected. Instead I try to hook into the functions of setupapi.dll and only make the PS4 Remote Play program think a random dummy HID device is connected so that it calls the CreateFileW method. I'm already hooked into
SetupDiGetClassDevs
SetupDiEnumDeviceInfo
SetupDiGetDeviceInterfaceDetail
But I have no experience with this API so I have a few questions.
Does the device information set returned by SetupDiGetClassDevs always contain a device information element for HID devices even when no HID device is connected? If not, how can I add a fake device information for HID devices or how can I create a fake device information set in C# and return that instead? Or is this not needed at all, as I can just hook into the other two methods and do something there.
Any advice or hint how I could solve this issue would be great. It is not necessary that Windows think an HID device is connected only the 3rd Party program should act like there is one connected to the PC.
I have a question regarding the possibility of creating a winforms application in C#, which is able to detect incoming calls on an iphone.
Here is the scenario:
the iphone is connected to the computer via a usb cable.
whenever the phone rings I would like to be able to do the following:
Retrive the phone number.
Use the phone number in the winforms application, to search xml filer.
Answer the phone via the application and play an automated voice message.
Is this even possible in C#? If so how could this be done and are there any libraries designed for interacting with an iphone using C#??
Thanks and regards.
Anders
There are no SDK's that allow you to develop .NET apps that interact externally with the iPhone.
If you want to write an iPhone app, but are intimidated by the learning curve you could check out MonoTouch. It allows you to write iPhone\Android apps using C#.
well guys, i am part of one team. (I dont have the project yet, i am new).
They did a application using gps, problem is it fail sometimes...
why? they think gps fails because users has the device in "energy saving" mode; then the device hibernates
after 5 minutes if they dont use it.
GPS brings sometimes bad coordinates (for example coordinate shows users is on "SEA" or in "Japan". I repeat, My partners thinks problem is because device is in "energy saving" mode. how can i change this configuration with C# while application is running (maybe back old configuration when application has been closed).
I am using this library.
using Microsoft.WindowsMobile.Samples.Location;
I can't check if it works because now i dont have a device, and i my computer doesn't have GPS, do you have any idea for i can check the application?.
i am using
`"Windows Mobile 6.0 SDK"`
You can install networking functionality while using the Microsoft Device Emulator. This blog explains how to setup network functionality on Windows 7. Follow the official documentation if you're not using Windows 7.
You can emulate GPS functionality using the FakeGPS program supplied by Microsoft. If you want anything close to real data you'll need a text file containing raw NMEA to feed into FakeGPS. You can simply record bytes passed through the GPS COM port to a file to generate a NMEA file. If fake GPS doesn't like your file then remove the non-standard NMEA lines and try again.
You should do some research on Windows Mobile Power Management first to understand the problem. The quickest hack is to simply call SystemIdleTimerReset() more frequently than the battery idle timeout (use SystemParametersInfo() and SPI_GETBATTERYIDLETIMEOUT) to prevent the device from sleeping. This will decrease the battery life of the device! There are other more elegant solutions available such as using the Power Management API.