Best practice to upload file to cdn while developing mobile application? - android

I am making mobile application . I have used Azure mobile service as the backend services for to build mobile application . In mobile app i have to upload images to azure cloud storage . I can do by two method .
Uploading file from the client application
uploding by sending byte array or base64 string of file to server
and server will uplod that file to them
I think first method is good as it is directly going to upload file instead of going to server and pushing again to azure storage .
I don't know which approch is good . Any help is appriciated

As David mentioned, the question is a bit broad and not related to CDN, but within the scope of Azure Mobile Services, I would recommend option #1, as that offers a few benefits, including (but not limited to):
Minimized load on your Mobile Service, potentially avoiding the need to scale the service to keep up with file management
Ability to use the storage APIs designed to handle blob management from the client and avoid having to implement and maintain similar APIs as part of your service (including support to resume uploads/download and other nice features for mobile apps)
Ability to (more easily) use the different geographic locations offered by Azure Storage to have clients upload and download files using the nearest location.
And the list goes on...
The recommendation is still to expose an API from your service to allow clients to request a SAS token in order to provide authenticated access to storage. This approach is similar to what is used by the Mobile Apps File Management SDK.
I hope this helps!

You can use a third party service like Filestack that handles the uploading & storing files, and the CDN delivery.
You can upload files directly to Azure with the pick and store method:
filepicker.pickAndStore(
{
mimetype:"image/*",
multiple: true
},
{
location:"azure"
},
function(Blobs){
console.log(JSON.stringify(Blobs));
},
function(error){
// console.log(JSON.stringify(error)); - print errors to console
},
function(progress){
console.log(JSON.stringify(progress));
}
);
And then every file uploaded generates a CDN url that you can use to deliver the image in your application. Not sure if you've looked into what CDN you want to use yet, but Filestack partners with Fastly so you have all of their features, which is one of the best.

I use Cloudinary is a image back-end for web or mobile development, It's really easy upload images to a CDN.

Related

Store data from local db to Oracle MCS

I want to store contents of my local db to oracle cloud. I have searched the internet but cannot find any apis which can guide me to my result. The documentation is very naive and I cannot find a solution.
Been searching for 3 days, help would be appreciated
(Disclaimer: I work for the Oracle MCS team)
In response to your update that you want to store data in MCS.
Let's break this discussion into two parts, the MCS server side, and the client side which is Android in your case.
From a MCS server perspective you have two options for storage, the "Storage API" and the "Database API". The "Storage API" is designed to store files (aka. objects) in collections. The "Database API" is for more traditional data stored in RDBMS tables, columns & rows. So you need to make a choice which you think is more suitable for your needs.
Note that the Storage API is accessible external to MCS from a mobile client as a REST API, as well as node.js custom APIs within MCS that you would manually write. However the Database API is only accessible from node.js custom APIs. So if you choose to use the Database API you must also build server side custom APIs to expose the Database API to your client. With the Storage API it is already exposed to your client.
If we move onto the client side and what you need to do, you ultimately need to build your client to contact these server side APIs, which ever you choose as the description above. In building the client side you have two choices:
1) Manual - you create your own code to create, store and manage objects in the Android local db (eg. SQLLite), and then you need to write client side code to consume the MSC server APIs you've setup and read/write data from the local db. There is potentially significant work here, but, the MCS Android SDK will make this job easier as it provides client side libraries to call both the server side Storage API or Custom API (wrapping the Storage API or Database API) that we considered above, rather than you having to write raw REST calls.
2) Automatic - the MCS Android SDK also provide a "data offline & sync" SDK that takes care of the creation, store and management of objects in the device's database for you, and synchronising the data with the server side for you, based on a bunch of policies you pick. There is still some coding required, but mostly it's greatly reduced compared to the manual option above.
I'm sure you are already familiar with the MCS YouTube channel and it does cover how to build custom APIs, use the storage API, and does include videos on the Data Offline & Sync SDK too. Look to the playlists in the channel for the major topic areas. By chance I literally finished the Android video for Data Offline & Sync a couple weeks back (remember to watch the other data offline & sync videos before this one!), and it's not yet public. But you can have a sneak peak of the video here.
(A comment for future readers of this post: Please note that URL may change when we finally properly publish that video)

How to upload image in windows azure mobile service from android.?

I am new in android I am using windows azure mobile service and I am Inserting Text data successfully but now I want to Upload Image in windows azure mobile service. I know its is possible by Azure Storage I have seen this post http://chrisrisner.com/Storing-Images-from-Android-in-Windows-Azure-Mobile-Services but its confusing can anyone tell me simple step by step process to save image in windows azure mobile service.
I will be Very Grateful for you
The page you're looking at does not use the best recommended approach for storing image data with Azure Mobile Services. Instead, you should connect to Azure Blob Storage when you want to store a file. You can see a full tutorial of connecting to Blob Storage and saving files from an Android app here: http://chrisrisner.com/Android-and-Mobile-Services-and-Windows-Azure-Storage. Essentially the steps you follow are:
Create a table script / custom API in your mobile service that will save your data as well as generate a Secure Access Signature (SAS) URL from Blob Storage.
Call that endpoint from your mobile app.
Return the SAS URL from the endpoint.
When you get the URL back on your mobile app, use that URL to post your image file.
The way that older approach uses is to convert the image data into a format that can be stored using Azure Mobile Services SQL Database. This does work, however, it's very inefficient.

How would I use blobstore to process android images

