I have built a mobile application using Xamarin forms and my application works fine for 3 days i.e it pulls the data from Azure database exactly how I wanted but on 4th day it only pulls 1 item even though there are many. Any idea what is causing problem. I am confused where exactly the problem is, whether with Xamarin part or database part.
I have built a mobile application using Xamarin forms and my application works fine for 3 days i.e it pulls the data from Azure database exactly how I wanted but on 4th day it only pulls 1 item even though there are many.
AFAIK, when using offline sync, you could invoke the PullAsync without pass the query ID, then all records would be retrieved from your remote table. While if you specific the query ID, the mobile SDK would perform the incremental sync. For more details, you could refer to here.
I would recommend you use fiddler to capture the network traces when you pull the data in your mobile client. Moreover, you could call the Http table API via postman or the browser for retrieving the data from your remote table as follows to narrow this issue:
Get https://{your-appname}.azurewebsites.net/tables/{table-name}?ZUMO-API-VERSION=2.0.0
Note: If you enable the authentication, you need to specific the x-zumo-auth header with the value via MobileServiceClient.CurrentUser.MobileServiceAuthenticationToken after you invoked the MobileServiceClient.LoginAsync for logging. Moreover, there has the max page size up to 50 for a single GET operation.
Additionally, you need to make sure your remote table records have not been marked as deleted. If you still could not locate this issue, you could update your question with the code snippet to pull the data and the detailed network traces when calling the pull operation.
Here are some useful tutorials, you could refer to them:
30 DAYS OF ZUMO.V2 (AZURE MOBILE APPS): DAY 13 – THE HTTP TABLE INTERFACE
Chapter 3 - Data Access and Offline Sync
The recommended way to connect to the database is using an API that will manage the interaction with the database. The mobile application should consume that API. Try using a .NET API. That should solve the issue.
If you want your application to operate offline also, you can retrieve data using the API and then store it locally using SQLLite, Realm, or Azure Easy Table. Azure Easy Table is the easiest way to do it. Realm is gaining a lot of adoption.
Hope this helps.
Related
I want to building a Blazor WebAssembly Progressive Web App, that can run offline.
I began Blazor this morning, and I'm just trying to get the hang of it.
To begin I want to do something like keep.google.com. You can work on you notes offline, on different devices, and when the connection is re-established, all notes are synchronized in the background with the server.
My idea is to have simple notes on a server, with an id, title and a message. These notes can be displayed and added/modified from the client. Since I want the application to work offline, I want the synchronization process to be as follows:
The fist time visiting the website, all notes are fetched from the server,
When notes are added/modified, they are saved on the server,
If connection is lost, notes can still be read and added/modified localy,
When the connection is re-established, the modifications are saved to the server,
Periodically or after pressing a button, sync is done between client and server to fetch new data present on the server.
I think the way to do this is to have a copy of the database localy. Client do modification on the local database and periodically/after pressing a button/when connection is re-established, I sync local database with server database.
I'm sure there is an official and easy solution to do that. I followed the CarChecker example from Microsoft, but they used the IndexedDB in javascript to do that (23min13 in the official tutorial video).
Do you know a .NET solution/tutorial/service that store data locally, and sync in the background with the server ?
I wrote a Blazor WebAssembly PWA with similar technical requirements. There is certainly more than one way to accomplish this but the steps I used are as follows:
I used sqlite on the client side to persitist the data locally. The simplest way to make that persist-able with the ability to use Entity Framework is to use the SqliteWasmHelper nuget package. https://github.com/JeremyLikness/SqliteWasmHelper
On startup and/or when online I fetch the necessary data and insert it into the local sqlite database.
The user can make changes and I save that to the local sqlite DB and mark it as ready to be synced.
I have a background service with a timer which executes on a configurable interval and grabs the local data marked to be synced and calls the API on the server to save the data to a SQL Server database. Of course I check to see that the user is online before attempting the sync.
I use Javascript to determine whether the device is online. I can provide that to you if you need but you should be able to google it.
I have an application update checker based on this method which works pretty well: https://whuysentruit.medium.com/blazor-wasm-pwa-adding-a-new-update-available-notification-d9f65c4ad13
I hope that helps. I'm happy to provide more detail if you like.
Good day, i have basically no experience in sending information over the internet, so excuse me if this is a little to DUH for you, i am trying to better my understanding.
What i have is a mysql database hosted somewhere on the WWW which is populated with a web application, i also have a local database stored on my ..local machine, which is populated via a windows form created in C#.
All of the above works like a charm.
What happens is, the web site creates some data in ONLINE_TABLE_ORDER.
The local app does some dark magic (based on data in ONLINE_TABLE_ORDER and populates TABLE_1 in the local mysql database, then TABLE_2 stores a bunch of data based on whats going on in TABLE_1.
On the click of a button its time to send ALL the data from TABLE_2 to ONLINE_TABLE_STATS which is the online mysql database and keeps updating the same table for statistical purposes.
What i need to do, is to send the rows of data from ONLINE_TABLE_ORDER to the local database, the C# windows form will then automatically pick up the details and populate various controls, when all is said and done the application will then need to send rows of data from TABLE_2 to ONLINE_TABLE_STATS where the web form will then pick up this new data and display it accordingly.
That being said, i now need to figure out how to go about sending all of this.
This is where WCF and web services comes in.(i guess, its what information i have managed to wring out of google).
Now i would like to do this via services to maintain data integrity (local internet is shitty, and could cut out at anytime, so i am hoping that web services can help with that).
Finally, this is where my understanding needs some TLC,
1: Can a WCF service form part of my C# application; in that the application pulls data from the web based mysql database and then pushes data back to that database?
2: Can a WCF service run by itself from within the local application? or does the server on which the web database is hosted also need a WCF service running?
3: Does only the online server need a WCF service running? (create an applet in C#?)
4: Is this all overkill and i dont actually need any services when a simple bulk insert statement suffice? (remember shitty internet).
Remember, i would like the service to handle
ONLINE_TABLE_ORDER --> TABLE_2 --> ONLINE_TABLE_STATS
No, i am mostly self taught and am really eager to learn more about this, even if it is overkill; as i have been checking out tutorials and blogs, none have actually given me sufficient answers to the above.
Most, deal mainly with application to hosted database but have yet to find one from database to database which is what i am trying to do.
So in closing, if you can help my understanding as well as leave some kick ass links to great reading material, id really appreciate that. If you lovely individuals require anymore information about the how's or why's, leave a comment and ill edit my question.
I think you need to comunicate from your CSharp app to your online database via web services like you said. So, you need a WCF service hosted online with access to the database (or other kind of service, like an api in the online web site who have access to the databse). Also you need a service client in your CSharp app who comunicates with the online server.
So answering to your numbered questions:
A WCF can be hosted in a C# application (called "self hosted service" or something like that) but it does not resolve your problem. Your CSharp app should be client not service.
Basically the same answer than before
The online server need some kind of service who interacts with the database listening to http request. So, WCF is a good alternative. You can use another kind of web service, like a api service in the web application
In MY OPINION i think you need a service who controls security, data transport and a lot of stufs
After using Azure Mobile Services a year ago, I decided to get back to mobile development but Microsoft changed a lot in their offer and I'm actually struggling to set my project up.
My goal is to create a service whith these features:
.NET backend preferred over the Javascript one (I don't like callbacks :))
SSO (Facebook, Twitter, Google+, Windows Live)
SQL Database (I really need relations, and I already have a T-SQL schema)
Push Notifications (just to Windows and Android for now and with unlimited custom channels so that I can have one channel for each user and avoid dealing with notifications' logic)
Monthly scheduled jobs to update database from an external JSON API and to remove old entries
Mobile Client (with a shared Xamarin library to handle all the data-related stuff and WUP + Android support)
Web Client (I don't have a Mac so I can't build and publish the iOS version, so a web app may be needed as a temporary replacement)
What I did was to:
Open Azure Preview Portal link
Click on New => Web + Mobile => Mobile App
Set the Resource Group with all the needed plans
Added a Data Connection to a newly created SQL Database
Added a Notification Hub with settings for GCM and WNS
Added Mobile Authentication with settings for Microsoft Account, Facebook, Twitter, Google
Created the schema for my SQL Database
Before going on, I'm not sure that this was the correct workflow but documentation is pretty confused and the Get Started sections just discuss about code and not how to properly setup the service and have it running, so I just did the same basic things that I would've done with the old Mobile Service, plus dealing with the SQL Database instead of the NOSQL one.
Now it comes the issue: I have no idea on how to move next, and even the Quickstart projects (both server and client) are not helpful (they're the old TodoItem sample working with the Mobile Service).
The first thing that I wanted to do was to create the Scheduled Job because I actually need to fill the database with the external data before moving forward.
The only thing close to what I need is the WebJob, but I can't schedule it yet and it requires me to upload an exe file while I'd like to be able to write my C# code directly to the server (being able to remotely debug it).
An alternative may be to create a Compute Instace and write an endless loop doing what I need, but this will force me to manually deal with the SQL Database inside the Mobile App Service.
Another issue is related to the SQL Database. As I already wrote, the Quickstart seems to work with the NOSQL included in the old Mobile Service, meaning that I don't have a direct connection to my SQL Database, while I'd like to be able something like
App.MobileService.GetTable<MyTable>()
Plus, having 10 tables, I'd also like to have a way to map them automatically (like NetBeans does for JavaEE projects).
So the question is: what's a good (or the best) workflow to get everything working as I need it or, at least, close to how I need it?
(I know that answers may be opionion-based but they still may be useful since Microsoft's documentation is not complete)
If you have an existing database, you could use Entity Framework Code First to Existing Database. That will generate the C# classes for you.
The database that you create when you add a Data Connection to your Mobile App is an Azure SQL Database by default--I'm not sure why you thought it was NoSQL?
Once you have done this, you can query your tables from the Azure Mobile Apps client SDK. For instance, in Xamarin, the quickstart project does queries as follows (see https://github.com/Azure/azure-mobile-services-quickstarts/blob/MobileApp/client/xamarin.android/ZUMOAPPNAME/ToDoActivity.cs#L126).
var list = await toDoTable.Where (item => item.Complete == false).ToListAsync ();
Finally, regarding your question on WebJobs, you can actually schedule it. See https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-jobs/#CreateScheduledCRON for more information. Even though you Web Deploy your webjob target, you can still remote debug it. See this blog post for information: http://www.bursteg.com/remote-debugging-azure-webjobs-attach-a-debugger-from-server-explorer/
I have an metro app which takes a picture of a burning flame and sends it Azure. I am storing image directly in SQL Server table and not in BLOB because the image is generally < 100KB. The way I am implementing it is the image is inserted into the table, and after successful insert a push notification is sent to client with a set of instructions which indicate action to be taken for a flame.
Now, I am researching how I can implement pattern matching in the SQL Server table.
The table already has 10 images and my app takes a picture, inserts it into table and tries to compare it and finds the closest match and based on the match the specific instructions will be sent to metro app.
IS there any framework which I can use to do this pattern matching in cloud and carry specific task based on this pattern matching?
Can anybody please help me with any info in this regard?
While I can't recommend anything specific: Whatever app you find that will install and run in either a Windows or Linux virtual machine (or in a Windows VM in a Cloud Service, if the install can be automated and quick), should be ok. Just make sure whatever library you use doesn't rely on any specific GPU (since Azure doesn't offer GPU support today).
I saw another answer recommending a CLR procedure to process the images. I really wouldn't recommend that, as you're now stressing the CPU of your SQL Server, and that's not something that can easily be scaled out to multiple servers. And if you choose to use Windows Azure SQL Database, you won't have CLR as an option. You're better off placing processing in, say, a Cloud Service worker role, where you can scale out to any number of instances, and you can then use an Azure Queue to instruct the workers to perform specific comparisons / processing.
I need to create a desktop WPF application in .NET.
The application communicates with a web server, and can work in offline mode when the web server isn't available.
For example the application needs to calculate how much time the user works on a project. The application connects to the server and gets a list of projects, the user selects one project, and presses a button to start timer. The user can later stop the timer. The project start and stop times need to be sent to the server.
How to implement this functionality when the application is in offline mode?
Is there are some existing solution or some libraries to simplify this task?
Thanks in advance.
You'll need to do a couple of things differently in order to work offline.
First, you'll need to cache a list of projects. This way, the user doesn't have to go online to get the project list - you can pull it from your local cache when the user is offline.
Secondly, you'll need to save your timing results locally. Once you go online again, you can update the server will all of the historic timing data.
This just requires saving the information locally. You can choose to save it anywhere you wish, and even a simple XML file would suffice for the information you're saving, since it's simple - just a project + a timespan.
It sounds like this is a timing application for business tracking purposes, in which case you'll want to prevent the user from easily changing the data. Personally, I would probably save this in Isolated Storage, and potentially encrypt it.
You can use Sql Server Compact for you local storage and then you microsoft sync framework to sync your local database to the server database. I recommend doing some research on the Microsoft Sync Framework.
Hello all I implemented this application I've created my own off-line framework
based on this article and Microsoft Disconnected Service Agent
DSA
I've adapted this framework for my needs.
Thank you for all.
you can use a typed or untyped dataset for offline-storage.
when online (connected to internet) you can download the data into a dataset and upload it back to the database server. the dataset can be loaded from and saved to a local file.