I'm using the J2ME contactless API (JSR257 - javax.microedition.contactless.*) to read smartcards on a Nokia phone. The following code works just fine and the targetDetected method is called as expected when I put a card on the phone:
DiscoveryManager dm = DiscoveryManager.getInstance();
dm.addTargetListener(this, TargetType.ISO14443_CARD);
public void targetDetected(TargetProperties[] tps) {
logger.log("found card!");
}
However, I'm wondering if there is any way to get a callback when the card is removed? Or is the only way to check if the card has been removed to try and open or read from a connection and catch the appropriate exceptions?
Related
Im trying to check if url is malicious in my app. But the output always return that the link is safe even when i put malicious link. Im developing the app using Android Studio and use both GMS and HMS library. Im running the app on my device which is Samsung and its working fine except for the problem i mention above. Help me please.
And one more thing, I've downloaded the appGallery on my phone and install hms core. But do i still need to convert gms library to hms library?
Thank you.
This is the response code.
#Override
public void onSuccess(UrlCheckResponse urlCheckResponse) {
List<UrlCheckThreat> list = urlCheckResponse.getUrlCheckResponse();
if (list.isEmpty()) {
// No threats found.
testRes.setText("No threats found.");
} else {
for (UrlCheckThreat threat : list){
int type = threat.getUrlCheckResult();
if(type == UrlCheckThreat.MALWARE){
//threat.getUrlCheckResult();
testRes.setText("Malware found!");
}
else {
if (type == UrlCheckThreat.PHISHING)
//threat.getUrlCheckResult();
testRes.setText("Phishing found!");
}
}
}
}
Could you please send me the link? That way I can do research. Please note: maybe the link is totally new so it may escape detection.
For your other question: "I've downloaded the AppGallery on my phone and install hms core. But do i still need to convert gms library to hms library.".
The answer is no, you don't need to convert anything. But note: you must integrate Huawei SDK when you try to use Huawei Kit features on your GMS phone or HMS phones.
Apparently, the API to check list of malicious URL took time to function. The response code was functioning well and can detect the malicious URL. Thank you for all the responses.
UPDATE:
Suddenly I tried to attempt this time and it suddenly works without changing any codes on my application and firebase console. I don't know why/how can someone explain? Does anyone know how to prevent this issue?
this is my verification code history
https://i.stack.imgur.com/U2vMB.jpg
ORIGINAL POST:
The onCodeSent is triggered but can't receive any SMS code. It happened to me last time but it turns fine after a day. But last night I can't receive any SMS again without any changes from my android studio codes and firebase in regards to phone authentication. It is the same thing that happened the last time. And earlier as I woke up around 7:00 AM, I can receive an SMS code but then again I tried testing it out again at around 12:00 PM I can't receive any SMS again. I'm not sure what is the problem here. I need an answer as soon as possible because I need my project to be presented on defense next week. Thank you
Also tested on another device from another location. It does not receive any SMS too. Also tried my old project application which is working/receiving SMS but has the same issue.
Firebase Console:
Phone provider is enabled
SHA-1 and SHA-256 were applied
Phone number for testing is empty
Android Studio:
Connected to firebase project
No code changes in regards to phone auth
onCodeSent is triggered but can't receive any SMS code
Correct number was provided
Web API Key from firebase console was applied to (curent_key: "key") google-services.json
Also tried to clean and rebuild the project.
sometimes I receive an SMS code, and not sometime.
Toast from onCodeSent was showing. I also try to reveal the token and verificationId and it was not null.
private void sendVerificationCode(String contactNumber) {
PhoneAuthOptions options =
PhoneAuthOptions.newBuilder(mAuth)
.setPhoneNumber(contactNumber) // Phone number to verify
.setTimeout(60L, TimeUnit.SECONDS) // Timeout and unit
.setActivity(this) // Activity (for callback binding)
.setCallbacks(new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
#Override
public void onVerificationCompleted(PhoneAuthCredential credential) {
signInWithPhoneAuthCredential(credential);
loading.dismiss();
}
#Override
public void onVerificationFailed(FirebaseException e) {
Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
loading.dismiss();
}
#Override
public void onCodeSent(#NonNull String verificationId,
#NonNull PhoneAuthProvider.ForceResendingToken token) {
verificationDialog(contactNumber);
verificationCode = verificationId;
loading.dismiss();
Toast.makeText(getApplicationContext(), "Verification code sent to " + contactNumber, Toast.LENGTH_LONG).show();
}
}) // OnVerificationStateChangedCallbacks
.build();
PhoneAuthProvider.verifyPhoneNumber(options);
}
enter image description here
80% - So this is the answer to my question. Bye
I've created a basic UWP application with a WebView. I'm navigating to this URL: https://webrtc.github.io/samples/src/content/getusermedia/gum/ to test the use of getUserMedia().
The error I get is: getUserMedia error: NotFoundError
Does anyone know if this should be possible, and if I'm therefore doing something wrong? Anyone using getUserMedia within a UWP WebView?
Thanks for any guidance.
getUserMedia error: NotFoundError
This error will occurre when the user denies permission, or media is not available.
In an UWP app, when you want to access Media capture, you will need to open the manifest file of your project, go to the Capabilities label and select the Webcam capability to enable the Camera device for your app.
This will solve the problem, but for your case, I think you may also need to enable the Microphone capability in the same way.
In addition to the accepted answer, I needed to add this handler to the webview to allow permission:
webView.PermissionRequested += WebView_PermissionRequested;
...
private void WebView_PermissionRequested(WebView sender,
WebViewPermissionRequestedEventArgs args)
{
args.PermissionRequest.Allow();
}
I've been trying to use the R-R interval's sensor in the Microsoft band SDK, but I can't find anything related to the sensor either on the internet and the documantation.
Could you explain me how to use it and/or give an example code?
The SDK documentation provides a sample for the Heart Rate sensor data and the logic is the same for RR interval. Go to section 5, page 17: https://developer.microsoftband.com/Content/docs/Microsoft%20Band%20SDK.pdf
Below are snippets if you are using the Android SDK.
First, create the event listener:
BandRRIntervalEventListener rrIntervalListener = new BandRRIntervalEventListener() {
#Override
public void onBandRRIntervalChanged(BandRRIntervalEvent event) {
// add your logic
}
};
Then register the listener (handle your BandException):
bandClient.getSensorManager().registerRRIntervalEventListener(rrIntervalEventListener);
When you are done, unregister your listener (handle your BandException):
bandClient.getSensorManager().unregisterRRIntervalEventListener(rrIntervalEventListener);
Don't forget to get user consent first, this is very important and the SDK documentation explains how to do that as well.
You will find an example with exactly that in the BandRRIntervalApp folder in the Band Android SDK and samples package. This includes subscribing to the sensor, displaying the value and getting user consent if necessary.
In my Windows Phone 7 and 7.5 apps I used to prompt a message box when the app was launched if the user was already playing music, to notify the user to stop current music to play the sounds, or to exit the app, this was working, but when I coded from the beginning for Windows Phone 8, for some reason this code doesn't work, if you are playing a sound, instead to prompt the notification, the apps opens and close itself.
This is the code I was using:
private void Application_Launching(object sender, LaunchingEventArgs e)
{
FrameworkDispatcher.Update();
if (MediaPlayer.GameHasControl != true)
{
if (MessageBox.Show("This application requires play sounds and stop your currently playlist", "Information",
MessageBoxButton.OK) == MessageBoxResult.OK)
{
MediaPlayer.Stop();
FrameworkDispatcher.Update();
}
}
}
I'm pretty sure must be some change in the Api with the MediaPlayer? I couldn't find any information about that, someone knows how can I fix that?
Thanks!!!
As you guessed,there are some changes in APIs.
First thing I notice, calling MessageBox.Show(string) from the Application_Launching event causes an exception. You app is probably shutting down due to an unhandled exception.
From MSDN: "If you call Show(String) method from the app Activated and Launching event handlers an InvalidOperationException is thrown with the message Error Displaying MessageBox."
EDIT: The documentation on MSDN is unclear whether calling .Show(string, string, messageBoxButton) raises the same exception.
App platform compatibility for Windows Phone