Can someone please clarify this for me. I am reading the developer page about the blobstore at https://developers.google.com/appengine/docs/java/blobstore/overview. I can't seem to wrap my head around the process of saving and retrieving blobs? It sounds like
android app would directly send an image to the blobstore
after saving the image, the blobstore would then return a blobkey to my backend for me to put in the datastore
Is that the process? Maybe it's because I have had a long day, but I just can't see it. If someone has an example they don't mind sharing, please post it. I just need to save images from android in the blobstore and then be able to retrieve them with blobkey or otherwise.
I have already look at
Upload to Appengine Blobstore in Android
Using Google BlobStore with an Android application
Android Interaction with Google App Engine Blobstore Service
What is the syntax to get a Blobstore upload url from Android?
For the life of me, I don't know why they are not doing it for me.
I suppose some questions are:
How does android know where to send the blob to? I mean, does Google distinguish between my instances of the blobstore versus other people's instances, similar to how it distinguishes my instances of the datastore? In other words could I go to app engine Applications Overview and see all the blobs that belong to my app the way I could in the datastore? I suppose a complete, working piece of code could help me see these answers.
Part of my problem could be that I have never used servlet. I am presently using Google Cloud Endpoint for my api.
Actually there are two ways to upload to blobstore:
Using direct upload handler:
Server gets a unique one-time secret upload url via createUploadUrl(..) and sends this url to client.
Client uses multipart/form-data POST to upload data to this url.
The upside is that you can upload large files (>32mb).
Using blobstore FileService API which is deprecated and should not be used any more:
You create you own POST upload handler where client uploads data.
You use FileService API so save data to blobstore.
The downside is that you can upload max 32mb of data (generic GAE request limit).
The upside is that you have access to data so you can edit contents if needed.
Your description of the process is correct. The only step you miss is the first: the server side calls blobstoreService.createUploadUrl(redirecturl) to generate the URL to upload to. Then the handler at redirecturl will save the blob key to the datastore.

Is it possible to use Dropbox, Google Drive, Skydrive, etc. as a server space?

I'm creating an app that connects online to a server to collect information. To save money from renting server space from a big corp, I was wondering if any of these free services (Dropbox, Google Drive, Microsoft Skydrive, Amazon Cloud, etc.) could be potentially used as server space?
I pretty much want a "space" or "cloud" where people can connect to to collect data. Example: I have a weather app, and there is files on my server and I update the files according to the weather. I would like them to be able to open the app and connect to my server to gather the weather data saved on my server. It really won't be much digital space, so I didn't want to pay bookoo bucks when I could potentially use a free service like Dropbox.
You can't execute remote code on any of those services (that I'm aware of), but you could certainly save files to them. For example, you could write out text files (CSV? XML? JSON?) to those locations.
Take a look at the Dropbox SDK for details on how to integrate it to your iOS or Android project. It's pretty simple.
Here's a basic code sample for uploading a file:
NSString *localPath = [[NSBundle mainBundle] pathForResource:#"Info" ofType:#"plist"];
NSString *filename = #"Info.plist";
NSString *destDir = #"/";
[[self restClient] uploadFile:filename toPath:destDir withParentRev:nil fromPath:localPath];
I heard several times that it's working, but hadn't made my own experience yet.
Check out this post http://lifehacker.com/5528104/use-dropbox-to-share-and-host-your-web-site
As Axeva said you can't run your own scripts or sql. You have to write your own workaround.
I'm sure you can use Dropbox. But only if you want to download or upload some files. And I'm not sure if it's ideal. But there are other alternatives you may want to look at. Like you can use GoogleAppEngine if you want some processing to be done on server. Maybe Parse.com is another choice but not sure if it fits your needs.
Check out site44. It allows you to connect with dropbox and use a friendly URL (own domain or otherwise) for accessing the files.
I would recommend using something like Parse.com as your backend. Their free tier lets you store 1GB. Maybe not as much as Dropbox, but the API for Parse is great and made for storing/retrieving from mobile apps. You'll be up and running really fast. I haven't looked at Dropbox SDK though.
Dropbox works fine if all you want to do is using it as an FTP to put some JSON or XML files on.
Just be sure to put it in your dropbox's 'public' folder and requesting the public link.

asp.net Web Api and mobile aplications

I just want to make a TV guide for Android and later some other Mobile Platform. I want to use an RSS updates to update my application. In this specific scenario I want to use http://tvprofil.net/ 's RSS resource. I thought that I could just call site's RSS XML from my Android app, parse it, show, and thats the end of the story.
But, my cousine told me that the best way to do things is through Asp.net Web Api Service. Something to deal with REST. So, If I have to change resource, to like some iptv provider's RSS I would just change the Service and not have to deal anything with my mobile application. Other advantage, he said, is if I want to build Windows Phone application or iOS aplication that works the same way, I would have that same service to do job for me and just create UI and basic things for those apps.
The problem is that I have no idea how Asp.net web Api is used.
Can anyone give me some usefull link, or even better, write an example of this thig. I just want the RSS from http://tvprofil.net/ to go through Asp.Net Web Api Service and that I can call service and get it as XML or ... even Json... or to get anything at all to my app.
The whole thing is pretty confusing to me
If a RSS feed has enough data for your application to function then you do not need ASP.NET Web Api. The only role ASP.NET Web Api could play in this scenario is if it acted as an intermediate. E.g. your client application contacts your server application (ASP.NET Web Api) which in turn pulls the data from the actual external data source (tvprofil.net RSS).
For completeness sake, a list of pro's and con's:
Advantages of using an intermediate server
Reliability. You can cache the data of the external data source and serve that data even while the external data source is offline. Also, by caching the data you can lighten the load on the external data source to a bare minimum.
Transformability. Your intermediate server can translate the data of an external data source to another format that is more suitable for your client application. This is useful when you have many external data sources that each serve data in another format. Your intermediate server acts as a layer of abstraction for your client application.
Disadvantages of using an intermediate server
More effort. It will take more effort to develop and host an intermediate server.
Reliability. You must ensure your intermediate server is online and connected to the internet 24/7

Categories

Resources