I have a requirement where I want to upload JSON request data(fetch from database tables) to server and get the response, based on response I have to update local database(sqflite: ^1.2.1).
I have multiple screens and I need to create different JSON request data on every screen based on user action. Currently for same scenario I am using Intent Service in my another native android application.
What is the based way to handle such type of scenario in flutter Android application. If I use channel and implement Intent Service then I can't access sqflite database in Android specific region. If internet is not available then I have to keep waiting for connectivity, when device get connectivity then I need to upload all the created events to server one by one.
Please someone advise me the based possible way to handle this specific scenario in Flutter.
Thanks in advance
Save your JSON requests locally first using sqflite or sharedPreferences for instance. Once they are synced to your served, remove them from sync queue
I got the solution: I am able to access SQFlite database in native through channel.
This is the path of the database created in flutter
"/data/data/{package name}/app_flutter/{database file name}"
So we can access like in native using channel
SQLiteDatabase mDatabase= SQLiteDatabase.openDatabase("/data/data/{package name}/app_flutter/{database file name}", null, 0);
Log.i("MainActivity", "mDatabase.isOpen():"+mDatabase.isOpen());//check DB is open or not
String query = "SELECT * FROM {Table Name}";
Cursor cursor=mDatabase.rawQuery(query,null);
if (cursor.moveToFirst()){
do{
String data= cursor.getString(cursor.getColumnIndex({Table Column Name}));
Log.i("MainActivity", "Column Data Value:"+data);
}while(cursor.moveToNext());
}
cursor.close();
So I will implement Service in native to achieve this scenario.
Thank You
Related
I was trying to use the GCP filestore, following the simple quick example in the product website and get an error: "google.api_core.exceptions.FailedPrecondition: 400 The Cloud Firestore API is not available for Cloud Datastore projects."
I did use the datastore before in the same project, I then disabled the datastore api in the project and try out the example, still get the same error any one can suggest what to do other than creating a new project ?
If you have an empty Cloud Datastore database and you never executed a write to the database, you can upgrade to Cloud Firestore in Datastore mode or Native mode, by clicking the ‘’UPGRADE TO FIRESTORE’ button on the ‘Datastore/Entities’ page.
If you do not receive the option, then your database instance will be automatically upgraded at a future date(link). If you upgrade from Cloud Datastore to Cloud Firestore in Datastore mode or from Datastore mode to Native mode, you cannot undo the operation.
Here is the link to the Doc: https://cloud.google.com/datastore/docs/upgrade-to-firestore
I had The Cloud Firestore API is not available for Datastore Mode projects with an empty Firestore.
I've solved the error with the steps:
Open Firestore in your web browser.
Create at least one collection.
Sadly, Google error messages are useless, as you see by this example.
I had the same problem, the solution was to comment the line .setProjectId(projectId).
this example is for a native firestore instance, located in another GCP project
GoogleCredentials credentials = GoogleCredentials.fromStream(new ClassPathResource("/test-firebase.json").getInputStream());
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(credentials)
//.setProjectId(projectId)
.setDatabaseUrl("https://document-db.firebaseio.com/")
.build();
if (FirebaseApp.getApps().isEmpty()) {
FirebaseApp.initializeApp(options);
}
Firestore db = FirestoreClient.getFirestore();
DocumentReference docRef = db.collection("document-db").document("alovelace");
// Add document data with id "alovelace" using a hashmap
Map<String, Object> data = new HashMap<>();
data.put("first", "Ada");
data.put("last", "Lovelace");
data.put("born", 1815);
// asynchronously write data
ApiFuture<WriteResult> result = docRef.set(data);
Dynamic links work great for 98% of our users. However, there are still a group of users which have difficulty with them or do not know how to use them.
I want to add a feature which would let users paste their link into the app, and then we extract the data from the link and handle it normally. This will also serve as a backup for when the links are down or misbehaving. It will also allow our customer service team to get data from a link when customers share them with us.
The problem is, there doesn't seem to be a way to manually pass in a dynamic link to retrieve the dynamic data.
Does anyone know how this can be achieved?
Here is my attempt at your question.
I am assuming what you mean by the dynamic data is the underlying deeplink along with the parameters associated with the deeplink.
void dynamicLinkToDeepLink(String dynamicLinkString) async {
final details = await FirebaseDynamicLinks.instance.getDynamicLink(Uri.parse(dynamicLinkString));
// your deep link can be accessed as follows
details!.link;
}
You have to safeguard the above code as you see fits when you use it. You will have to wrap FirebaseDynamicLinks.instance..... with a try catch block and you will also have to check if the value of the returned link is not null before acccessing details!.link
Hi I want to create web services in symfony2.8. I have already symfony2.3.7 installed somewhere else and it has already a db name: demoDb that contain all data (document) collections around 50-100.
Now I just installed new symfony2.8.15 to serve for services. So is it possible to connect and fetch data from (demoDB) into new Symfony2.8.15.
So I installed FOSRestBundle and all necessary thing to work with webservices. So I created a Controller ServicesController.php in new symfony2.8.15
I want to fetch data from User dicument which is exist in another setup. But database already I have connected.
$user = $dm->getRepository('EduLoginBundle:User')->findAll();//But User Document is in another setup2.3.7
is it possible?
Thanks in advance
Is that is possible to fetch an existing wl_surfaces ?
The idea is to be able to fetch a wl_surfaces from an application and be able to acceed all of its data, such as its wl_buffer
One client cannot access the surfaces of another client.
I'm using the JavaScript SDK flavor of the Dropbox Datastore API with a web app for mobile and desktop. When the recordsChanged event fires while the app is offline, object data about those changes are generated but the changes can't sync to the datastore until the app is online again.
The event data can be checked against the settings table, for instance, like this:
e.affectedRecordsForTable("settings")
But the array data returned has a lot of layers to wade through.
[t_datastore: t_deleted: false_managed_datastore: t_record_cache: t_rid: "startDate"_tid: "settings"__proto__: t]
I would like to capture the "has been synced" or the "not yet synced" status of each change (each array index) so that I can store the data still waiting to sync in case the session is lost (user closes the app/browser or OS kills the app process). But I also want to know if/when the data does eventually sync successfully. Where can I find the property holding this data?
I found my answer. Steve Marx has a post on the Dropbox developer blog that covers the information I needed. There is a datastore.getSyncStatus().uploading property that returns true or false depending on the state of the datastore sync status.
Source:
https://www.dropbox.com/developers/blog/61/checking-the-datastore-sync-status-in-javascript