My web server and Android communication - php

I have a web page that is a demo for a web shop, which I will implement later. In the web shop you can select an item to buy it. In my demo scenario, I just want to send the info about the cost of the item to my Android upon button click in the web shop.
STEP-BY-STEP explanation:
openWebShop (in Android app you click a button and it calls this method to open URI)
Web Shop opens with items that you can buy.
Select an item from the list
onItemClick send the prize value and name of item selected to the Android device and store it in a String
Close WebShop -> display your App again with a New Intent / Fragment displaying the chosen Item name and Prize tag.
I also want to upload some files to the web shop. There are some questions here on Stack Overflow on how to do that, but for the time being, I won't tackle that problem yet.
QUESTIONS:
Can I use GCM for my idea ?
Do I need to create a Web page apart from Android coding or can you style your web shop inside Android coding? (no experience with web development)
Do I need to implement a onItemSelected inside PHP or is it done somehow else?
SOME INFO I GOT:
What I have learned so far is that I could use HTTP request to download a file from Web Server. I only saw examples on how to download XML files, but I assume that is the same for any file type. But I am not sure whether if this is the best solution for my case. I noticed GCM, but have trouble with PHP, since I have no experience with it - does it have some sort of onClick method ?

Related

Zingaya possible call from web page Likewise By using Nexmo/Twilio (possible/not possible) to call click that button from web page?

Anybody help me for answer the following Questions.
Zingaya enables voice calls through any computer, right from a webpage. No download or phone is required. Zingaya offers this seamless voice calling capability to website operators – whether it’s a huge e-commerce enterprise or your personal blog. Simply embed a “Call” button into your website. Visitors can click that button and the call is immediately forwarded to your landline, mobile phone, Skype account, or other computer. All you need is a website; all your visitors need is a browser and microphone. It’s that easy.
https://zingaya.com/
https://api.zingaya.com/ZingayaAPI2/Reference.pdf
Likewise, By Using Nexmo/Twilio make a call from web page to particular mobile number is possible or not.
It is possible to do this with Nexmo. We wrote a blog post about this back in 2018. It still provides a good example of the code you would need to implement to make this possible.
However things have changed a little since then and it is now possible to build a click to call button using the Nexmo JavaScript Client SDK.
All the code and all the steps to go through to build it are in the Client SDK Documentation
Absolutely possible with Twilio using a few different approaches.
Call across the public telephone network (PSTN) - connecting both via their regular phone.
Connecting the two parties and calls using VoIP (using WebRTC)
A combination of both approaches for each call leg
You can also layer on a lot of additional call routing logic and/or mix channels based on your requirements (voice and SMS for example).
Build Click-to-Call into your Web Application
Twilio Client Javascript Quickstart

Symfony 3 consume api data without using ajax or Angular

I'm working on a rest API to sell as SaaS. I already have most of the functions that interest me (integration with Mercadolibre a Spanish web site, market payments, google maps, social networks and also the accounting management part).
But now I want to add the possibility for the client to have a FrontStore where they can offer services with a few default templates that feed on API resources.
The issue is that I do not know how I can keep it isolated from the API code without using Angular, as Angular for websites affects a lot to the SEO. (the control panel and the mobile app did not have problems because I asked for everything by Ajax but those two things are not customizable)
So I do not know what to do.
Summarizing the question is: Since they could give access to templates or themes but not to the backend, it will be on another server.
I had planned to make 1 instance of the program for each client, but I do not want to do that since I did multi-company and I want to take advantage of it.
But I want to offer my 10 basic templates, the service to make a premium and also the possibility of the client to upload their own page. I hope I was clear.
I work with Synfony 3.0.0 and Angular 1.6 on a LAMP platform.
I need some idea to make possible get data from another server that have the rest API and use it just for a website like showing products or that kind of things. But without using Ajax or Angular templating.
I leave you a image to clarify. The left side is the private part, this is not customizable for the client, the right side is the web site and I want make it customizable by templates consuming the data from the API.
i don't understand all but if you need to consume API without ajax or angular, you can use guzzle http to create a client class that contains all your webservices (like showing products or that kind of things). This a tutorial how can use it. Hope help !

