I'm trying to see when a user opens a specific screen i my app. But the only screen classes i can see under events/screen_view is MainActivity and FlutterViewController.
In the app I have the following code:
import 'package:firebase_analytics/firebase_analytics.dart';
at the top
FirebaseAnalytics analytics = FirebaseAnalytics();
in the state of a stateful widget
onPressed: (){
analytics.setCurrentScreen(screenName: 'Example');
}
inside a button that opens a page
Have I missed something, or am I looking at the wrong place in the console?
Related
I am working on a cross platform app using mapbox gl with flutter. It has been built for Android and works as expected there, and I am trying to get it working on iOS. When I click and drag on the map in the iOS simulator it keeps moving after I release the mouse button. It often speeds up and moves much further than I intended to move, sometimes ending up in the ocean or on the other side of the country.
EDIT: 2022-04-20
I have created a new mapbox widget, separated from the rest of the apps functionality and the issue was still happening. I have also created a new app using the following code in main.dart, and the camera still continues moving after I release the mouse button.
Sometimes it doesn't move far, or doesn't move at all after releasing the mouse button, but it often moves several kilometers away from where the camera was when I let go of the mouse, so I cannot consistently move the camera to the locations that I intended to look at.
Has anyone else experienced this issue?
EDIT 2:
I have heard that the Android simulator had the same problem, but it works as expected on a real device. My company has ordered an iPad which should arrive this week, but it would be convenient if I could get it working correctly in the simulator.
Has anyone managed to fix this issue in the simulator?
import 'package:flutter/material.dart';
import 'package:mapbox_gl/mapbox_gl.dart';
class TestMapPage extends StatelessWidget {
const TestMapPage({ Key? key }) : super(key: key);
#override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: MapboxMap(
initialCameraPosition: CameraPosition(
target: **INSERT LatLng Coordinates**,
zoom: 12
),
accessToken: **INSERT MAPBOX ACCESS TOKEN**,
styleString: MapboxStyles.MAPBOX_STREETS,
),
),
);
}
}
I created an app with React-native. All pages I made are designed for portrait mode except 1 page. The page accessibility comes from a button onPress then navigates to the page, so I can't lock orientation on Xcode
I installed this package and I can run it on android perfectly
import Orientation from 'react-native-orientation';
When I tried it on IOS simulator on every page it can turns orientation to landscape.
I put this line in every pages componentdidmount but nothing changes.
componentDidMount() {
Orientation.lockToPortrait()
...
}
What should I do?
Hey again #masterAvatarr,
I believe that this is what you're looking for, if you need something else please explain it to me :) We can make it happen.
I made a simple example for you.
https://github.com/WrathChaos/react-native-portrait-locker-example
I use React Native Orientation Locker Library
The important parts are:
Make sure that you linked the library manually (check AppDelegate.m)
You need to make a logic for unlocking and lock the portrait mode depends on your use-case
Please take a look at HomeScreen and DetailScreen
import Orientation from "react-native-orientation-locker";
React.useEffect(() => {
const unsubscribe = navigation.addListener("focus", () => {
// The screen is focused
// Call any action
Orientation.unlockAllOrientations();
Orientation.lockToPortrait();
});
// Return the function to unsubscribe from the event so it gets removed on unmount
return unsubscribe;
}, [navigation]);
Note: There is a little GIF Demo on the Github Repo
I am working on an app with a Today Widget extension. I've seen some widgets, including a sample app from Apple, that display a chevron in the top right to take the user to the app. I've looked through the documentation and sample code and can't figure out how this is added.
The sample app that's downloaded from here has it, but there isn't any information about how to enable it. https://developer.apple.com/documentation/notificationcenter/building_a_simple_widget_for_the_today_view
Does anyone know how to enable this?
You can add the chevron button to your widget by setting the widgetLargestAvailableDisplayMode of your extension context to .expanded:
extensionContext?.widgetLargestAvailableDisplayMode = .expanded
(Note that the chevron button does not take you to the app, but rather it toggles between expanded/compact sizes of your widget.)
devs
I have a situation where I want to change my root view based on condition. For example, if a user is logged in already then root view will be Home screen else login screen.
How can I achieve this? Please help.
Thank you
in your main.dart File you have the function void main() => runApp(MyApp()); where MyApp is a widget returing a MaterialApp widget or something similar. You can already select here to start with a different home widget.
If you have to select the start screen based on some asynchronous operation (like checking settings in Preferences or Secure Storage), you return a FutureBuilder instead of your MaterialApp. The FutureBuilder then returns the widget after finishing the operation.
I'm using the ionic framework for the first time to develop a hybrid app (version is up to date). Upon testing my current work with the provided DevApp, I cannot get the accessory bar to show above my iPhone keyboard by any means. I tried to install the https://ionicframework.com/docs/native/keyboard/, added it to my modules and in app.components.ts my constructor looks like this:
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, keyboard : Keyboard) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
keyboard.hideFormAccessoryBar(false);
});
}
There are no errors in the console, only the bar is not appearing. Is it only because of the DevApp, or am I doing another mistake?
If more information is required, I will be glad to provide it. Thanks in advance!