I'm learning Android Wear and I'm confused with the Android Wear.
When I create the UI with a watchViewStub it works as expected. When I extend InsetActivity there is no library that knows this kind of object.
Checking on Android web site, there is no mention of InsetActivity.
So, where is the mistake? Is it an object that was on pre release and then not used by Android Wear, do I have to use a special library?
InsetActivity is part of the wearable support library.
Ensure you have added the following dependency in your wear build.gradle.
compile 'com.google.android.support:wearable:+'
Related
I'm using flutter_beacon plugin, It was working awesome on android. Ranging the close devices and getting the information that the beacon was broadcasting. But now, It suddenly stops reading the information, as the beacon would have disappeared. Any suggestions how to fix this??
The library im using is this one:
https://pub.dev/packages/flutter_beacon
There are lots of reasons an Android device might fail to detect beacons. The flutter_beacon plug-in you mention is built in top of the Android Beacon Library, which is the most widely used beacon library for Android.
You may want to try out that library’s reference app for Android (or the BeaconScope app for Android which is also built upon that same library.) If you find that these native apps have a similar problem on your device, then the problem may be device-specific.
The Android Beacon Library has a troubleshooting page that may be useful to you. Many of the same checks will be applicable to using the flutter_beacon plug-in.
We are building an application in Flutter, which is composed of an SDK (no UI Code) and a Flutter UI, using the SDK.We have now the requirement to provide the SDK for other, native target platforms (iOS, Android, Web, JVM) and use it in existing applications. As far as we have understood this is possible for iOS and Android. But is this also possible (or planned) for Web and JVM? We simply want to minimise the effort to build the similar SDK in various platform specific technologies.
Thank you!
You can build your Flutter app targeting web https://docs.flutter.dev/development/platform-integration/web/faq#is-the-web-version-of-flutter-ready-for-production
If you want to target the Desktop then check https://docs.flutter.dev/development/platform-integration/desktop to see if it meets your requirements.
How can I access device information without using packages in Flutter? How can I get the information of the device where the app is installed in my Flutter app?
First, you'd be better off using packages. But if you really want/need to do it, you'd have to write platform-specific code code in the native language of the targeted platform (ie. Swift or Objective-C for iOS/Mac, Kotlin or Java for Android, etc), then use so-called platform channels to pass messages between your app and the platform-specific code.
If you'd like to get details about the device, on iOS you'd use UIDevice, on Android you'd typically want Build.
This can only be done through Method Channel
When I create a new Flutter project, it asks me to choose between Java/Kotlin for Android and Objective-c/Swift for iOS. But, what does this mean? Is it in case I want to write something for Android or iOS specifically?
Yes that is correct. In Flutter you have the option to call into platform-specific APIs. This is especially useful if you need to access functionality that is not available in Flutter directly (e.g. accessing the keychain on iOS or the keystore on Android).
To do so you can open up a message channel which bridges the Dart world with the platform-specific world. You can use this message channel to send a message from Dart to you platform-specific code. This platform-specific code is either Java/Kotlin for Android or Objective-C/Swift for iOS, depending on your selections during the creation of the project.
More detailed information can be found in the Flutter documentation here: https://flutter.dev/docs/development/platform-integration/platform-channels
Just a heads up, the Flutter team and the Flutter community already wrote a lot of OSS packages and plugins that will take care of the platform-specific stuff and offer you an easy Dart API. You can search for these packages in the Pub: https://pub.dev
When an external component such as a Camera or File picker is needed, the Flutter for Android Developers documentation (currently in the works) states that we would have to build a native platform integration.
I currently have a device that has a built-in barcode reader with a manufacturer-provided Android API. So, for that I would need to pursue this native platform integration method - or even for playing videos or using the camera for that matter I would think.
Is there an example repo that demonstrates how a well-integrated app should be? ..a project that integrated ExoPlayer for example?
You can use platform channels to call native APIs that aren't exposed by the Flutter platform.
There is an example in the Writing custom platform-specific code docs:
The full, runnable source-code for this example is available in /examples/platform_channel/ for Android with Java and iOS with Objective-C.
If you want to make your code reusable by others, you can publish it as a package, but this is optional. There is a repo of plugins maintained by the Flutter team that you can use for inspiration.