Notification on multiple android phones using GCM and web services + database data - c#

I am developing an app for selling of products, but I am stuck up in a place where I am not understanding how to give notifications to android phone from database change(insert or update on that table) for new products availble and offers like discounts, schemes etc.
I followed androidhive.com and javapapers.com for the GCM push notifications concept and it is sort of clear:
PHP or C# or Java web service
MySQL or SQLServer Database
GCM
Android phone
The statement for my problem would be "App should receive push notifications for new products, and offers and discounts given by the person-in-charge for it"
My assumption for this problem is:The "offers and discounts" would be "inserted" to a table(tbl_products) in the database and same goes for new products, "inserted" into a table(tbl_offers) in the database.
As soon as that "insertion" is done, the web service (php and c#), which I don't know how it should know, but gets to know about the change and informs GCM, and GCM sends the notification to the respective users.
The logic behind this is not familiar to me. I would greatly appreciate it if someone would help me with the logic and point me in the right direction of the coding for Android and web service. Thank you in advance.

I have been there ,done that! The way you should to proceed is:-
Create your website backend, a web service connected to a database(You need to use and know SQL for this part). Define your database accordingly. PHP is the easiest way to get started. Look at the GCM backend tutorials on Google.
Create your mobile application which has google play services enabled to use GCM. Implement GCM in your android app following the tutorial at the Official Android Developer website. You need to create an XMPP or RESTful service to communicate with your server. Your server needs to support XMPP to communicate better with Google. HTTP(GET/POST/PUT) is a dirty alternative to get working when you do not have a VPS setup for languages like Java(Most hosting companies allow only PHP,HTML,JavaScript etc on shared hosting).Depending on your scale of operation you may have to rent a Virtual Private Server(VPS) for your web service.
Create a private backend application(can be web or a desktop application) to upload your offers and so on. Examples on www.androhive.info
Make sure you got steps 1,2,3 correct.
Test your mobile application.
The idea can be pictorially represented as :-

Related

Xamarin get/insert data from MySql hosted on another PC

I want to building an android app by Xamarin, C# language. This app can get or insert data to MySQL, this SQL hosted on another PC
So, Where I can get information and tutorial for this?
Thank you!
Basically if your MySQL database is in another computer, you need to communicate to it over web, I would suggest you use API, in computer with database make API Application.
https://learn.microsoft.com/en-us/aspnet/core/web-api/?view=aspnetcore-5.0
There is microsoft documentation for it.
Create endpoints for specific actions, and then communicate with them from your Xamarin App, here's the documentation: https://learn.microsoft.com/en-us/aspnet/web-api/overview/advanced/calling-a-web-api-from-a-net-client
Create API service on computer with database
Communicate from your application to API (then API communicates with database, and sends back results to your Xamarin App)
I personally like RESTful principles for API's. documentation: https://restfulapi.net/
You should also consider adding authentication to API, so that only apps you want, can GET/INSERT data to your database
to get data from mysql in any app you need to API:
i using ASP webservice to get data from mysql
then in Xamarin.Android APP in refrence folder click right and add web refrence .
watch this video :
https://www.youtube.com/watch?v=XTZ8pbWAVW4&list=PLF8OvnCBlEY3qYheTm4gnaoWwBuBf2TUj&index=46

Mobile specific data transfer from Android mobile to a cloud

I'm trying to develop a Android app which transfers mobile specific information like Text messages or Files from any Android mobile to a cloud. Can I know the process of data transmission from an Android device to a cloud. As a developer how can I proceed and integrate it with cloud.
I am assuming you are talking about using cloud database providers for your android application and not setup up or your own cloud database, you have to be specific what cloud database provider(s) that you are interesting in.
I suggest you to try Dropbox. Dropbox has a very easy to use set of APIs.
Drop-ins: you do not have to do anything (component base)
Sync Api: very easy to use and pretty much handle everything for you.
core API: more flexible, since it is designed for server, you have to write your own nano http server to handle oauth2 authentication's url redirection or your users have to copy "authorization codes" manually from browser.
I suggest you use Sync Api.
I am using sync API for my Android App (EPass PM) and use core API with nano http server to handle OAuth2 for desktop version.
Here is the link to Dropbox api
https://www.dropbox.com/developers

Windows 8 Store Application Connecting to SQL Online Databse

Ok I have searched and searched for an answer to my problem but can not find a direct answer.
Can someone please guide me in the direction I need to go with step by step solution somewhere that is useful?
My Question:
I built an Windows 8.1 Metro Application that needs to pull data and store data into a database I am hosting in MySQL online but I can not use things like My.SQL.Data.RT because it is not supported (I guess) because I get an error.
How do I connect to my online database to pull information from and store information to it? If I can not do this what options do I have?
Using local databases is not an option because everyone will be storing information in the database and pulling information from it from hundreds of different computers running the application.
If you could point me to a website that I can see it in step by step and please. I am using C#.
Thank you for your help. I have been racking my brain over this because the My.SQL.Data.RT works but the application fails to pass the Windows Store requirements with it pretty dumb if you ask me.
I'm not a Windows 8 store app developer so I am just trying to give suggestions.
From what I know, connecting directly to database server over internet from a client app is NOT A GOOD PRACTICE nowadays. Instead, people provide APIs to do it.
For example, Twitter provides restful APIs, so twitter clients can request http urls and get wanted data in JOSN format. The security of the the connection is ensured by oAuth (so that you don't transfer username and password in http request) and SSL/HTTPS.
In this way, the database connection is hidden from Internet. You will also benefit from the API layer if you want to develop another client on platforms other than Windows, e.g. iOS or Android.
By a quick google search, I found two guides about making a restful api with C#.
http://www.codeproject.com/Articles/112470/Developing-a-REST-Web-Service-using-C-A-walkthroug
http://www.asp.net/web-api/tutorials/hands-on-labs/build-restful-apis-with-aspnet-web-api

Windows 8 And Windows Phone Push Notifications Using Azure

I've looked into Azure Mobile Services and found its great but does not give me the flexibility I want (Node.js also leaves a bad taste in my mouth coming from C#).
I was using periodic update notifications in Windows 8 and already have an ASP.NET Web API project supplying tile images and tile xml content. I was hoping to use an Azure Worker Role with Azure storage tables for Push Notifications for Windows 8 and Windows Phone.
I found this example but it seems to be for VS2012 Release Preview. I can't find an updated version or any other samples to work with. In particular I want my service to support both Windows 8 and Windows Phone.
http://watwindows8.codeplex.com/wikipage?title=Push%20Notification%20Worker%20Sample
If anyone can outline the references/nuget packages I need. It would be a great help.
EDIT:
Jim O'Neil's blog is a good starting point. I need to use a Azure Worker Role because I want to send my notifications periodically.
I also found the WnsRecipe NuGet package for sending push notifications from the server. Jim O'Neil solution is just as good.
Finally, to save a bit of time, I was hoping to avoid writing data acess code for registering apps channel ID's to a table on the server. The Azure Mobile Services MobileServiceClient class is a great solution to this as it lets you do all of this with a couple of lines of code. The table is available through REST services. However, questions remain:
Can I continue using the Mobile Services Table Storage MobileServiceClient with my app and Azure Worker Role or do I have to use Azure Table Storage?
If I can use MobileServiceClient, how do I access the table from my Azure Worker Role?
If I have to use Azure Table Storage which also provides a REST service for free, how can I access the table from my Windows 8 app?
Windows Azure Service Bus just released a new feature that allows to push Windows 8 (and iOS) notifications from C# back-ends (and soon from Mobile Services too), with no need top handle ChannelURIs at all.
Take a look at: http://channel9.msdn.com/Shows/Cloud+Cover/Episode-100-Introduction-to-the-Windows-Azure-Service-Bus-Notification-Hubs
Windows 8 code walkthrough: http://channel9.msdn.com/Blogs/Subscribe/Service-Bus-Notification-Hubs-Code-Walkthrough-Windows-8-Edition
If you try it, let me know what you think!
Strictly speaking, no NuGet packages are needed, they are just wrappers for functionality (it's all REST/OAuth under the covers) to make your life easier. As you observed, the Windows Azure Toolkit for Windows 8 and Windows Phone has been somewhat supplanted by Windows Azure Mobile Services.
If you want to do it all yourself, you can check out a three part blog series I did on using Azure Web Sites for Push Notifications. It's Web Sites, not Web Roles, but that part is fairly interchangeable; although, I'd say that Web Sites are going to be a far more economical option here unless you already have a service implemented that you are using.
I don't have Windows Phone incorporated into that series, and Windows Phone does use a slightly different notification mechanism from Windows 8, but that's on my to-do list, and hopefully what is there will get you going in the right direction.
When you use the MobileServiceClient to store data in Mobile Services, you are actually storing your data in a SQL Azure database. You have a number of options when it comes to accessing this data from your worker role.
Connect directly using a SQL client. This could be Entity Framework, a different ORM, or even raw ADO.NET. You can get the connection string for your database by selecting it in the Azure portal. On the dashboard tab there is an option to show connection strings.
Use a client library to access the data via Mobile Services. Unfortunately we do not have an official SDK that can be used from a worker role yet but the good news is that there is an unofficial package on NuGet
Access the data directly via the HTTP endpoint that Mobile Services provides by making HTTP requests. The API is documented here.

Pushing TimeClock Data from Mobile Phone to Quickbooks

I need to find a solution or develop one for allowing employees to enter their "hours worked" at the end of the day and then easily and quickly "pushing" that data to Quickbooks Pro 2010.
I'm trying to formulate, in my mind, how to build this type of solution. With my understanding of QuickBooks integration I think it will look like the following:
Quickbooks Software on PC
|
|
Custom App "Linking" Online DataStore to QB (on same PC as above)
|
|
Online Data Store Such as MS SQL Server, MySQL, or CSV Files
|
|
Website or Web Service Used to Receive Data From Blackberry Phones
|
|
App on Blackberry Phone to Enter and "Push" Data To Data Store in the Cloud
Do you see any flaws in this design? Any ideas how to improve on it or simplify it?
Remember, the application on the PC will likely be on a consumer or small business network that doesn't even have static IP.
On a separate note, as near as I can tell nothing yet exists that will do what I'm looking for. The apps I have looked at require you to import iif files into your phone (specifically ReportAway). During an initial test of the app, the import failed to import anything but did not produce any error messages. It's unclear to me how the data gets input from the BlackBerry app to QuickBooks but it appears to simply be CSV files. If someone does know of an existing app for this I'd appreciate knowing about it. However, we may still opt to program our own anyway.
You're on the right track with what you proposed. I have a few further suggestions:
Instead of building a custom app that sits alongside QuickBooks, why not re-use something that's already built? For instance, the QuickBooks Web Connector or (if you're building a SaaS service) the Sync Manager via the Intuit Partner Platform? Both of those are specifically designed to enable web/remote applications to communicate with QuickBooks. There are C# examples of doing almost exactly what you're talking about included in the QuickBooks SDK, and open source QuickBooks libraries for doing what you're asking.
Why would you ever want to use CSV files for storing data? Do yourself a favor, and use a database.
You could easily make the phone end of things available via more than once interface- build a web interface for iPhones/web browsers, and an app for Blackberry if you want. Once you have the infrastructure, the actual interface/view should be trivial to implement.
Have you looked at the available Workplace.Intuit.com apps for time tracking yet?
are you wanting to build your own app? Your best option is the build your phone app that makes a call to a web service hosted somewhere on the network where QB is hosted, the service can use the QB API to put the data where you need it. Or simply create a website that they can browse to that will make the call to the API, then you dont even need to bother with a phone app.
Phone/Website > Web Service > QB/SQL
I have solved exactly this problem in the past, in a manner very similar to as described by DustinDavis. In my case, I simply connect the smartphone client app to the php app server. App server stores the data immediately. In a separate scheduled process, app server refreshes and pushes data to QuickBooks server every 15 minutes or every 30 minutes as configured. I can provide more details if you are interested.

Categories