Launch browsable intent in correct app - java

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"

Related

The activity is not responding

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.

No activity found to handle Intent android.intent.action.REQUEST_TANGO_PERMISSION (has extras)

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.

always start app from root activity

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

How can I bypass the Complete Action Using menu when using an implicit intent filter?

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.

make my application start when boot complete on/off

Heloo everyone
im new to android development
and im developing an android application for my graduation project
my application must start when the device boot up
so to that i put these lines in the AndroidManifest file
<!--this to make app run at start up-->
<receiver android:name="MyIntentReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
so my program run autmaticlly when boot complete.
my question is how to stop this by user?? i want to put a toggle button on/off
for this option so the user can chose if he want the app to start automaticlly in background or manually ???
thanks in advance
This sounds pretty straight forward. Basically, when the phone starts, the Receiver class "MyIntentReceiver" will run. Inside this receiver you can put code based on user preferences to either start the application or do nothing. The toggle would be a CheckBoxPreference in the user preferences.
Let me know if you have any questions.
so my program run automatically when boot complete.
I would say no to that. It is rather you receiver gets notified when boot is completed. From that point on, your program has to decide to fire up your activity/service in onReceive() method of your receiver.
Thus, you will need to save a preference to give option to user. When your receiver gets notified, check the pref setting set by user. For more information about saving preference, you can refer to http://developer.android.com/guide/topics/data/data-storage.html#pref

Categories