I created an android application that has Firebase as the back-end and everything's working fine, from registration to authentication... but I need to add a feature where the user can only push A button once every 10 days for example. Now I used the sharedPreferences method which does the trick but it only sets the limit per application, in this case a user can uninstall and re-install his application and he would bypass this "time limit". I need to know if there's any function, a cloud function per-say, that limits the button click per registered user like for every user there's his proper time limit no matter if he uninstall and re-install the app or use another phone. Each Firebase user = proper time limit.
obviously information about button click (timestamp?) should be stored outside device, as app may be re-installed as you noticed. so you need some storage API, a server-side
if "registered user" is registered using Firebase Authentication then you may use also Firebase Storage or even better Realtime Database for storing infos about clicked buttons tied to particular users
PS. be aware that Firebase isn't free, well, not every component... web/mail auth is fully free, but sending SMS costs, so is limited in free plan. Storage have more limitations, like traffic or size limit, so be awared that if your app will spread around you may be forced to move to "blaze plan"
Related
I know there might be many questions like my question. But It is different. Actually, I am making a static chart that will show how many devices currently having my Android app installed and how many devices have uninstalled it.
For this, I am creating a uniqueID when the app is installed on a device and saving uniqueID along with FCM token to SQL database on the server.
To Create uniqueID:
uniqueID = UUID.randomUUID().toString()
Now, while I am saving every device with a token and uniqueID to the database. Of course, the device will be considered to have active app installation even when uninstalled the app.
So, I want to add a field in the database as inactive against the device that has uninstalled the app. To achieve this, I am thinking to send a request to the database and update the information when the app uninstallation is triggered.
Is this possible? And if yes, then can anyone please tell me how. Or are there any other method to achieve this. Thanks in advance.
Yes it it possible. You can send a push notification to your app to all your active users everyday from your backend side, and on your Android side, call an API on your server to confirm that you exist. If a client does not confirm his existence in a period of time (like 3 days), you know they have uninstalled the app. This is what Adjust and other statistics do for uninstall statistics.
You can't easily run your own code when an app is uninstalled. It is possible to run code in another app, but that requires that you get the user to install both apps.
In addition to the approach Adib described, you can consider using Google Analytics for Firebase to detect uninstalls of your app by Android users. As shown in the answer to this question, Firebase automatically tracks uninstalls in that case.
Maybe you want to use Firebase Analytics and the event app_remove. Mark it as a conversion and use Functions to remove the user from your Firebase Project(if anonymous) and/or any other data associated with the user(Storage, Database, Firestore, etc.) or anything else you might want to do upon user removal of the app.
I am developing an android application and i need clear the data of another application upon clicking an button.
i.e.: if i click button name "gmail" in my app,the data should be cleared of that "gmail" app
doubt:
1.Is it possible?
2.Do we need to be rooted our android device in order to do this?
° because greenify works with root access to force stop the other app flexibly.
I know that greenify works without root but pop that "force stop" ui screen of each single app to do that action.
MY APP FUNCTIONALITY:
I just wanted to develop an android apllication named "anti-theft cloud apps"
simply if an thief stols our mobile then my app detects when he changes the sim or an unique code send by mobile owner through sms from other mobile and logouts all the cloud based applications like gmail,google photos etc to protect our data to be stolen ,so in order to do that i thought of clearing other apps data(like gmail) PROGTAMITICALLY to logout. Is it possible
This is not possible with stock Android. You can do it with superuser, access root/data/data/PACKAGE and clear its content. But as seen in comment, this seems like evil thing.
I've been reading about Firebase Realtime Database for a while now I'm just wondering about the whole idea of event-driven data fetching from database. If data is downloaded from the database only when there was a change made to it, then it should be much less demanding on the device resources like battery or Internet connection. I thought I could remap the whole database fragment I need in my Android activity with my model objects that reflect the structure of my database and update its values with Child/Value listeners. Then I would have the whole data I need in a flexible form of POJOs and it would update every time there was a change in the database. So it is actually a real-time solution. But I wonder if such number of listeners would slow down or overload user's device in any terms like battery life or data transfer.
So, would It be a good solution to reflect database state in my Java model objects or should I go another way?
Could anyone resolve my doubts?
Thanks!
The listeners are triggered only when something is changed in the database. So you get data only when needed. It is expected that your app will lose their socket connections when there is no visible activity. That's the way the Firebase SDK works. Also, Android will aggressively pause background applications so they don't consume data and battery when the user isn't actively using it.
When you restart an activity for example, the Firebase SDK attempts to restore the websocket that it uses to communicate with the server. This websocket is fully managed by the SDK.
Hope it helps.
Firebase.addvalueeventlistener() only work when there is any change or update in database you are requesting. And it is a good way to move with JAVA objects or you can also use HashMaps<>.
As far as there is concern for device battery and performance then instead of requesting whole database you try to get only that part whose change event you wanna track.
And if you also want to have grabbing data on background as Whatsapp you can you Broadcast Receiver for internet and startservice() for where Firebase.addvalueeventListener() used.
I need to develop an android application that can allow users to easily change the password on the corporate account on their androids like in the screen below. The main goal is to avoid the long list of menus that they have to click through (and IT has to talk them through). NOTE: This only needs to change the locally saved password.
My first idea was to use the AccountManager setPassword function, but I received an error saying that the uid was different. From the looks of it, I would have to create and manage the account (including email, sync, and all that junk) within my app if I were to follow this method since AccountManager does not allow apps to mess with the data of other apps (Duh). I don't think this is really feasible.
My second idea was to simply launch the settings screen below from within my application. I'm relatively new to Android development, but have seen a lot of different intents used to launch specific settings. Is launching the specific account settings possible?
Incoming Corporate Settings
I have got a suggestion to restrict an Android application to be installed a limited number of times, let's suppose three times for a given user account. I have already inserted a form at the start of the application which checks for username and password from our database, and returns whether its valid or not.
Next I have to apply a trick to prevent this application from being installed more than three times by each user. I hope it clears what I am trying to do. Any ideas what to do and how to proceed?
By no means you can restrict user to not to install your application from google play.
Have a install_count column in the user table in your database. Each time the user fills out form, check for the install_count value, if it is equal to 3, then don't allow the application to continue, you can show a message like "max installs exceeded" and exit the app. Otherwise, increment the install_count value in the db for that user.
PS: As Zoombie said, you can't stop the user from installing the app, but you can restrict the user from running the application if installation limit exceeds.
Also you need to be aware, there are many apps which take a back up of the installed app and data that can be restored back anytime. More over, if the user changes his device more than thrice, he won't be able to run your application. So consider the drawbacks of this limitation.
Technically this isn't a very difficult problem but the issue of user relations will be difficult to manage. You should provide a simple and easy mechanism for your users to "reset" their install count. Additionally you need to inform your users of this restriction BEFORE they pay for your app.
Restrictions like this will result in problems in a few cases I can think of:
What happens if a user factory resets their phone and then re-installs the app?
What if the user installs a custom ROM or gets a new phone?
Are you going to deny a paying customer the ability to install an application that they paid for? Poorly enforcing a policy like this will only hurt you in the long run as it will result in
very bad reviews of your app
piracy of your app with the checks removed
Remember people are downloading/buying your app because it provides something to them and with that they assume that they'll always have access to your app. As soon as you start denying functionality or violating their assumptions you're going to start alienating your customers.