How to send data from smartwatch to Flutter app - flutter

I am looking for a method to get data(heart rate) from a smartwatch(wear/tizen/watch) and read them using a Flutter app. Anyone know of such a package or idea to communicate with the smartwatch and a Flutter APP PLZ?

You can look at this answer which is pretty much what you were asking.
It says that, by now, you can do it only for wear thanks to this package.
Here's an example for receiving messages:
// msg is either a Map<String, dynamic> or a string (make sure to check for that when using the library)
WearableListener.listenForMessage((msg) {
print(msg);
});

Related

I am looking for a method to get data(heart rate)

I am looking for a method to get data(heart rate) from a smartwatch(wear/tizen/watch) and read them using a Flutter app. Anyone know of such a package or idea to communicate with the smartwatch and a Flutter APP PLZ?
Looking for plugins

How can we implement "Host Card Emulation (HCE)" with Flutter?

We are working to implement HCE in flutter but till now can only read tag's information from the iOS version using the following codes -
void _readTag() {
NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async {
print("_tagRead:${tag.data}");
result.value = tag.data;
NfcManager.instance.stopSession();
});
}
Ref: https://pub.dev/packages/nfc_manager
Last time I checked, Apple wasn't supporting HCE yet (and it was 1 year ago or so).
If you need to implement it on Android only, you can use the nfc_emulator library
did you reach anything in making payment app by NFC ?

Open video call flutter

Is there a solution yet for opening the video call function on the native phone in flutter? I have looked at Agora and others and none of them work the way we need them to.
That was rather annoying to research and come up with, here it goes. This is the best I can come up with while keeping high complexity and paid SDK's outside the solution.
First of all, you have to differentiate between the two platforms (iOS/Android) before initiating the video call. Since there's no uniform solution for both platforms AFAIK.
import 'dart:io';
if (Platform.isAndroid) {
// Android Video Call
} else if (Platform.isIOS) {
// iOS Video Call
}
iOS
Install the infamous url_launcher pub.
You'll need to use FaceTime Links (see full iOS URL Scheme Reference here or here)
Text example: facetime:14085551234 this initiates FaceTime video call to 14085551234 (you use email instead of phone number too)
import 'package:url_launcher/url_launcher.dart';
final String url = 'facetime:$phoneNumber';
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
This works surprisingly well. In this case you can replace $phoneNumber variable with something like $userEmail variable.
Android
Install android_intent pub
Add CALL_PHONE permission and show its prompt to user if you're using android.intent.action.CALL, or just use android.intent.action.DIAL without the permission.
This is where the problem lies... I tried the following solution and it only worked for regular calls not video calls
import 'package:android_intent/android_intent.dart';
/// This acton calls the user directly via native phone app but requires `CALL_PHONE` permission in _AndroidManifest_.
final callIntentAction = 'android.intent.action.CALL';
/// This action displays native phone app with dial pad open showing the passed phone number intent's argument/extra. Does not require permissions as of Jan2020.
final dialIntentAction = 'android.intent.action.DIAL';
final intentAction = callIntentAction;
AndroidIntent intent = AndroidIntent(
action: intentAction,
data: Uri.encodeFull('tel:$phoneNumber'),
arguments: {
/// KEY: actual phone number to call [source](https://developer.android.com/reference/android/content/Intent.html#EXTRA_PHONE_NUMBER)
/// VALUE: phoneNumber
'android.intent.extra.PHONE_NUMBER': phoneNumber,
/// KEY: [START_CALL_WITH_VIDEO_STATE](https://developer.android.com/reference/android/telecom/TelecomManager.html#EXTRA_START_CALL_WITH_VIDEO_STATE)
/// VALUE: `3` implies [STATE_BIDIRECTIONAL](https://developer.android.com/reference/android/telecom/VideoProfile.html#STATE_BIDIRECTIONAL)
'android.telecom.extra.START_CALL_WITH_VIDEO_STATE': '3',
},
);
await intent.launch();
Error-handling side-note: unfortunately with android_intent pub there's no error handling or "canOpen" method like url_launcher.
Your problem still lies with Android as there's no native general-purpose video-call app.
You have a couple of options:
A. You can link with your app a video-calling SDK/capability either third-party or your own. (like flutter_webrtc, agora_flutter_webrtc, SightCall, quickblox). This has the downside that the callee has to be using the same software i.e. your app has to be installed on callee's device. This approach is more future-proof. Note I'm not affiliated with any of the libraries I mentioned.
B. You can make a platform method for Android to go over a defined set of intents and check the package name of known video-calling apps with the extra/arguments they require. You'd have to check the list of intents one by one and see which applies and resolves correctly. For apps like Google Duo, Whatsapp, Skype, etc.... This is EXTREMELY prone to errors. As explained here.

Need Voip call like in Uber in Flutter

My app need a voip phone call to another person who is using this app and the phone number should not be the real phone number like in Uber. Can somebody please help, I searched in google and I could find nothing.
I was trying to add this feture in my crrunt project and find zegocloud they have good documentation on how to implement voice/video calling one-on-one and group too.
Here's the doc and here's the code snippet of basic implementation in the flutter.
Hope this will help you.
I would say the best option is to go with an open source WebRTC based solution if you are ready to self host the VoIP server. In this case you can consider using Pion VoIP package which is available even in flutter. See https://github.com/pion/ion-sdk-flutter
To avoid hosting and ready to pay some cash for the calls users make, consider Twilio or any other cheaper alternatives which can do the hosting for you, but gives API calls to use them in your app.
Hope this helps :)
I would suggest that you save the actual number with a key value pair example
{
'cell':'0000000000',
'fakeCell':'0123456789'
}
Then whenever you want to call through the app you do a quick lookup to get the real number.
also here is a WebRTC Plugin you can use

How to determine if flutter is running in simulator

Is there a call to determine if flutter is running within a simulator or a physical device?
I am scanning QR codes, and want to bypass, since the camera is unavailable.
I expected to find this in platform.dart[1] but it's not there.
[1]https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/foundation/platform.dart
I imagine I can create a plugin if I really need, I'm hoping it already exists.
Using the device info plus plugin you can get various information about the device you're running on, including 'isPhysicalDevice' for both Android and iOS (although you'll have to read them independently).
2021 Update
It‘s now part of Flutter Community Plus (https://plus.fluttercommunity.dev/)
Device Info Plus Docu: https://plus.fluttercommunity.dev/docs/device_info_plus/overview
e.g.:
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
if(Platform.isIOS){
var iosInfo = await deviceInfo.iosInfo;
if(iosInfo.isPhysicalDevice){...}
}
I Know I'm A Bit Late, But If Anyone Else Comes Here, This Can Help Them.
You Can Just Use This Package:
https://pub.dev/packages/safe_device
Add The Latest Version In Your Pubspec.yaml File
Then import it:
import 'package:safe_device/safe_device.dart';
Then You Can Check If Device Is An Emulator:
bool isRealDevice = await SafeDevice.isRealDevice;
No.
But what you can do instead is use different configurations (such as a dev configuration).
For this you can use a different main.dart such as main.dev.dart and then run it with flutter run -t lib/main.dev.dart
I'm using https://pub.dev/packages/flutter_is_emulator
import 'package:flutter_is_emulator/flutter_is_emulator.dart';
....
bool isAnEmulator = await FlutterIsEmulator.isDeviceAnEmulatorOrASimulator;