I'm creating this Cordova (Phonegap) app where I store users personal data (username and scores) every 60 seconds after which I want to display all users data to everybody (like scoreboard). For this I obviously need something to first gather all the data from users and then showing it to everybody.
I tried sending data with ajax to php for database storage. Then I tried sending data with ajax to php file to write the data in file, and finally realized that ajax won't work locally(?) (yes, I'm a novice). How do I create this kind of "global memory" that is accessible by all the users? How this is normally achieved in apps? I'm open for ideas.
Thanks.
You need a backend service, and call it from your application with webservices. You should send the data to your server (via webservice), store it in a database, and generate another call to send the scoreboard to every user.
Google about Rest APIS, choose the one you like.
For storing into the app, using localstorage is OK if the data is not too big. If it is, maybe you need to use SQLite, accesible from the cordova API.
Related
I am working on a web scraping using goutte. I am providing a list of URL from a .txt file. I have created a job which do the scraping and save the data in DB table.
I want to show the data to the user as a job gets done.
Here is a condition that I can't use ajax.
Please help me find out the solution for this. Where an event shown happened when an entry was added in DB table and also, append data in front-end table but user should never get blocked.
If you can't use ajax the only other option is push notifications, which is a better option anyway. In laravel you can do this with broadcasting. In order to use broadcasting you need another service that will use web sockets to push the notifications, because (in general) you can't use web sockets with php. Laravel supports several services for broadcasting out of the box, like pusher. Another good option is socket.io.
I have a database that contains some data and i want to get notified automatically on my mobile app if any value in the database is changed without having to check the database every certain time,i have tried many methods and viewed several tutorials but it leads me no where,any help ??
This is not going to be possible with only database. You need to write down an RESTful API which your app needs to poll to look for changes.
Ideal way of doing it is using GSM to push notify your app when ever you change something in your app. This will again require PHP/ASP/NodeJS etc... There must be some way you are updating your database? This should go exactly there.
Hey guys im faced with a challenge of linking my localhost mysql/php when adding something in a form that form should also be linked with my android application.
ex. I have made a form for the admin whereby they could add a new bus route and it will be stored into their database using php mysql in localhost server now that new route should also be linked to my android application it should display the new route (My android application uses sqlite database so two different database here) so when users use the application when they search for new route it should also display as well
How can i go with that? any ideas please im really stuck in this
thank you
Well there are generally 2 approaches to follow when you want to 'Sync' your web database to your mobile database
Push Notifications: You could send a push notification to all your users, whenever a new route is added to the mysql db. When the notification is received by your app, (it's not necessary you show the notification to the user) you could just ping the server for the new route, or you can send the 'route' in the message part of the push notification if you can, and then add this new route to your sqlite database.
AccountManager: Using the AccountManager is the preferred method when you want to Sync your data. The AccountManager uses the SyncAdapter to Sync your apps data with it's cloud. When Android pings the servers of other apps for syncing, it pings your app's server too, and syncs your data. This method also takes care of issues like, if the internet connection was not working when it was intended to sync, so android will schedule the next sync soon.
To provide a good service, you should take a look at a client-agnostic API architecture.
In this architecture, you have a PHP/go/whatever-written API, that can or can not be REST (but it's reccomended), that will provide, given a HTTP petition, the desired result.
Using PHP in the simplest way, you should create different .php files, one for each action ( www.myserver.com/getRoutes.php, www.myserver.com/getRouteDetail?routeId=3), and make those PHP files query the MYSQL database and return (echo) XML / JSON / Raw text.
this should then be parsed by your mobile application, and added/updated to your SQLite database.
I'm designing a website using html5,css and JavaScript mainly for client-side validation. Also I'm designing an app which will request the data entered in the website from a database. i.e if user searches for a contact, it should display the info entered in the form from the website. i don't know which route to take in terms of d/base connectivity. I'm new to html5 storage(local Storage) and php for server-side scripting. I understand that local storage is browser dependent and data is stored in the users browser.Also if you want to have registered users(premium members) is it better to have database in the server connected via php scripts or localStorage works pretty much the same?
I can't answer everything but since you asked I can answer a few.
Q: User registration while also using a membership service PHP or localstorage?
A: PHP connected trough a Database never use localstorage for this.
Q: Search trough a site, LocalDB or Database?
A: Database.
Pretty much everything you mention there should use a database.
I'm developing an API in PHP using the micro application feature from Phalcon Framework. This API consists in receiving GET, POST, PUT, DELETE requests then return results from the MySQL database (the API has access to the database).
I'm developing a phonegap + ionic framework mobile application too and I need to connect all mobile users in realtime. Something like a chat, with informations returning from the API, for example: All profile informations like name, email, age, birthday will be stored and retrieved using the api.
My question is, its all possible to implement node.js here to make the app real time? Is there another way (using only ajax)? Ill need to create interactions between users, example: Someone will make a friend request to another user in real time, if the requested user accept the solicitation, it uses the api to update the mysql database, adding the user to the friendlist.
I want to use API because I dont want to give the future developers, the database access.