How to change default activity in Android app? - android

I used to use this apk a few months ago for studying and the last few days I've tried using it again but since I used it last time the app login system broke.
It used an login page for leaderboards and 1vs1 quizes but i dont need those features, i just need the learning environment.
But in order to get to the learning environment you have to log in, and since the log in doesn't work anymore I decided to take matters into my own hands and edit the app to bypass the login page, I've done my research and fell into a rabbit hole for 8 hours today and now i finally gave up.
This is part of the AndroidManifest.xml code:
<application android:allowBackup="true" android:appComponentFactory="androidx.core.app.CoreComponentFactory" android:icon="#mipmap/ic_app" android:label="#string/app_name" android:name="ro.umfquiz.umfquiz.presentation.UMFQuizApp" android:supportsRtl="true" android:theme="#style/AppTheme">
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="#string/admob_app_id"/>
<activity android:name="ro.umfquiz.umfquiz.presentation.login.AuthenticationActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden|adjustPan"/>
<activity android:name="ro.umfquiz.umfquiz.presentation.login.FirstActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden"/>
<activity android:name="ro.umfquiz.umfquiz.presentation.login.RegisterActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden"/>
<activity android:name="ro.umfquiz.umfquiz.presentation.login.LoginActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden"/>
<activity android:label="#string/app_name" android:name="ro.umfquiz.umfquiz.presentation.main.MainActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="ro.umfquiz.umfquiz.presentation.ModeSelectionActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden"/>
<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize" android:label="#string/app_name" android:name="com.facebook.FacebookActivity" android:theme="#style/com_facebook_activity_theme"/>
<activity android:exported="true" android:name="com.facebook.CustomTabActivity" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="#string/fb_login_protocol_scheme"/>
</intent-filter>
</activity>
<activity android:label="#string/training_mode" android:name="ro.umfquiz.umfquiz.presentation.testselection.training.TrainingSelectActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden"/>
<activity android:label="#string/exam_mode" android:name="ro.umfquiz.umfquiz.presentation.testselection.exam.ExamSelectActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden"/>
<activity android:label="#string/title_activity_quiz" android:name="ro.umfquiz.umfquiz.presentation.quiz.types.exam.QuizExamActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden"/>
I used a 3rd party app to find what name does the login page have, and the name is "ro.umfquiz.umfquiz.presentation.login.AuthenticationActivity".
I learned that the activity with the intent-filter that has action.MAIN and category.LAUNCHER is the activity that launches by default, i have tried moving that intent-filter tag to MainActivity, then to ModeSelectionActivity, FirstActivity, etc and none of this worked, i still landed on the login page. After moving the intent tag i always recompiled signed and reinstalled the apk and also made sure the changes were saved.
I also tried using android:enabled="false" on a lot of activities related to login, that version failed to sign .. idk?
So please help me, i really need this app to work. here is the apk, you can check it for viruses if you dont trust me but i guarantee that is safe.
The tools i used were : apktool, MT Manager, apk-signer, Current Activity, Notepad ++.
Link to apk : Google Drive

TO change the default activity you just move the code that says
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
to the activity you want. Now whether the app will work after you do that- it depends on if it needed data from that login server, and if its coded defensively to not crash if it can't reach their servers. Most likely it will crash, either immediately or after some time when it attempts to access data it needed from the server. But you may be able to use some of the app without it, it depends on a lot of factors in how they code it and how the app works.

In AndroidManifest.xml file:
<activity android:name=".Your_Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Related

Deeplinking - app listed twice

I'm having an issue with deeplinking in my application. When I click a url from my email and it prompts me to choose an application to open the link with, my app is listed twice. One version works and the other does not. Any suggestions?
Here's the snippet of code I think could be the issue:
<application
android:name="com.test.TestApplication"
android:allowBackup="true"
android:fullBackupContent="#xml/backup_rules"
android:resizeableActivity="false"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name="com.test.activity.LoginActivity"
android:configChanges="orientation"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="com.test.activity.HomeActivity"
android:configChanges="orientation"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.MenuDrawer">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
When an intent is sent to the system to open another activity, the system applies the rules specified here to find which activities/services can receive that intent. If there is more than one activity there, then the user will be prompted with all the matching activities. In this case what you experience is that the intent sent can be received (based on intent filters) by multiple activities, depending on how it is defined in your manifest.

App linking not working. How to open app from web browser?

I've followed the steps in the android documentation Here to implement linking in my application. I dont really need any fancy parameter passing, all I want is when the user clicks a link on the browser that my app opens. All I did was modify my AndroidManifest. Here is the relevant part
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="filter_react_native">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="u2player" android:host="open.my.app" />
</intent-filter>
</activity>
I am using react-native-navigation and trying to browse from either the chrome browser or the native browser to any of u2player:// u2player://open.my.app u2player://open.my.app/ doesn't work. I have also binded the url event from the Linking module but nothing works. I restarted, uninstalled, etc.
Help appreciated
Try using branch. It solves most of the problem that you are facing and it also has a very clean documentation. Please go through and let me know if you have any issues

Ad overlay requires the useClientJar flag in intent extras.

Ran into this issue trying to get Interstitial Ads to work on my first android app. Being a complete novice I really had on idea how to add the "useClientJar" flag to the Intent Extras.
This wasn't the issue, it's actually an error in the AndroidManifest.xml and I'm posting this question/answer because it's one of the few situations I've run into with only 5 relevant google results, the top one being a piece of IRC chat with one poor guy running into the same problem as me.
The issue is that I had foolishly made my main activity into the AdActivity in the AndroidManifest.xml like this:
<activity
android:name="com.google.android.gms.ads.AdActivity" <!-- notice this name, this means the interstitial ad is now the main activity! -->
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:theme="#style/FullscreenTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The fix of course was to correct this like so:
<!-- They are now two separate activities -->
<activity
android:name=".FullscreenActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:theme="#style/FullscreenTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="#android:style/Theme.Translucent" />

Android application with two application buttons

I am new to Android development. Currently, I am creating an Android app which should have two launching icons.
First icon to launch configuration part of the app.
Second icon which will execute based on the configuration.
Configuration will be not be frequent activity.
But launching of second icon will be very frequent to get the results based on configuration.
As I can see most of the apps have single launch icon.
Is there a way in Android which can fit into my requirement?
Thanks.
This might work.
In your manifest file (AndroidManifest.xml):
<application android:hardwareAccelerated="true" android:label="#string/app_name"android:icon="#drawable/ic_launcher">
<activity android:name="MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="SettingsActivity"
android:label="#string/app_name">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>

Android main activity still the old one. How to set new?

I am trying to learn Android.
I simply have Splash.Java and MainActivity.Java classes.
Before Splash.Java was the starting Action of my application.
Now I want to change it to MainActivity.Java.
Here is what I have done:
<application android:icon="#drawable/ic_launcher" android:label="#string/app_name" android:theme="#style/AppTheme">
<activity android:name=".MainActivity" android:label="#string/title_activity_main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Splash" android:label="#string/title_activity_main">
<intent-filter>
<action android:name="com.example.anddappp.SPLASH" />
<category android:name="com.example.anddappp.DEFAULT" />
</intent-filter>
</activity>
</application>
I cleaned my Project, and I do not use "Run previously launched application" in Eclipse. But still the application starts with Splash.JAVA.
What am I doing wrong?
"Check in run configuration which activity is selected." This way android, or in this case eclipse knows which of your activities to start from.
In the future, if you know the answer to one of your questions feel free to answer it yourself. You will be able to accept your own answer in eight hours.
Thanks to shashank Kane for providing the answer

Categories

Resources