I have problems in firebase. I intergrated flutter app with firebase. I got initialization succesfful. if i run a code to load image from firestorage. The image doesnt appear. I tried to follow all post regarding the errors in log. but nothing works out.
Log errors:
2021-02-03 10:27:26.279 14915-15001/? E/FirebaseInstanceId: Token retrieval failed: AUTHENTICATION_FAILED 2021-02-03 10:29:26.371 14915-15001/? E/FirebaseInstanceId: Token retrieval failed: AUTHENTICATION_FAILED
2021-02-03 11:39:53.497 23775-23775/? E/FirebaseInstanceId: Failed to start service while in background: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.firebase.INSTANCE_ID_EVENT pkg=com.google.android.apps.messaging cmp=com.google.android.apps.messaging/com.google.firebase.iid.FirebaseInstanceIdService (has extras) }: app is in background uid UidRecord{a1881c4 u0a85 SVC idle change:uncached procs:1 seq(0,0,0)}
Dependencies
classpath 'com.android.tools.build:gradle:4.0.0' classpath 'com.google.gms:google-services:4.3.4'
implementation platform('com.google.firebase:firebase-bom:26.4.0') implementation 'com.google.firebase:firebase-core' implementation 'com.google.firebase:firebase-firestore' implementation 'com.google.firebase:firebase-auth' implementation 'com.google.firebase:firebase-analytics' implementation 'com.google.firebase:firebase-storage'
enter image description here import 'package:flutter/material.dart'; import 'package:firebase_storage/firebase_storage.dart';
class Dash extends StatefulWidget {
@override
_DashState createState() => _DashState();
}
class _DashState extends State<Dash> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
FutureBuilder(
future: _getImage(context, 'images/image_1.jfif;'),
builder: (context, snapshot) {
if (snapshot.connectionState ==
ConnectionState.done)
return Container(
height:
MediaQuery.of(context).size.height / 1.25,
width:
MediaQuery.of(context).size.width / 1.25,
child: snapshot.data,
);
if (snapshot.connectionState ==
ConnectionState.waiting)
return Container(
height: MediaQuery.of(context).size.height /
2.25,
width: MediaQuery.of(context).size.width /
2.25,
child: CircularProgressIndicator());
return Container();
},
),
Text('hjjjh'),
],
),
);
}
}
Future<Widget> _getImage(BuildContext context, String imageName) async {
Image image;
await FireStorageService.loadImage(context, imageName).then((value) {
image = Image.network(
value.toString(),
fit: BoxFit.scaleDown,
);
});
return image;
}
class FireStorageService extends ChangeNotifier {
FireStorageService();
static Future<dynamic> loadImage(BuildContext context, String image) async {
return await FirebaseStorage.instance.ref().child(image).getDownloadURL();
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.