[Q] App Chooser not being shown when google browser is the default - Android Software Development

I've seen a few other similar threads, but none that both matched my problem and had answers, so sorry if this retreads familiar ground.
I've got a browser and I'm trying to catch the same intents as the google browser. I've even gone so far as to copy and paste them directly from Froyo's browser. They are listed down below for reference. However, when I try to send an intent to create the chooser so the user can select my browser as the default it does not always appear. Here is the code for creating the intent (url-i-want-to-open is an actual url in the code, but I can't post it because I'm a new user):
Code:
Intent anIntent = new Intent("android.intent.action.VIEW",
"url-i-want-to-open");
anIntent.addCategory(Intent.CATEGORY_BROWSABLE);
startActivity(anIntent);
and the logcat output:
Code:
08-26 14:53:25.698: INFO/ActivityManager(85): Starting activity: Intent {
act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE]
dat=url-i-want-to-open cmp=com.android.browser/.BrowserActivity }
For some reason the intent is automatically resolving to Google's browser unless one of the following is true:
1) I've cleared the defaults from the google browser via application settings,
2) I've installed a third browser, or even just a HelloWorld app with the intent-filters listed below, or
3) I'm running on a platform earlier than 2.2
What is really confusing is #2. It doesn't matter what that third app is. I've used a default hello world with just the first intent-filter and that's enough to trigger something behind the scenes that tells Google it's no longer the only default browser. However, it's not enough in my own app, and the only differences in the two manifests are that mine has a sharedUserId, a couple of extra activities (none of which have intent-filters) and permissions (none of which have anything to do with browsing, in fact HelloWorld doesn't have any permissions at all).
The program flow is: user opens browser, it sees that it's not fully installed and opens another activity, that activity does some stuff (none of which deals with intents) and then checks to see if my browser is the default, if not it fires off the aforementioned intent to create the chooser so the user can set the default.
When I reverse the process (install my app first, then HelloWorld) and have a button in HelloWorld that calls startActivity, the same thing happens: HelloWorld cannot show the chooser unless I've already installed a third app.
Is there a change in froyo that would cause an application to not be able to use startActivity with a generic intent that matches to its own package? Or some other change to the way activities are resolved or installed that broke the way preferred activities are defined? I know that the PackageManager preferred activity functions have changed, but I'm not using them at all.
----- the intent-filters -----
Code:
<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="http" />
<data android:scheme="https" />
<data android:scheme="about" />
<data android:scheme="javascript" />
</intent-filter>
<!-- For these schemes where any of these particular MIME types
have been supplied, we are a good candidate. -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:scheme="inline" />
<data android:mimeType="text/html"/>
<data android:mimeType="text/plain"/>
<data android:mimeType="application/xhtml+xml"/>
<data android:mimeType="application/vnd.wap.xhtml+xml"/>
</intent-filter>
<!-- We are also the main entry point of the browser. -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

followup: It seems that the OS is remembering preference orders in between installations. So if they ever chose the google browser over mine, the OS will always choose the google browser over mine until either:
1) the google browser's defaults are cleared, or
2) another application is installed that listens to those intents, resetting the need for a chooser

Related

[Q] Help me retain my sanity please! Adding app to "share via" chooser

