I am new to android development. I know we can check for application first run using preferences. But My Question is - If it is first run i should get a First(splash) form where i should get a string and save it in SQLite(Database). Second time i should check the database if the string exists I should get the Second(Login) form. I tried many ways its not working.
Can any one help me out with a detailed code. Thanks in Advance.
Why don't you just write an if else statement in the main method of the main page?
If first launch > splashscreen redirect
If run xx > Login redirect.
To detect the first time an app is launched you could make a sharedPreference (see this thread: How to use SharedPreferences in Android to store, fetch and edit values or Check if application is on its first run)
Good luck.
Define a startup activity without a view, and in its onCreate method, check (using SharedPreferences) if this is the first run. If so, go to the splash screen, otherwise go to the login screen.
Related
I want to disable flag secure in a particular application after searching I got to know this is the line of code I need to remove.....
getWindow().setFlags (WindowManager.FLAG_SECU RE, WindowManager.FLAG_SECURE);
I am not a programmer or anything no knowledge just a beginner by myself. I don't know where can I find this line of code I checked in androidmenifest.xml but there's nothing. If someone is explaining can you please tell me that after removing this line of code I will be able to screen recording of that application right? Nothing more I have to do? Just remove this line of code?
I tried taichi application too it worked in other applications like jio tv, Remini etc but not in that application. I think The reason behind it can be that application stores id of my phone or imei number at their server and you guys know taichi run its pached application on their platform that's why my application recognise it and error comes out. Now you may know that if I try to download that application in another phone (rooted/nonrooted) and login with my phone number it shows error...
Conclusion- I can't login in another phone with same login id ...the phone must be same which I used to create login id and pass in the beginning....HELP PLEASE
you can use getActivity() or requireActivity() before.getWindow()
this getActivity() will return the Activity this fragment is currently
associated with.
Example from Activity
getActivity().getWindow().setFlags (WindowManager.FLAG_SECU RE, WindowManager.FLAG_SECURE);
Example from Fragment
requireActivity().getWindow().setFlags (WindowManager.FLAG_SECU RE, WindowManager.FLAG_SECURE);
Those lines should usually be applied in an Application class if the whole app can't be screen recorded. If only certain screens are secured, check the Activity or Fragment classes.
Despite all that, you can just use the software srcpy on your PC to connect your phone and screen record it even when FLAG_SECURE is set.
I'm looking to create a simple button in my android app that when clicked will take me to the app manager to a specific app where I can force close, uninstall, clear cache or data. Can someone help or point me to some examples to look at?
Use ACTION_APPLICATION_DETAILS_SETTINGS, with a package: Uri pointing to the app in question.
Note that this activity may not exist on all devices or may not be accessible by the current device user, so plan accordingly.
start following activity in your button click event.
startActivity( new Intent(android.provider.Settings.ACTION_APPLICATION_SETTINGS), 0);
In my Android app there are 3 activities..
1st one has username(textView and EditText),email(textView and EditText),password(textView and EditText)....
2nd one has Alternate number(textView and EditText)
User has to enter all these only once when he starts app for the first time(i.e just once after download) and all these should be saved somewhere in storage..
3rd activity displays all these information together along with device id and sim Number..
so when the user starts the app for the second time,directly 3rd activity should be displayed..How can i do this???
The manifest could make the 3rd Activity as the initial one. In the 3rd Activity's onCreate, check from SharedPreferences if initialization has taken place. If not, start 1st Activity. If yes, continue normally.
There are multiple options to store informations for your app like :
Shared Preferences
Internal Storage
External Storage
SQLite Databases
Network Connection
I'm new to StackOverflow so hey! Basically I'm making an android app and I want the user to have to register first by providing some information to build a profile. These then need to be stored. But the next time they open the app, they'll go to the main menu.I'm new to Android so please please help me :)
Hope this makes sense.
Here's code that will run only when the app is first opened, but I'll leave requesting and saving the info you want up to you.
SharedPreferences settings = getSharedPreferences("MyPrefs", Context.MODE_WORLD_READABLE);
first=settings.getString("first","notSet");
if (first.equals("notSet")) {
//Code in here will be executed only at initial start up.
}
Is it possible to have a safe start mode for your Android Application. In the sense that the application will not start the main activity (which is intense) but will open another activity which will have tools to fix some of these problems.
My suggestion would be to create flag in shared preferences to store whether your app was closed properly or check something else you need. Then add one part before (activity or what you need) where you check this and decide about the mode you are getting in.
Hope this helps and enjoy your work.