I need to send a message to android app after the customer bought something in my php shop

I need to send something to tell the android app that a customer just clicked the buy button in the page. The online store is written in php, and is embedded into android app by webview.
Usually I will write api to android, and they will just call the php url, then my php can communicate with the front end. However, in this case, it seems that the android has to provide me some kind api to call, so I can send my data to him.
Or is there a way android can set a listener to check if the buy button is clicked?
You can achieve this using 2 ways.
1) Create a java-script in your PHP code and from android Webview you
can call that java-script to check whether button clicked or not. You can refer this for implementation.
2) You can use Firebase Cloud Messaging Or anyother 3rd party Push
Notification services. But for my opinion FCM is best and you don't
need to pay for it. You can refer this for implementation.

Push notification for web application From one module to other module

i have integrated the notification system for web to android and Apple.
but now i have to integrate the notification system for web application part .
For ex.
currently i am working on restaurant project.
Now When customer Order From his / her mobile application on that time i have to show his/her order in Kitchen department . for that i have to Run ajax From kitchen department module to check that customer is ordered anything.
but the problem is when we run ajax every single minute then it will affect the server. because most of the server are not compatible ( for handling so many ajax request. ).
so i thought can we integrate the concept as same as push notification service for android and ios.
or anything else (different concept) for this one. please suggest a new idea.
i thought many option but at last time it will reach to the solution ajax request

How can we use Google Play Service for back-end server validation?

I was following these articles: Verifying Back-End Calls from Android Apps and Stopping Vampires using License Verification Library (from 24:57 to 25:34) to implement an In-App Purchase verification system for our Android apps.
I am a bit confused about how this works end-to-end and what we can assume about the generated token from calling GoogleAuthUtil.getToken() with the first email address found--when AccountManager returns more than one account. My questions are as follows:
Should we assume that any e-mail address used by the user to buy our
app will generate the same token (i.e., same user + app ==> same
token)?
If the answer to question 1 is no, is there a way to launch in-app
purchase for a particular account/email?
It looks like Google is picking the first e-mail address returned by
AccountManager for its in-app purchase dialog. Can we assume that
this won't be changed by the user after in-app purchase dialog is
launched? How do we find out if this changed after the in-app
purchase returns?
What should we store in our database to identify this user? Is email
address and/or token allowed? When does the token expire?
The java-client library looks very promising and powerful at first
read. But, a number of things remains confusing. Is there an article
that describes the end-to-end scenario--from an app initiating a
call to a back-end server through launching the in-app purchase
dialog, getting the result and closing with commits on the server?
What articles are the most useful for accomplishing this on Android?
The main issue we are trying to solve is to to get the full picture.
We've gotten the idea that we can avoid requiring userid/password by using the java client features and using tokens. We have registers our project (both the web app and android app on the same project) per the instructions for Google API Console. We have the php java-client for Google Play Service on our back-end server. We got our Android app to generate a token using the first email address and then call the in-app purchase dialog and handle the user response at the end of the dialog. We've got the parts. Now, we need to glue everything together. We are at the point of integrating with the back-end server. E.g., What is Redirect URi supposed to point to in our server? We've got a php url that we do http post messages to for our server app. We've included the code example for Google API client example--with client-id, secret, simple api key, etc. filled in--as an include to our php. But, what should we put in the redirect uri (we are missing a usage instruction for the example code)?
Also, we want to avoid having the e-mail used for the in-app purchase be different from what we log on our server database as the address the user used to buy our app; if the address is the correct thing to track, we want it to be the same as what was used for the purchase. This could be frustrating for our user if we make this mistake and prevent them from the features they paid for. We don't want to make this mistake and need some clarification on how Google Play Service works. If we initiated the server part of the workflow to get app Nonce / Payload / Credentials for the first e-mail address on the Android device, we would want that address to be used throughout the workflow. If the user changed this along the line, we want to be aware of this and gracefully recover. So far the articles have been helpful but incomplete. Any insight/suggestion is appreciated.

Categories