I have an Android-based app and I'm developing a Glass app as a companion.
Code for the app lives in two places:
Web app (OAuth authentication/token creation, creating the subscription, handling the notify callbacks from Google server)
Android app (creating sharing contact, delete sharing contact and create bundle cover for a "photo album")
After handling all of the OAuth authentication and communicating with the Mirror API, the user has the ability in the Android app to creating a sharing contact. Part of that process includes the creation of a timeline item that serves as the bundle cover for a photo album.
On Glass, as the user shares photos with that contact, the notify handler in my web app assigns the photos to the bundle created when the sharing contact was established.
All of this works fine - no problems there.
What I'm running into is that after 7 days, the timeline cards begin to fall from the Glass interface. This includes my bundle cover for the "photo album".
Obviously I need to update the bundle cover to remain active, but I'm not quite sure how to do that (without quickly ripping through my quota, that is). Using the Mirror API, I've been able to retrieve the items from the timeline, then check each one for my bundle cover (based on bundle ID and isBundleCover flag) - but that is horribly inefficient when it comes to preserving my 1000 requests per day. Am I simply using the bundle in a way that it was not intended for?
Is there an easier, more effective way of fetching the bundle cover and simply updating it so it doesn't fall off the timeline after 7 days? In a way, it seems like I shouldn't need to update the bundle every time a new photo is shared, but I'm not sure about an alternative.
As I mentioned, the bundle is created in the Android app and that ID is submitted to the backend database shared by both the web app and the Android app. Short of querying that db using the bundleID to get the original ItemID for the bundle, I'm not sure how to make the bundle ItemID accessible in the notify handler.
Thank you for any suggestions!
As you mentioned the most efficient method when it comes to preserving API quota would be to save the itemID of your bundle cover in your own datastore and retrieve it from there when needed
Apart from that there are some things you can do to make finding the card in the timeline via the Mirror API easier, since the timeline.list method offers some additional parameters to narrow down the results.
?bundleId=yourBundleId
This will only return results with the provided bundleId, depending on how many cards are in your bundle, you might find the necessary card on the first result page, so that would only need one API request
&sourceItemId=something
If your bundles are getting rather large so that the bundle cover won't be found on the first result page, one thing you can do is to additionally define a sourceItemId which you only set for the bundle cover and none of the other cards inside of the bundle. That way looking for bundleId + sourceItemId (which you can also set to the same bundleId to make it easier) will only have one item, the bundle cover, in the result.
Using those methods you should be able to find the correct card in one request and update it in a second request.
Related
i have a quick question, so i just built 3 websites for customers using React and they're all deployed and working but now one of these customers is asking me how they can update its content, all the website are stored either on one or many JS files after building them with npm run build and configured with webpack, how should i build a website where customers plan to change either texts or add new images? the websites have a couple of map functions to display many pictures or card based on products, so everytime theres a change i have to go through the react files and change them build it again and deploy them which seems pretty static to me even though React is supposed to work with components and make it dynamic, what would be the best approach and/or tools to build a website where a customer can change a .JS file with text in Cpanel file manager, or just add pictures to a directory in Cpanel file manager and have it render automatically, i was thinking that i should make it server side so i can avoid having to re build and re upload everytime that there are changes, bu what would be the best options besides React to make it dynamic, Should i use node, express??
Thank you so much for your time !
One of the options could be Contentful API, you can store all of your data there and add permission to your customer to edit the repo. This will make it easier to change the content that you mentioned: "the websites have a couple of map functions to display many pictures or card based on products". So what you will do is simply fetch data from the API and render it on your website, this will allow your Customers to CRUD the content of your website, without your intervention. It is pretty easy to use, you can find out more about it here: https://www.contentful.com/developers/docs/.
Regarding the content of the website itself, e.g pages, texts on pages, and other static stuff that does not depend on actual data, but it's only a part of your code, I think it could be hard to manage without you coding it manually. If there is an exact part of content data that is going to be changed, you could make a new Admin page, where the user will be able to change the content and data on your website, and in this could you will have to add some back-end (node, express, etc). But what you're describing is actually CMS which is really popular nowadays you might want to take a look at some of them:
https://www.wix.com/
https://wordpress.com/
But if the Texts that you've mentioned are just a part of models e.g You have a product with something like this:
const product = {
productName: 'name',
price: '100',
image: 'img',
avialable: false,
}
and clients want to change productName, price, image, avialability then Contentful is pretty sufficient for you. If you will need some help with this Platform you can DM me I will try to help you.
We have a ExtJS7 app, that for special requests like reset password, that always opens a new tab via email reset link, get loaded in full. We would like to load only few pages that are needed to load for these kind of request
Is there a way in ExtJS that would only load a particular page and its dependencies
I have not seen tutorials on this subject in official documentation. Myself did the following - just created another app (or bundle) for logging. The backend is responsible for the logic of what to display (loginapp or mainapp) - in the absence of a session, the user receives the app login
Absolutely. You can make another app - each app is a page, and will have its own packaged dependencies.
That's the easiest approach. A more complicated approach is to break your application into several ExtJS packages. You can then configure the app.json to exclude all of the packages from the micro loader. You then need to load these packages dynamically, presumably after logging in.
Doing this, though, is extremely complicated, and almost certainly not worth doing.
I am new to PWA, i am curious to know that is it possible to create a PWA in angularjs?
please provide steps to make PWA using angularjs if it is possible to create PWA using angularjs.
There's nothing framework-specific about PWAs - your site just has to meet a certain set of criteria:
Everything is served over HTTPS
The design must be responsive
Your app must be available offline (i.e. it needs a Service Worker)
You need to provide a manifest file containing metadata about your application
Your app must work in all modern browsers
Page transitions shouldn't block the app (i.e. you need to show loading screens/spinners if things are taking a while to load)
Each page in the app needs a unique URL
All of that is achievable with Angular 1 - it'll probably be easier with a modern framework, but there's nothing stopping you sticking with what you've got, for now at least.
look at this github project https://github.com/addyosmani/angular1-dribbble-pwa
I have a create-react-app website, it has multiple pages using react router. I discovered recently I can host my site using Azure Storage Account rather than a web app which is pretty cool.
The main content of this website is a list of games which when clicked opens a list of characters per game. Each game has a path, my intention is to stick each of these game paths on a seperate custom domain to give the appearance that they are each their own site.
I am attempting to do this using azure cdn, and ive recently discovered that i can use Azure CDN to create endpoints and allocate them each a custom domain.
So I have a CDN Profile with Verizon Premium
I have a primary endpoint called [website-name]-cdn, it uses the base hostname with no origin path. Loads the base website as expected.
I have another endpoint called [website-name]-dota-2, it has the origin path for the game dota 2. Loads the base website instead of the page for dota 2, I need this to go straight to the dota 2 page.
Here is my url rewrite rule.
I want to be able to set up an endpoint for each individual game, but i just cant seem to configure things properly to get the urls to load correctly.
Everytime I change the rule I have to wait 4 hours so progress is slow.
Any help is much appreciated :)
Hopefully this is better layed out that my last attempt.
Figured this one out.
In short, the answer is that this cannot be easily accomplished the way I was going about it. However changing things wasn't as bad as I thought it would be.
The best way to accomplish this is to change the site to have multiple entry points, this cannot be accomplished out of the box with CRA so you need to use something like this. With my multi-entry point react site I change the react-router routes based on the entry point of the site.
Once this is done you can deploy the site to multiple storage containers, and then in each one specify a different entry point.
Sometimes when starting up a new instance on AppEngine the process may take some time. It obviously depends on your choice of libraries etc. My question is, is it possible to serve some other page while users are waiting? Reddit does a nice job of this. Other sites like Twitter provide a similar notice to users when the load is too much (they probably also starting more instances in the bg).
Does anybody have any experience in doing this on GAE?
Another twisted way that is very simple to implement without code changes: use another appengine that statically serves a tiny html of just an iframe to your real appengine.
This might break TOS so check that before doing it. It sill cost you more too.
That wrapper appengine can serve js that does the "loading" page , inserts the iframe and lster removes its content when hidden iframe finishes loading, then shows the iframe