I have been working on developing an application which needed login and signup screen. My register activity is not working properly.
The application is unable to take user from the start screen to the register activity, first the error arose of absence of intent filter then I included the intent filter in the manifest file but it seems like my app is ignoring the register activity.
I am attaching both manifest file and the activity code please have a look.
As images are suggesting there are two LAUNCHER Activities in your AndroidMenifest.xml file, so you will have to make one of them as DEFAULT category.
Put this line to your intent-filter of one Activity
<category android:name="android.intent.category.DEFAULT" />
instead of
<category android:name="android.intent.category.LAUNCHER" />
Simply define registeractivity like login activity , remove the intentfilter & it will work perfectly fine.
Related
I'm working on a system app which not contain any user interface(service only). I start my service on boot. And I'm killing the launcher activity immediately by calling the finish() method.
Also I'm using the following code to remove the icon from launcher/app drawer.
PackageManager packageManager = getPackageManager();
ComponentName componentName = new ComponentName(this.getApplicationContext(), MainActivity.class);
packageManager.setComponentEnabledSetting(componentName,PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
No issue with the implementation all work fine. But I couldn't reinstall apk on the device which already have this app installed unless uninstall the app and install it freshly.
My question is there are lot of apps in the Android devices which is not listed in the app drawer especially system apps & some downloaded apps too.(example few Keyboard apps downloaded from playstore).
I wonder is this only way to achieve this? Or is there are any other ways to declare the app as non UI app (to avoid getting listed/shown in app drawer) some where in AndroidMainfest?
Try this way. Completely remove this line. Because this is not the best idea to hide your app icon from the app drawer. It may cause some problems during the app updating process as you mentioned.
PackageManager packageManager = getPackageManager();
ComponentName componentName = new ComponentName(this.getApplicationContext(), MainActivity.class);
packageManager.setComponentEnabledSetting(componentName,PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
Also, remove the following "category.LAUNCHER" line from you main activity intent filter tag(on Mainifest.xml)
<category android:name="android.intent.category.LAUNCHER" />
Make sure you have ".action.MAIN" inside your main activity tag
For an example, you can simply replace this code with your current tag of your main activity. manifest
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.INFO" /> <!-- optional-->
</intent-filter>
After this, your app won't be listed in the App drawer since your app doesn't contain launchable activity. In this way, you can also avoid reinstalling/updating issue that you have mentioned.
In the android manifest for the relevant activity remove the Launcher intent filter:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
I'm new to Project Tango and for now I'm trying to run the demo apps provided but I keep on bumping into this error message in both the motion tracking and area learning demo projects because I can't see that action be declared in the manifest file. I know this error complains about either the activity not being declared in the manifest but it is there. Do I need to have anything else installed on the device so this line doesn't make the app crash?
11-04 13:04:21.789: E/AndroidRuntime(2867):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.projecttango.motiontrackingjava/com.projecttango.motiontrackingjava.StartActivity}:
android.content.ActivityNotFoundException: No Activity found to handle
Intent { act=android.intent.action.REQUEST_TANGO_PERMISSION (has
extras) }
This is how StartActivity is being declared on the manifest:
<activity
android:name=".StartActivity"
android:screenOrientation="landscape"
android:icon="#drawable/ic_launcher">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Everything you pasted in is correct. The issue seems to be an incorrect version of the TangoCore service. Please try to update your software via OTA.
Edit for more information :
The activity that is missing is a service that handles permissions needed by the Tango service, named Permission Manager. After updating ,via Settings -> About tablet -> System updates, you should have a this new application on your device. If you don't have this application you will not be able to run any Tango applications, as they all prompt the user for permission to run.
The new permissions are for Motion Tracking, ADF saving/loading, and ADF import/export.
More information can be found at the following link. Cheers!
https://developers.google.com/project-tango/apis/java/java-user-permissions
It might be worth noting that you can get into a state where one app will surface this message, but another won't. The solution is the same (OTA update).
I think the case where an app has been deployed, and run previously, then you wipe the machine (and don't get all updates), the previous apps might still run in debug, whereas any new ones one.
Either way, OTA update every time.
I have an activity for handling deeplink which is a browsable activity
suppose user clicks a link on another app and my browsable activity handles that intent
and start the app, then user minimise the app after use by pressing back button
if user reopen my app from running apps my browsable activity gets started instead of launcher activity
so my question is how can i start my app from launcher activity instead of browsable if user launches my app from running apps
Quora uses the same procedure, you can test by clicking a link of Quora on any other app
manifest of browsable activity
<activity android:name="com.example.android.deeplink"
>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data
android:host="com.example"
android:scheme="test" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
class code for handling intent data
Uri link = getIntent().getData();
how can i start my app from launcher activity instead of browsable if user launches my app from running apps
There is more then one approach to achieve this goal,
I believe that the best and simplest way would be to add to your "browsable activity" an Activity flag:
android:excludeFromRecents="true"
settings this flag - will make sure that this activity will simply won't be shown in the recent tasks in the first place.
more info in the documentation - http://developer.android.com/guide/topics/manifest/activity-element.html#exclude
my problem is the following:
My app has an activity that has this declared in the manifest:
<category android:name="android.intent.category.BROWSABLE" />
i am using this to launch my app when i click on a link received by sms. The problem is that the app starts running in the messages context and when i press the back button it launches the app in the default context.
What i want is, when i click the link, it opens the app in its own context.
How do I solve this?
Managed to get it working by using this on the manifest:
android:launchMode="singleTask"
I'm attempting to launch my app automatically when visiting a URL (test.com) in this example
however every time I do so I am asked which application I should use to do so. I'd like a way to launch my app every time without prompting for user interaction.
I've done research into how this can be done and have found the following:
Android Eliminate Complete Action Using dialog
But if I implement an explicit intent instead of an implicit intent - how do I specify to launch my activity when visiting test.com since I wont be using
<data android:scheme="http" android:host="test.com" android:pathPrefix="/" />
IMPLICIT INTENT (works successfully - launches app when visiting test.com but prompts user to select app - which is undesired - need to launch my app without the complete action using prompt)
<activity android:name="com.nfc.linked.Warning">
<intent-filter>
<action android:name="android.intent.action.MAIN"></action>
<category android:name="android.intent.category.LAUNCHER"></category>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:scheme="http" android:host="test.com" android:pathPrefix="/" />
</intent-filter>
</activity>
EXPLICIT INTENT (ATTEMPT):
public class Warning extends Activity {
Intent intent = new Intent(this, Warning.class);
startActivity(intent);
}
You can't.
What you call an Explicit Intent targets exactly one class.
What you've done earlier is to create an intent-filter in your manifest, which listens for Intents related to a URL along the lines of http://*.test.com/*. However, since HTTP is a very common protocol, and your URI is simply a website, other apps like browsers which listen for URLs like http://* will also offer to show the content. Due to this, Android creates a chooser, from which the user must select your app.
The only way around this is to have a button which opens the chooser for http://test.com in your app, ask the user to press it and choose your app as the default handler for such URLs. It cannot be done programmatically for security reasons, as then malicious apps can set themselves as the default for various actions.
Another option would be to come up with your own URI scheme, like Google Play's market://. As your app will be the only one using this, it will be the only one available to handle the link. However, you will need to make sure all third parties trying to open your app through another place (like a link on a webpage or from another app) follow your URL scheme. Additionally, if a user presses one of the third party links and your app is not installed, it will likely result in an ActivityNotFoundException on the user's device.