Firebase RemoteConfig used for showing a message on app start - android

I am thinking of using RemoteConfig for these 2 purposes:
Have on the server a parameter minVersion of the app that should function. So for instance if v1.5 is broken and I release an update on Google Play as v1.6 I want to block access to 1.5 and older and force the user to update to 1.6 in order to use the app.
Have on the server, a parameter to store a message to display in the app. So for instance have a message like "We are having server maintenance, please wait a while". On app start, if the message parameter is not empty, show a dialog with it in the app.
Of course, in this case, on each app start I need to fetch the remote config values and check them.
Why use RemoteConfig? Because it's easy, it's free, it's convenient and I don't need to have another separate server for these 2 simple jobs.
So is this a valid use case?

Yes these are both valid cases.
For point 1, you can quite easily determine the users app version. I created a video detailing how to do it
https://youtu.be/McP11kcrMtk

Related

how to save my app preference and retrieve them after re-install or change of device

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

What is most simple way to send notification of unexpected events to users of Android application?

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.

Setup Google Analytics to trigger new session with dimension change

I've been getting weird results when running some custom segments over my app data in Google Anayltics. I have custom segments setup for specific app versions. e.g. Custom Segment -> Conditions -> App Version - exactly matches - 1.1.0
Using a secondary dimension of App Version on tables running against this segment, you would expect all the values to simply be 1.1.0. However my data also contains some values for 1.0.8 (my last build version before the minor update).
Reading the Google SDK docs on sessions (for iOS, but basically the same for Android) it states hits within 30 minutes are grouped into the same session. I'm guessing what is happening is people are opening the app, updating, and opening the new version all within 30 minutes, resulting in a single session with 2 different version numbers.
Is my guess about what is happening correct?
If so, is there a way to setup something within GA (server side) to trigger a new session when a specific dimension changes?
Or is it expected that you manually trigger a new session during every app launch?
1) yes.
2) if by "server-side" you mean "within the GA interface", then no.
3) Yes. dimensions are arbitrary data to give insight about visitors. They aren't meant to act as switches or the like. So you are expected to trigger a new session, because that's what it's there for.
And anyways, you should be triggering a new session start on each app open anyways. It's the equivalent of if a visitor were to go to a website, leave and then come back. In the web analytics world, reporters expect this to count as a new visit. Unfortunately, the way GA works, it doesn't count, because of that 30m timeout. And GA didn't offer a solution to this until Universal Analytics version (the one with ga() calls. There is no equivalent with _gaq.() calls, which is what most people still use :( ).

Google Play Game Services - Managing achievements

According to the GPGS website-
Use the client libraries. The mobile client libraries employ a number
of strategies to reduce the calls you make to the service. For
instance, achievement and leaderboard data is cached, so a user can
view their achievements as often as they'd like without requiring the
service to make multiple calls. Both the Android and iOS client
libraries will know not to send a player's score to the server if
your score isn't as good as one you recently submitted. The Android
library also automatically combines frequent achievement increment
calls when it detects that you are being rate limited.
I'm specifically interested in 'viewing achievements without requiring the service to make multiple calls'. As far as I can see, the best way to do this would be to use the OnAchievementsLoadedListener and get a reference to the achievementBuffer.
Will that buffer be updated when an achievement state is changed and is it okay not to close that buffer immediately? If not, the OnAchievementsUpdatedListener does not pass a buffer or even and indiviudal achievement reference so how would I get the updated collection of achievements?
I found my answer here:
https://developer.android.com/reference/com/google/android/gms/games/GamesClient.html#loadAchievements%28com.google.android.gms.games.achievement.OnAchievementsLoadedListener,%20boolean%29
Set forceReload argument to false to gain the advantages of data-caching :)

Put some values on internet to access from android

In my app a user can (only) see the values uploaded by admin.
For example. A salesman is using the app will be able to see the latest rate provided by the manger to trade.
Now the question is "where to put these values?"
I have .net webservice experience with android but I guess it wont work in this scenario,will it?
Any suggestion that the returned result be in (preferably) XML format.
It sounds like you already know how to do this. You can download and parse xml within your app. If you alreayd know how to set up the websever, the rest is easy. Limiting who can see what is just a matter of associating specific transactions with an individuals account. Then just have the phone check for updates on that transaction when the app loads (using someting like AsyncTask) or if you want to get more complicated you could push notificatinos using the android cloud service, or even use a REST model. More details are needed for a more specific answer but you can do what you want.
You can do it on your own, and build a webserver with a MySQL/PHP JSON API or you can use parse.com for a smaller project.

Categories

Resources