I have an instant app with two features with differents urls.
Launching the example.com/A from the android studio this code works nice, the activity B (or feature B) is opened.
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("https://example.com/id/"+mIds.get(mPager.getCurrentItem())));
intent.setPackage(getPackageName());
intent.addCategory(Intent.CATEGORY_BROWSABLE);
startActivity(intent);
But running the installed app, when I press the same button I get the error:
android.content.ActivityNotFoundException: No Activity found to handle Intent
{ act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE]
dat=https://example.com/... pkg=com.example.myapp }
Any idea?
Related
I am trying to open the what3words app using the documentation here
https://developer.what3words.com/tutorial/mobile-linking-to-the-what3words-app/
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("w3w://show?threewords=daring.lion.race"));
startActivityForResult(intent, INTENT_CODE);
but I keep getting this issue
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=w3w://show?threewords=daring.lion.race}
I am on my device and have google play and the what3words app installed on the device.
Try opening the app like this:
Intent intent = packageManager.getLaunchIntentForPackage("{w3w package name}");
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("w3w://show?threewords=daring.lion.race"));
startActivity(intent);
To get the package name look for it in adb:
adb shell pm list packages
So, from my app I can launch Chrome and get it to load a page using the http:// using the code below.
My problem is that when I try and load content that is stored locally on the device. i.e. file:///, I get the error further down.
Any ideas on how to work around this?
Code:
String urlString="file:///storage/emulated/0/Download/primer.html";
Intent intent=new Intent(Intent.ACTION_VIEW, Uri.parse(urlString));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setPackage("com.android.chrome");
startActivity(intent);
Error:
android.content.ActivityNotFoundException: No Activity found to handle
Intent { act=android.intent.action.VIEW
dat=file:///storage/emulated/0/Download/cuescript_primer.html
flg=0x10000000 pkg=com.android.chrome }
When I open a link inside the Facebook app, it opens a new task for the browser while I can switch back to the Facebook app instead of opening the browser inside itself like an ordinary Activity. But when I launch an Intent to my application's Google Play page it behaves like an Activity inside my app instead of launching a separate instance for Google Play.
Here's how I'm starting the Intent:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=MY.APP.PACKAGE")));
I found this thread and wrote this snippet:
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("market://details?id=MY.APP.PACKAGE"));
i.addCategory(Intent.CATEGORY_LAUNCHER);
i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
Which fails with this message in logcat:
04-29 12:35:42.681: E/AndroidRuntime(8482): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW cat=[android.intent.category.LAUNCHER] dat=market://details?id=MY.APP.PACKAGE flg=0x50000000 }
Any ideas?
You just need to remove the addCategory() call and it should work.
Hi I am stuck with this issue.
I have my app which has 3 activities:
SplashScreenActivity, LoginScreenActivity, ViewPagerActivity(which houses 3 fragments).
When I put the apk in the mobile sdcard and install and open using the packagemanager. My App starts up just fine.
Issue - But, now if I press the Home Button and again launch the app from the Apps drawer/Homescreen. The App seems to relaunch and I have to go through the entire flow of Splash and LoginScreen.
This issue does not occur if I launch the App the first time itself from the Apps drawer itself./If I long press the Home Button and select the App from recent apps list the app is resumed properly as well.
For Reference I launch activities using these flags
Splash->Login
Intent intent=new Intent(SplashScreen.this, LoginActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
LoginActivity->ViewPagerActivity
Intent intent = new Intent(context, ViewPagerActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
Home screen icon launches whatever activity you have declared as the MAIN ... LAUNCHER activity in your manifest. Generally, the launch activity in manifest should be the main activity of your app. From there you can invoke splash screens and login activities when needed.
remove these flags or the complete line of code
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
This seems to be an issue when launching with package manager.
https://code.google.com/p/android/issues/detail?id=2373
if (!isTaskRoot()) {
Intent intent = getIntent();
String action = intent.getAction();
if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && action != null && action.equals(Intent.ACTION_MAIN)) {
finish();
return;
}
}
I have seen many posts asking how to link from a free android app to other paid version, and what I am doing is the following on the click method:
Intent i = new Intent();
i.setAction(Intent.ACTION_VIEW);
i.setData(Uri.parse(Constantes.uriAplicacionFinal));
startActivity(i);
However, when it executes I get the following exception:
06-07 11:54:15.793: ERROR/AndroidRuntime(1703):
Caused by: android.content.ActivityNotFoundException: No Activity found to handle
Intent { act=android.intent.action.VIEW dat=market://details?id=com.autoescuela }
Everytime I have used Intents, I have used them like this:
Intent i = new Intent(this, Login.class);
i.putExtra(Constantes.intent_login, R.string.Login);
startActivityForResult(i, Constantes.activity_login);
So, I specifiy it which activity is the one that has to pick up the Intent, but I don't know what I have to specify to launch the Android market.
Seems that you are testing the application on an emulator as a result your market application is missing. Try to test the application on real handset, everything will be fine.