Hi all. I have literally spent days on this, trawling through git source reps, playing with "Intent Playground", scanning logcat over and over again and I'm tearing my frickin hair out. Perleees, put me out of my misery one way or the other.
Developing an app that does funky stuff with text. Works fine except the last TODO which is to add my app to the "Share via" chooser. Source apps for the text I'm targetting are primarily mail clients.
I've added an intent filter (in fact, tried every combination I can think of) but my app never shows in the chooser.
Code:
<intent-filter>
<action android:name="android.intent.action.SEND" /
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/*" />
</intent-filter>
Here's a logcat fragment showing the chooser being created:
Code:
09-30 20:51:07.964: INFO/ActivityManager(124): Starting activity: Intent { act=android.intent.action.CHOOSER flg=0x10000000 cmp=android/com.android.internal.app.ChooserActivity (has extras) }
09-30 20:51:08.374: INFO/ActivityManager(124): Displayed activity android/com.android.internal.app.ChooserActivity: 381 ms (total 381 ms)
09-30 20:51:30.374: INFO/ActivityManager(124): Starting activity: Intent { act=share typ=text/plain flg=0x13000000 cmp=com.htc.android.mail/.ComposeActivity (has extras) }
As you can see, the share action was initiated in this case from the HTC mail client.
Any ideas? A free copy of my app to anyone who can help out. I know it's not much, but what else can I offer
I don't see a "Share Via" in the gmail client.
There is one in Astro file manager though.
Your app should show up if you long press a .txt file from Astro and click Send.
Hi, thanks for the response.
I should have mentioned it works fine as a send to target but it's the share via chooser I want to extend.
Cheers
Found the solution
Hi folks
Finally found the solution. Very pleased about this because I was just about to offer a $50 reward for one
<intent-filter>
<action android:name="share" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/*" />
</intent-filter>
Click to expand...
Click to collapse
There is NO documentation on this that I can find and I've never seen another intent name in this format. Maybe Google only want partners to be able to add apps to the Share Via choosers?
Anyway, up and running now.
Cheers all

CM10 and ADW EX Launcher - App Bar?

Hi for thos of you how use ADW EX Launcher, ADW EX has the extra "App Bar" or whatever its called at the top. On the 7" screen it becomes a nusance because in landscape mode it takes up 10% of the screen.
To get rid of it, the .xml config for ADW EX (adw_ex_settings.xml) should have this:
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
<string name="swipedownActions">0</string>
<string name="homeOrientation">3</string>
<int name="desktopSpeed" value="92" />
<boolean name="uiIconBgs" value="false" />
<boolean name="notif_receiver" value="true" />
<boolean name="drawerSnapScrolling" value="true" />
<string name="drawer_style">1</string>
<int name="desktopRows" value="5" />
<boolean name="folder_draw_contents" value="true" />
<long name="LAST_ERROR" value="1337869436076" />
<boolean name="desktopBlocked" value="true" />
<boolean name="drawerZoom" value="true" />
<boolean name="main_dock_enabled" value="false" />
<boolean name="uiDesktopIndicatorAutohide" value="true" />
<int name="defaultScreen" value="1" />
<string name="folder_style">0</string>
<boolean name="autosizeIcons" value="true" />
<string name="screenCache">2</string>
<boolean name="dock_icon_reflection" value="true" />
<string name="pendingTransition">0</string>
<boolean name="folder_auto_grow" value="true" />
<int name="desktopBounce" value="7" />
<int name="desktopColumns" value="5" />
<boolean name="uiNewIcons" value="false" />
<string name="homeBinding">1</string>
<string name="changelogReadVersion">1.3.3.56</string>
<boolean name="wallpaper_scrolling" value="true" />
<boolean name="actionbar_hidden" value="true" />
<boolean name="desktopZoom" value="true" />
<int name="desktopScreens" value="3" />
<boolean name="uiIconBgsGlossy" value="true" />
<boolean name="uiDesktopIndicator" value="false" />
<string name="menu_order">[2,3,4,5,12,6,11,7,9,10,13]</string>
<string name="menu_hidden">[true,true,true,true,true,true,true,true,true,true,true]</string>
<string name="swipeupActions">0</string>
<boolean name="previewsNew" value="true" />
<boolean name="dock_shrink" value="true" />
<boolean name="drawerSwipe" value="false" />
<boolean name="drawerAnimated" value="true" />
<string name="uiDesktopIndicatorType">1</string>
<boolean name="widgetsOverlap" value="true" />
<boolean name="loop_scrolling" value="false" />
<string name="screen_effect">0</string>
<boolean name="icons_dpi_hack" value="false" />
</map>
Copy or paste the above in your xml config and reboot ADW EX and it will get rid of the "App Bar". From there, you can customize it the way you want without the "App Bar" at the top of your screen.
Attached as a .zip as well. I replaced the file from my TF201 on to the KF and it works perfectly.
Many thanks for this, I have looked everywhere for a fix for this :-o
Sent from my Nexus 7 using xda app-developers app
Can I ask where i can access the menus (which are actually on this bar, to edit screens etc...)
Problem I have is it works great but i am quite new to andriod generally, is there a way to access these menus without the bar? (system shortcut etc..) Or is it a case of re-enabling bar, editing as required and then reverting back?
In hindsight I didn't think i would need access to the menu and have realised I need to remove a screen.
I have had a look at the script and I realise I can edit total number of screens but to actually remove a chosen screen I don't think i can (if that makes sense-have a hubs setup and trying not to mess it up lol )
I am using the paranoid andriod rom
Any help appreciated
Sent from my Nexus 7 using xda app-developers app
I assume you are running JB since your post is from a Nexus 7.
On JB, there's typically 3 vertical dots. With ADW EX, they are vertical. You touch those and you can edit, add, etc screens. The other method is to go back into the settings for ADW and allow the gestures for swipe up and swipe down. Hope this helps.
jotei66 said:
Can I ask where i can access the menus (which are actually on this bar, to edit screens etc...)
Problem I have is it works great but i am quite new to andriod generally, is there a way to access these menus without the bar? (system shortcut etc..) Or is it a case of re-enabling bar, editing as required and then reverting back?
In hindsight I didn't think i would need access to the menu and have realised I need to remove a screen.
I have had a look at the script and I realise I can edit total number of screens but to actually remove a chosen screen I don't think i can (if that makes sense-have a hubs setup and trying not to mess it up lol )
I am using the paranoid andriod rom
Any help appreciated
Sent from my Nexus 7 using xda app-developers app
Click to expand...
Click to collapse
Thanks, yeah I am on JB.. and yes the menu has kinda three vertical dots if I remember.
I tried the swipe up / down options but no option to show this menu unfortunately... thanks anyway though..
One thing to note is after copying over the .xml, you will need to "restore" it from ADW and tell ADW to load the new .xml.
Simply go to ADW Settings>Restore ADW Settings
After that the annoying bar at the top should be gone.

Home Screen App problem

I am in the process of developing an android Home Screen Application, also known as Launcher.
However I ran into a couple of setbacks, setbacks which I will try to describe as best as I can, so hopefully one of you will be able to help me.
My main problem is when I quit my application by setting Android's launcher default as always, I can no longer use my home app, it just doesn't open up again.
This is how my manifest looks like:
<activity
android:name="com.modset.launcher.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-alias
android:name=".MainActivityAlias"
android:targetActivity="com.modset.launcher.MainActivity"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MONKEY"/>
</intent-filter>
</activity-alias>
</activity>
With just this on the manifest whenever I press the HOME button I get the launcher chooser, if I opt for my Launcher everything works just fine, however if I opt for Android's stock launcher I can no longer use my app again.
It either just doesn't open, or if it does I can no longer use it as a Home app again.
I found this extra code which should be able to help me but it doesn't because after using it a message comes up saying "android settings have stopped working".
PackageManager manager = getPackageManager();
ComponentName compName = new ComponentName("com.modset.launcher", "com.modset.launcher.MainActivityAlias");
//ComponentName compName = new ComponentName("<Package Name>", "<Package Name.Alias Name>");
manager.setComponentEnabledSetting(compName,
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
My biggest problem is that just by adding those lines in the manifest, the first code I mentioned, if I add that, after leaving my app by choosing android stock launcher as default, when i get back to my app it opens just fine however I can't use it as a home app again.
So...
I programatically thought of a work around, by using this code:
Intent selector = new Intent(Intent.ACTION_MAIN);
selector.addCategory(Intent.CATEGORY_HOME);
startActivity(selector);
And it is with this code I have the biggest problem, because when I add this in, the app simply doesn't open up again after exiting it and setting android stock launcher as the default home screen.
Please anyone help me solve this issue.
It will look more tidy if you put your code into
Code:
tags. ;)

How to develop an App for Tablets?

Hey XDA-Developers!
I have a big problem with my app, Google Play says that isn't developed for Tablet, I try all, but I don't find the issue. This is my Manifest.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.advanced.rootchecker"
android:versionCode="16"
android:versionName="1.5.4" >
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="18" />
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true"
android:resizeable="true"
android:anyDensity="true" />
<uses-permission android:name="android.permission.INTERNET" android:required="false"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:required="false"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:required="false"/>
<uses-permission android:name="android.permission.ACCESS_COURSE_LOCATION" android:required="false"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" android:required="false"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:required="false"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" android:required="false"/>
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" android:required="false"/>
<application
android:icon="@drawable/ic_launcher"
android:theme="@style/Theme.Sherlock"
android:label="@string/app_name" >
<activity
android:label="@string/appname"
android:name=".MainActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="@string/appname"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:name=".RootCheckerActivity" >
</activity>
<activity
android:label="@string/appname"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:name=".BusyboxCheckerActivity" >
</activity>
<activity
android:label="@string/appname"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:name=".RootDefinitionActivity" >
</activity>
<activity
android:label="@string/acercade"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:name=".AcercaDe" >
</activity>
<activity
android:label="@string/appname"
android:name=".FAQsActivity" >
</activity>
<activity
android:label="@string/appname"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:name=".BusyboxDefinitionActivity" >
</activity>
<activity
android:name="com.adsdk.sdk.banner.InAppWebView"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<activity
android:name="com.adsdk.sdk.video.RichMediaActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:hardwareAccelerated="false" />
<activity
android:name="com.adsdk.sdk.mraid.MraidActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
</manifest>
Exactly, it says that is developed for more or less 3000 phone models. It isn't developed for Tablets but it works in Nexus 7 and Nexus 10.
This is the application:
https://play.google.com/store/apps/details?id=com.advanced.rootchecker&hl=es
I hope that you can help me. THANKS!
Ah, now I got your question.
It doesn't mean that those users can't install it. It just means that it's not optimized for tablets. They will introduce a new tablet-specific section where apps which are optimized for tablets will be shown.
Read this: http://android-developers.blogspot.ca/2013/10/more-visibility-for-tablet-apps-in.html
And this: http://developer.android.com/distribute/googleplay/quality/tablet.html
Here you can find the tablet section: https://play.google.com/store/apps/collection/tablet_featured
In Play developer console, take a look at the optimisation tips tab on the bottom, they are telling you there what you need to do. I think you need to add at least one 10 inch tablet Screenshot but it might be that the Play Team has to review your app...
Thank's!!
Enviado desde mi Galaxy Mini Plus 4G usando Tapatalk 2
Did you ever work it out? My game also says that and from what I can read, I think it may be because my game art is all in a folder called "drawable" as it is the same at all resolutions.
Maybe I just need to add some other drawable-hdpi folders with the game icons in them to resolve it. Not sure but was hoping someone else may know, you may have solved it or that my info may help anyone else as this is what I intend to try next update (hopefully later this week).
Burkey said:
Did you ever work it out? My game also says that and from what I can read, I think it may be because my game art is all in a folder called "drawable" as it is the same at all resolutions.
Maybe I just need to add some other drawable-hdpi folders with the game icons in them to resolve it. Not sure but was hoping someone else may know, you may have solved it or that my info may help anyone else as this is what I intend to try next update (hopefully later this week).
Click to expand...
Click to collapse
Have a look at this link: http://developer.android.com/distribute/googleplay/quality/tablet.html
nikwen said:
Have a look at this link: http://developer.android.com/distribute/googleplay/quality/tablet.html
Click to expand...
Click to collapse
Thanks @nikwen, I have read that but it appears a little ambiguous to me. Basically I would want to keep all my game textures in "drawable" for all resolutions and maybe put icon's for home screens in the various resolution specific folders. The article "appears" to just generalise making me wonder if my textures must be there too.. and therefore replicated. I would imagine not but have not tested it myself.
Just thought I would throw it out if anyone else done it this way and if it got past the "tablet optimisation" tip in the publishers control panel.
Burkey said:
Thanks @nikwen, I have read that but it appears a little ambiguous to me. Basically I would want to keep all my game textures in "drawable" for all resolutions and maybe put icon's for home screens in the various resolution specific folders. The article "appears" to just generalise making me wonder if my textures must be there too.. and therefore replicated. I would imagine not but have not tested it myself.
Just thought I would throw it out if anyone else done it this way and if it got past the "tablet optimisation" tip in the publishers control panel.
Click to expand...
Click to collapse
Maybe contact one at Google for that question?
Burkey said:
Thanks @nikwen, I have read that but it appears a little ambiguous to me. Basically I would want to keep all my game textures in "drawable" for all resolutions and maybe put icon's for home screens in the various resolution specific folders. The article "appears" to just generalise making me wonder if my textures must be there too.. and therefore replicated. I would imagine not but have not tested it myself.
Just thought I would throw it out if anyone else done it this way and if it got past the "tablet optimisation" tip in the publishers control panel.
Click to expand...
Click to collapse
You need to add a 7 inch and 10 inch screenshot to make it available for devices with those screen sizes.

[Q] Where is default app info kept?

When I go to view a video from a webpage or a news app I am always presented with a list of potential players (some of which I don't even have). I check the little box at the bottom of the list that says "always use this" or whatever, and then select RockPlayer. It all works fine but the Nook doesn't seem to remember this choice. It asks each time. Very annoying.
Does anyone know where this default app information is stored? A database file I could look at perhaps? Maybe something is not being set properly. I've made other default selections for other situations and they seem to take. Or maybe it's a RockPlayer issue?
<preferred-activities> inside /data/system/packages.xml
Always in the last place I look
So... this is what is there, but it's repeated over and over (and over--like for every time I've done it):
Code:
<preferred-activities>
<item name="com.redirectin.rockplayer.android.unified/com.redirectin.rockplayer.android.OpenRockPlayerActivity" match="600000" set="5">
<set name="com.estrongs.android.pop/.app.BrowserDownloaderActivity" />
<set name="com.estrongs.android.pop/.app.PopVideoPlayerProxyActivity" />
<set name="com.opera.browser/com.opera.Opera" />
<set name="com.alensw.PicFolder/.StreamingActivity" />
<set name="com.redirectin.rockplayer.android.unified/com.redirectin.rockplayer.android.OpenRockPlayerActivity" />
<filter>
<action name="android.intent.action.VIEW" />
<cat name="android.intent.category.DEFAULT" />
<type name="video/mp4" />
</filter>
</item>
I don't see the BBC News app mentioned in a similar vein, but it behaves in exactly the same way. Nothing in the code above jumps out at me as a novice, but the fact that there are many, many entries in the file all the same does not seem good.
Ideas?
Well, the easiest solution is to just gut the preferred-activities:
Code:
<preferred-activities>
</preferred-activities>
Your Nook may ask you once about a few intents, but that should be it.
It's possible that packages.xml got corrupted.
Also, depending on how a file gets opened there may be different filters for mimetype vs. path filters.
If you are still having problems, narrow it down to exactly how you are trying to open the file.
Use logcat and see what intent generates the picker dialog.

Categories

Resources