Closed Mecheka closed 4 years ago
Hi @Mecheka
Can you please provide your flutter run --verbose
with error and a complete reproducible minimal code sample
Thank you
My verbose
my code
class SplashScreen extends StatefulWidget {
@override
State<StatefulWidget> createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> {
@override
void initState() {
super.initState();
_checkLoginState()
}
@override
Widget build(BuildContext context) {
return Widget();
}
_checkLoginState() async {
final isLogin = await service.checkLogin();
try {
if (isLogin) {
Navigator.pushNamedAndRemoveUntil(
context, '/homepage', (route) => false);
} else {
Navigator.pushNamedAndRemoveUntil(context, '/login', (route) => false);
}
} catch (e) {
// do nothing if error in splash screen
Navigator.pushNamedAndRemoveUntil(context, '/login', (route) => false);
}
}
}
class LoginService extends BaseService {
FirebaseMessaging _fcm = FirebaseMessaging();
Future<bool> checkLogin() {
final String res = await dio.get('checkLogin');
final topic = res.replaceAll(new RegExp('[^(a-z)|(A-Z)|(0-9)|-|_|.|~|%]'), '.');
_fcm.subscribeToTopic(topic);
return true;
}
}
Hi @Mecheka Since you're code is incomplete, i just tried official example and subscribed to a topic and used firebase console to send notifications, no issues
logs
flutter: Settings registered: PushNotificationSettings {sound: false, alert: false, badge: false, provisional: true}
flutter: onMessage: {from: 486685679562, collapse_key: com.example.test_app, topic: thanos, notification: {body: testest, title: test, e: 1, tag: campaign_collapse_key_709824569001887589}}
Please try the official example Thank you
Hey @Mecheka. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Since there haven't been any recent updates here, I am going to close this issue.
@Mecheka if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.
I run ios device app is not subscribe to topic catch error
But android device it work My flutter doctor