I am writing a xamarin application connected to an API with .net core 2.2.
My mobile app will list categories which are created dynmically in my web backend and distribute through my api.
Each category will have an icon.
So the workflow should be:
Day1: 2 categories defined in the backend. Call to the api and refresh the list on the mobile app.
Day 2: add one new category in the backend. Call to the api and refresh the list on the mobile app.
Than I am wondering what is the best way to display my icons to improve the performance.
1: Point to a url icon
2: Convert blob in Image
Could you halp and point me to the right way please?
thanks,
By far, you should use the url:
Bitmap creation are integrated by Xamarin.Forms framework and implements best practices for handling images (especially on android, bitmaps are hell)
You can even use a cache image library to automatically cache your images so they will be downloaded just once (use FFImageLoading or ImageSourceHandler glidex / ffimageloading)
Related
I'm currently building a web app using Laravel 5.1 and would like to start creating a native application so that my users can use their phones. I have decided that using the Ionic Framework is likely the best approach for the app and just have a few questions on marrying the two together.
I've got routes in Laravel that looks like this example:
app.dev/geckos - This is a GET request.
Which takes the currently authenticated user, uses their ID and fetches all geckos that match their user ID. It does return a blade view however.
I assume that when working with something like Ionic, the GET request would need to return JSON instead on order to loop through properly?
Is there a way that I can alter my controller to serve JSON based on if the route was something like this instead:
app.dev/api/v1/geckos
Both routes would use the GeckoController#index method, ideally I just don't want to repeat the code.
I'm fairly new to Laravel and very new to Ionic. So if I'm over complicating this theory please let me know.
Any information is appreciated on this,
Andy
Another solution which I used is to have 1. application in Laravel, which is a RESTful JSON API. Then you would have 2. Web app (in AngularJS) and 3. Mobile app in Ionic (which is based on AngularJS).
So you will create two separate applications, mobile and web, which both communicate with the same JSON API. The web would be a single-page AngularJS application, so that way you can reuse all the Angular services which communicate with the API, maybe even some controllers between your mobile Ionic and Web application.
You will save some time when creating two separate responses for mobile/web application, since you would create only one: JSON response. AngularJS will take care of rendering in both applications, that way you won't have to create separate templates for web applications in Blade, instead make all the rendering using Angular in both applications. There will be some nuances in rendering of the same content in Web and Mobile app, but it would only require creating separate js directives/css styles/html templates for both applications, using Blade you wouldn't be able to reuse any view related code between applications. Also you will be able to use the same Authentication method for both applications.
To sum up, this solution should be cleaner then your solution because you will be able to reuse backend entirely between the applications, reuse a lot of fronted stuff (like input validation code, services, filters,..), reuse Authentication and introduce looser coupling and have much clearer structure then the ugly response type switch in controllers.
EDIT:
So this can be a rough example of the structure of such project:
1. API - REST in Laravel, returning JSON
-Controllers
-Session // actions CREATE, DELETE
-User // actions CREATE, VIEW, UPDATE, DELETE..
-Gecko
2. JS application - Angular App, for both mobile and web app
-common //controllers, services, filters - most of the frontend logic which reusable between both applications
-controllers.js
-services.js
-filters.js
-mobile //this part can be hosted on some server or part of the mobile application
-app.js //separate configs for mobile app
-controllers.js //controllers only for mobile app
-directives.js
-web
-app.js //separate configs for web app (links to HTML template URLS,...)
-controllers.js //controllers only for web app
-directives.js
-services.js //or even services only for web app
3. WEB APP
-HTML Templates - bunch of static .HTML files
-Home
-Login
-Register
-Gecko
-Gecko Views...
-Some index file with layout template, which includes everything from js/common and js/web, entry point to your web application
4. MOBILE APP
-www
-index.html // must include everything from js/common and js/mobile
-templates
-Gecko
-Gecko Views...
But the structure may vary significantly, depending on what part of mobile application you want to have hosted on web server and which should be available offline, or how you want to host it, how detailed the structure might be..
Doing this would be messy because your single controller action will be returning two totally different responses.
However if you go down this route, you could add an additional header to the request from the mobile app, and then check for this to switch the response.
I have a requirement where i have to share the images from the web url .I want to use this image in my app share contract. For this I am following the tutorial at this link. Only issue is that in the tutorial, file is selected using filePicker.Can you please provide any points on sharing the image from the url instead of file picker ?
We are building an AngularJS web app and we are trying to integrate DFP ads. By the way, we already have a PHP web app with DFP ads running so I am familiar with how DFP integration works, but of course it is different on an AngularJS app, due to its front end loading nature. So, I know there are three components we need to get working:
In the <head>:
The DFP tag for either sync or async, as shown here, https://support.google.com/dfp_sb/answer/1651549. I know Google recommends async, but recently on our PHP app we had to switch to sync, since async doesn't support rich media, and we were also facing some reporting discrepancies with async. So, with an AngularJS app, can we still use sync, or only async?
The DFP tag in which we define the ad slots, and also call the enableServices, singleRequest or syncRendering, etc. By the way, we want to have dynamically populated ad slots per page (app state), so we have to figure that out.
, and in the <body>:
The tags for displaying the ads for the ad divs. On an AngularJS app would it work with .display() or would we need to call the .refresh() method?
Any help is much appreciated, thanks in advance.
Cheers,
Iraklis
Try this ngDfp
ngDfp is a simple library for Angular JS that allows you to add DoubleClick for Publishers tags to your Angular site.
To show an ad, use
<div data-ng-dfp-ad="div-gpt-ad-1234567890123-0"></div>
I am making an app that uses http requests to display images of documents. It will open up on a main page with options of documents and once you click on a document it will read images from the server (note there are like 200 images) and you can flip through the pages. My question: how do a create an app that will get a bunch of images from the server without having to create a bunch of individual Xcode pages? And it has to be able to do it with multiple books based on which one you click. And it should be able to handle the addition of documents to the server.
Thank you so much in advance!
if i understand your question, by 'create page in xcode' you mean in 'interface builder'.
if you have much images you have to load, create and display them programmatically not with interface builder, and take care to load them asynchronously to not freeze your app ( the responde of how you do is in your other question about cacheing images ;) ).
I'm continuing my research on solutions for our organization for our mobile app strategy. There's two somewhat conflicting requirements:
it should be a web app in that all updates for users are immediate as we update the app on the server
the app should leverage native UI widgets and native device features as much as possible
With PhoneGap, the process appears to be that you'd normally keep the UI on the device, as part of the compiled app, and you'd hit your server via AJAX to deal with the data updates and submissions. That then gives you access to the native device's UI widgets and features using the PhoneGap API into their hooks.
However, in doing that, we lose bullet point one.
My question is if one can, using PhoneGap, create a 'web view' within the app that would allow us to keep the UI on our server (the app then pretty much becomes a custom browser). And, if so, could our UI still access the device's native functionality via PhoneGap's API or is that only accessible if we compiled our UI code?
A similar question came up on the PhoneGap Google Group recently.
One thing that came up was that you are unlikely to pass app store certification if you are loading UI and core functionality from a remote server as this invalidates much of the purpose of certification.
If you're going to do this, you should set up web services that return the content you want to display to users. Then you can use jQuery Mobile and PhoneGap to take the content returned from the server and display it on the application with the appropriate native UI widgets and features that you want.
So use jQuery Mobile to hit your server for data using something like:
var fileUrl = "http://www.mywebserver.com/servedevice?data=current&selection=fresh";
$.ajax({
url: fileUrl,
dataType: "html",
success: function( html ) {
// If the call succeeds, do something with the return value here
}
});
There are many other ways you can handle it including JSONP methods. See the documentation for details:
http://api.jquery.com/jQuery.ajax/
Another approach would be to point your HTML file at a server for the JavaScript, just like a CDN file load. Then, your app's JavaScript would be loaded at runtime instead of bundled into the app. However, when it actually runs, it is running within the PhoneGap WebView so it has access to all of the PhoneGap APIs.
This is the jQuery Mobile example:
<script src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>