Give limited access to android app using Phonegap - android

I have created an android app using phonegap. I want to run the app to limit its usage to only 5 times means user can open this app only for 5 times after that user will not be able to open it instead it will show a message.
How can i do this ?

Depending on your requirements you could probably have a setting that you increment and save every time the app is opened, then when you see the app is over it's open limit you'd block access.
With this method clearing the data on the phone would reset the value. For this to be very reliable you'd have to have some sort of device ID that gets sent to a server that would determine if the app has been opened before and how many times.

Related

Why does one app launch faster than the other?

I'm curious about this. I have an app called GoSMS PRO and an app called Contacts+ installed in my phone. They both popup an alert notification when a text message is received. However, GOSMS PRO always beats Contacts+'s popup. I was wondering how this was happening in a programming perspective? Is there a way to give a certain app more preference than the other.
From security and permission side every app from Google Play has similar privilege, if they are not signed by the certificate of device manufacturer. This also means that none of the app will get extra preference.
Some time app do many type of checking/initialization/loading before showing their UI and when this type of things happens apps take longer period to load or display UI.
Most common things people do
Creating and initializing database
Reading database.
User validation (reading file)
Device state scanning(network)
Most common case is database access. I wonder if the app reading Content Provider before showing UI it might take long time depending on your device hardware and number of contacts.
Key strategy would be showing the UI right way and load data in background. Android has lots of Asynchronous api, just to avoid this type of scenario.

Locking out user from Android application

I'm looking in to the capability of locking out a user from using my application further. Let's say your app will run for some time, and after some event (time expiration, # of app starts, etc.), you want to lock out the application, or brick the app in some way that it can't be used anymore
I've considered storing a piece of data either as an internal file, or as a shared preference value, that would track when the event is hit. The issue here I believe is that the user can go in to the OS and simpy clear the data, which would erase the progression to the lockout event.
Does the community have any suggestions of being able to lock out a user that can't be circumenvented, and doesn't require a rooted phone / unique ROM image? I am targeting Android 4.0+ if necessary, but currently have min SDK of 11, and target SDK of 15
I did this in an early beta by checking the date, then after the specific date, displaying a message saying it had expired and doing a divide by 0 error.
For a specific time after they have installed it, you will have to use an online service, or try and hide a file on the SD card (not guranteed to work at all).

how to block an application in android after using several times?

I created an application for pharma.
Now I want to stop that application after launching 10 times, and also even user can not launch an app after uninstall and reinstall the app.
How could I do that?
Does anyone have an idea?
Now i want to stop that application after launching 10 times
You are welcome to maintain some sort of counter and disable your launch activity when it should no longer be used, via PackageManager and setComponentEnabledSetting().
and also even user can not launch an app after uninstall and reinstall the app
This is not possible. You can store your counter on external storage, some place that will be retained even after an uninstall. However, the user can get rid of your counter file whenever the user wants.
If your application uses net connection you can send a parameter to your service with unique device id. In your service you get the device id and compare with your database. If device id is not in the database (first open of app) create a row with device id and the time stamp.
Everytime the user opens the app control the timestamp with today. If it is more than 10 days you can lock the app.
You can use SharedPreferences.
Create an int variable = 0 and store it to SharedPreferences
In onCreate method, increment this variable
Check (In onCreate method), if this variable > 10 - call finish()
Thats all. Hope this help.

Android - How would you go about installing setup data from the internet

I am working on an android application that uses data from the internet. On first use, downloading and inserting data into the database takes a some time which might make the user feel that the application is non-responsive and might drive impatient users away immediatly. I am currently displaying a progress dialog to inform the user that this operation might take some time to complete (around 1/2 a minute).
is there a way to install all the data while installing the application, ie. before first use?
No. You cannot do this. Other applications can capture Intent after an app is downloaded, but not if it is the app that was just downloaded.
This question is similar to Launch a service after the intallation of my Android application.

Android App quits automatically if its idle for some hours

I created an new Android app and succeeded in its working. Its all functionality are working fine. While starting it will ask use name and password.
What my problem was "If my Application is idle for some 4 to 5 hours, then automatically it get quit , while restarting its again asking to login"
I need to know how to avoid automatic quit of my app.
I'm sorry if its simple or already asked quetions.
I need to know how to avoid automatic quit of my app.
No, you do not. Simply redirect the user to log in again, or, as #Rasel suggests, persistently cache credentials in a file or database or something.
Android applications do not and must not live forever. Phones have limited RAM. Android will terminate unused applications after a period of inactivity, to free up RAM for other applications. This is perfectly normal, just as it is perfectly normal for a user to close a Web browser after visiting a Web app.
Its completely natural for the android application.Android OS automatically kill the process when it needs to do.So if you want keep your application alive you have to think differently.To keep always running you can use service that will monitor your application states and handle the situation when it prompts for the login info again.
Another option you can write the login information in the shared preference and can clean when user intentionally leave the application.So when starting again if you find the information you can directly prompt to the user without entering the login information

Categories

Resources