I have a situation where admin has defined both English and Spanish Language at the admin panel. Right now, Whatever the changes he made in admin panel, it is reflecting on the website.
My question that when we have different platforms like Android and iOS, Whatever the changes he made in the Admin panel I want it to reflect in the Android as well. As of now, I have defined both language information in Strings.xml.
I do not think calling server each time for the Labels is a good idea. If i do, it might slow down the app.
In detail, i have a validation message like "Please Enter User Name". And the admin changed the label in the back-end and made it Enter User Name. Each time calling server to get the information is bad idea. I would like to save the information or data for certain periods. say 2 hours or 24 hours.
What is the best way to achieve this?
In my opinion the best solution is to keep it in sqlite. You should check version of strings by calling your API when i.e. application is starting and then update its if necessary.
Unfortunatell queries SQLITE every time when user open new activity/fragment might also slow down your app. In my opinion you should keep your map of string in Application Class or in Object (if you use kotlin) - query your sqlite after checking version of your string or when app is starting if API is unavailable.
Related
I'm new to app dev...
I read somewhere in the doc: "...In most cases you want to use SharedPreferences as it is automatically backed up and migrated to new devices..."
On first install my app saves a few settings with SharedPreferences. It works great but if I uninstall the app or install it on another device the preference settings are lost.
How can I have these settings saved online within google somehow to be able to retrieve them if the user changes his phone or similar...
Could someone point me in the right direction ?
I read somewhere in the doc: "...In most cases you want to use SharedPreferences as it is automatically backed up and migrated to new devices..."
Your words "backed up and migrated to new devices" is nowhere written nor its true.
We use SharedPreferences in order to minimise the database operations, its like keeping variables handy.
On first install my app saves a few settings with SharedPreferences. It works great but if I uninstall the app or install it on another device the preference settings are lost.
If you wants to store or remember the device dependent settings, use device id / imei_id and store it on your web server mysql database
Even if user uninstalls app from the device and installs again anytime in future, make a call with async task to server by sending deviceid / imei_id and fetch its settings from mysql database and show it.
How can I have these settings saved online within google somehow to be
able to retrieve them if the user changes his phone or similar...
If user changes device, you can do nothing.
One way is, keep public device_id levels keys on server.
If user changes device and uses that key, then show him a response, this key is assigned to another device, but if you are the same, wait for our support
Call him, confirm he is the same old user with new device and delete his old entry from mysql and assign old key to the new device entry
Or use OTP SMS system to identify already existing customers with unique phone numbers
If OTP authentication code is correct then fetch settings for that user from the server, delete old mysql entry, modify new entry with old key and mobile number
This should be the your direction
Edit : 2 ##
I was hoping an easier solution exist but....
There is no short cuts for developers till the date, and it will be never.
Why, no short cuts / easy ways ?
Any device ( mobile, desktop / laptop / any AI device ) which is operated by a system software, is able to perform the tasks as per it is structured.
Ex : android is java based, obviously you can Make javascript based apps, but it is the extensions to the existing system, Android still has the base of Java virtual machine. ( Dalvic / Malvic like )
So, it is always better to use native java
Yes, Kotlin is best option now a days and better than hybrid approach
Every way has its own advantages, disadvantages
If you are developer, should go with native approach
Now your java code never knows, which version it is running on, so you have to, check android versions programming wise, and decide the flow for above Marshmallow & below marshmallow too, and it is explicitly done by developer by coding.
Ex, once user registers, he never shown please register again screen, it is not the magic, nor google, nor, java, nor android does anything, developer has decided, planned, architectured, designed, coded, tested that.
Even developers needs to take care of exceptions, you need to handle it in order to save your app from crashing.
In short developer is god, who creates his own universe, and everything is pre-planned and verified thats it.
You should use allowBackup = "true" in your manifest file. More details can be found here: AutoBackup
For example I expect this kind of situation: data in my application lost relevance and so it usless until update. And until update it have to show users some predefined message.
Is here any simple and free solution to this task?
Guess I can use some server to somehow send simple messages... but it sounds way too complicated.
If this is important I use Xamarin.
Update: main difficulty here is fact - my application can't in any way define if it's outdated or not. This may happen in random moment.
Although the requirement is not very clear I assume Update here means app update.
each time user launches app make call to an api on ur server to check if user needs to update app
If that returns true take user to a static view that says app needs update and redirects user to google play to install updates
If you want to avoid using a server, you should try Firebase (https://firebase.google.com/). More specifically, you should use Firebase Remote Config (https://firebase.google.com/features/remote-config/).
Define in a key-value pair of something like minimum_app_version_required in Firebase Remote Config. Every time user opens the your app, compare the values of app version and minimum_app_version_required that you are getting from Firebase console and show a dialog box accordingly. You can also change the value of minimum_app_version_required anytime you want.
Just set some internal flag. That when that situation occurs, you can set the flag to true and just edit whatever layout element you are using such as listView or any other element with your predefined messages saved in strings.xml. You can also build any custom pop up screen, depends how you want to show them. Let me know if you didn't understand or exactly how you want?
Need to implement versioning for this problem. To achieve this, you have to maintain a version number in server, this is the version number you app will have to save and use it to validate with server. If both are not same, then app will get the latest data from the server.
I am creating an android app that can be used by common users and also admin.
Suppose, if admin adds a new place name, that name should be added to database and when common user uses the app, he should be able to see the place name that is added.
I used MySqlLite database. But the problem is that if the app is uninstalled all data is lost. So I want some persistent data storage in which all the places that are added by admin are saved permanently.
Regards,
Sindhu
With the data being needed across multiple devices, your only option is to create/use a backend API.
Parse would have been a good choice but since that is getting shut down soon then it wouldn't be wise to use that.
Take a look at these alternatives here
You could also write one yourself, but unless you have some experience in that sort of thing then it will take some time to learn.
I'm currently working on my first serious app., and I would like to have some sort of contol on the data that users can enter.
Specifically, my app. allows users to write some text content (imagine something like a 'tweet'), and upload pictures.
I would like to prevent them from writing inappropriate text, and uploading offensive pictures for instance.
What I thought of doing, is to allow something like 'report abuse' button, where users who find some content offesive, can press - in which case relevent data will be saved, and later checked, to decide if indeed an inappropriate usage happened (maybe by some sort of server-side code).
As I said, I'm a beginner in android development, and I would really love to hear your suggestions and guiding. Perhaps it is something over my league for now? Maybe you know of such thing that already exists?
My app. uses Parse.com as its DB.
I would really appriciate your help.
Thank you.
I'm developing as well an app with parse and I also had to integrate in it a report button for the user.
The way I did it is simple:
In every Pf User object, I created a field of type counter named "reportCounter" while in the PFObject created by the user (it can be a string, a picture, etc.)I created a boolean field named "isReported". When a user find some inappropriate content he can report it through the dedicated button. The PFObject relative to that content gets its isReported field changed to YES and a parse background job checks every day for all the PFObjects, incrementing the reportCounter field of the owner-creator of the content and sending a report e-mail to the administrator. In this way you can keep also a record to see if a particular user is behaving badly. Just take a look at the Parse documentation about background-jobs. It's pretty good.
I hope this will help.
I would like to know what is the recommended means of showing a T&C dialog? A simple AlertDialog? Furthermore how can I prevent this dialog from showing on each startup? Would I need to use SharedPreferences to store a boolean (accepted\not accepted) or is there a simpler method? I'm trying to get a feel for the communities recommended approaches to some of the more common situations in android.
I'm doing it in my app, but more complex. I have a web services in Java to get last terms for locale in database. In android app I'm creating a sqlite table for terms with terms_id, terms_description and locale. terms_id in order desc define my last terms. I get default locale on android with Locale.getDefault().toString(). If the query don't return a terms, then I'm calling web service passing no terms_id and android locale. If the query return a terms, I'm getting the last one and calling web service passing the terms_id returned by query, locale for terms and android locale if it is different of in database. Web services validate if terms_id from android is the last in the database. If no, then it get the last one for android locale, or, if no having a terms for android locale, then it get the last one for default locale (en_US). If terms_id on android is the same of database, then web services validate if locale of android exists in database returning this version, otherwise it returns version for locale default. If terms already exists in correct version or default version on android mobile, then web services returns a code indicating that version is ok. After it, I save the terms, if need, in table of terms.
I'm searching now for the best way to show the terms. I think I will create a translucent Activity to create a window with a panel to show the terms and two buttons "Accept" and "Reject". If the user accept the terms I will call another web services to mark on the server that user has accept this version of terms. In the future, I can update the terms in web database creating a new version and when user login on mobile app I will call a web service to login and verify if user has accept the last version of terms and returning a new version if not, then, I will show a message for user to read and to accept the new version of terms.
Best regards.