My app is designed to work with various Amazon links but for some reason it has started to always open links instead of the Android system asking every time.
If I click a link on the Amazon website in Chrome my app opens. If I click an Amazon link in an email my app opens.
In my settings I have Android set to Ask every time for Amazon (see screenshot) but it's acting as though it is set as the default.
What's odd is that my app didn't used to do this, and it sometimes doesn't do it now (though only very occasionally) and instead asks as you would expect. But 95% of the time my app launches automatically.
Now I'm getting reports from users of the same thing.
Is it possible for something in the manifest to cause this (I wouldn't have thought so as that could effectively allow app hijacking) or are my OS settings (and those of the users reporting the problem) messed up?
Manifest.xml below:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.nooriginalthought.amalfi">
<uses-permission android:name="android.permission.INTERNET"/>
<application android:allowBackup="true" android:icon="#mipmap/ic_launcher" android:label="AmALfi" android:largeHeap="true" android:resizeableActivity="true" android:supportsPictureInPicture="true" android:theme="#style/AppTheme">
<activity android:name="com.nooriginalthought.amalfi.MainActivity" android:configChanges="orientation|screenSize" android:screenOrientation="portrait" android:launchMode="singleTop" android:theme="#style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter android:label="#string/generate_affiliate_link_with_amalfi">
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"/>
</intent-filter>
<intent-filter android:label="#string/generate_affiliate_link_with_amalfi">
<action android:name="android.intent.action.SENDTO"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:host="*.amazon.ae" android:scheme="http"/>
<data android:host="*.amazon.ae" android:scheme="https"/>
<data android:host="*.amazon.ca" android:scheme="http"/>
<data android:host="*.amazon.ca" android:scheme="https"/>
<data android:host="*.amazon.co.uk" android:scheme="http"/>
<data android:host="*.amazon.co.uk" android:scheme="https"/>
<data android:host="*.amazon.com" android:scheme="http"/>
<data android:host="*.amazon.com" android:scheme="https"/>
<data android:host="*.amazon.com.au" android:scheme="http"/>
<data android:host="*.amazon.com.au" android:scheme="https"/>
<data android:host="*.amazon.com.br" android:scheme="http"/>
<data android:host="*.amazon.com.br" android:scheme="https"/>
<data android:host="*.amazon.com.mx" android:scheme="http"/>
<data android:host="*.amazon.com.mx" android:scheme="https"/>
<data android:host="*.amazon.de" android:scheme="http"/>
<data android:host="*.amazon.de" android:scheme="https"/>
<data android:host="*.amazon.es" android:scheme="http"/>
<data android:host="*.amazon.es" android:scheme="https"/>
<data android:host="*.amazon.fr" android:scheme="http"/>
<data android:host="*.amazon.fr" android:scheme="https"/>
<data android:host="*.amazon.in" android:scheme="http"/>
<data android:host="*.amazon.in" android:scheme="https"/>
<data android:host="*.amazon.it" android:scheme="http"/>
<data android:host="*.amazon.it" android:scheme="https"/>
<data android:host="*.amazon.jp" android:scheme="http"/>
<data android:host="*.amazon.jp" android:scheme="https"/>
</intent-filter>
<intent-filter android:label="#string/generate_affiliate_link_with_amalfi">
<action android:name="android.intent.action.VIEW"/>
<data android:host="*.amazon.ae" android:scheme="http"/>
<data android:host="*.amazon.ae" android:scheme="https"/>
<data android:host="*.amazon.ca" android:scheme="http"/>
<data android:host="*.amazon.ca" android:scheme="https"/>
<data android:host="*.amazon.co.uk" android:scheme="http"/>
<data android:host="*.amazon.co.uk" android:scheme="https"/>
<data android:host="*.amazon.com" android:scheme="http"/>
<data android:host="*.amazon.com" android:scheme="https"/>
<data android:host="*.amazon.com.au" android:scheme="http"/>
<data android:host="*.amazon.com.au" android:scheme="https"/>
<data android:host="*.amazon.com.br" android:scheme="http"/>
<data android:host="*.amazon.com.br" android:scheme="https"/>
<data android:host="*.amazon.com.mx" android:scheme="http"/>
<data android:host="*.amazon.com.mx" android:scheme="https"/>
<data android:host="*.amazon.de" android:scheme="http"/>
<data android:host="*.amazon.de" android:scheme="https"/>
<data android:host="*.amazon.es" android:scheme="http"/>
<data android:host="*.amazon.es" android:scheme="https"/>
<data android:host="*.amazon.fr" android:scheme="http"/>
<data android:host="*.amazon.fr" android:scheme="https"/>
<data android:host="*.amazon.in" android:scheme="http"/>
<data android:host="*.amazon.in" android:scheme="https"/>
<data android:host="*.amazon.it" android:scheme="http"/>
<data android:host="*.amazon.it" android:scheme="https"/>
<data android:host="*.amazon.jp" android:scheme="http"/>
<data android:host="*.amazon.jp" android:scheme="https"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
<activity android:name="com.nooriginalthought.amalfi.ManageAffIdsActivity" android:configChanges="orientation|screenSize" android:screenOrientation="portrait" android:theme="#style/AppTheme"/>
<activity android:name="com.nooriginalthought.amalfi.PreviewLinkActivity" android:configChanges="orientation|screenSize" android:screenOrientation="portrait"/>
</application>
</manifest>
You have set one activity for android:mimeType="text/plain" and as Browser.
Split both in owns Activities
You have probably set that your app is standard for text/plain and so it will be always opening as browser
Related
We are doing an app for a client an he needs some similar functionality to this (see picture attached) offered by the iTranslate App on iOS.
With this functionality, when you are in any other App (for instance reading anything on the Medium App) and you select a word, a menu appears and you can select to open this word with the app of my client. But instead of opening the whole App and closing the one were are using, a kind of pop up appears:
I have a few questions about this:
- Does this have a name?
- Can something like this be done with Ionic or you need to code the app in Native?
- Is this possible only on iOS or also in Android?
I am really lost about this issue and would appreciate some guidance.
Thanks
The example in the first picture would be called a "Floating Context Menu," according to the Android Developers website. The example in the second picture would be called a "Popup Menu."
Hope this helps! Good Luck!
You can use a text selection toolbar https://material.io/design/platform-guidance/android-text-selection-toolbar.html# for this, which was added in Android 6.0. Note that you can only use this on Android 6.0 and later.
There is a nice article here, which provides some examples on how to create this:
https://medium.com/androiddevelopers/custom-text-selection-actions-with-action-process-text-191f792d2999
From the article, the basic implementation is the following:
AndroidManifest.xml
<activity
android:name=".ProcessTextActivity"
android:label="#string/process_text_action_name">
<intent-filter>
<action android:name="android.intent.action.PROCESS_TEXT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
ProcessTextActivity.java
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.process_text_main);
CharSequence text = getIntent()
.getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT);
// process the text
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_PROCESS_TEXT, result);
setResult(RESULT_OK, intent);
}
So, I am pretty sure you can implement this in ionic. I never wrote anything in ionic, but you may be able to call something like this Java code from it.
This is a customized PopupWindow(Android Documentation) which should not be a major issue to cook up with something like PopoverController (Iconic Documentation).
the real problem you will face is the text selection. you can look into this stackoverflow link for pointers.
Solutions like these may work in one or the other platform you have to muck the code unless there is and api for text selection in iconic.
if iconic does not give you the API you will have to roll up your sleeves. At this point you are on a slippery slope looking over the webview(s).
Update:
All the above juggling is needed to implement this within your app. Android and iOS will not allow you to add items to system context menu as you see in an PC based(Windows/MacOS/...) OS(s).
If you check Google Translator app in Android. it listens clipboard copy event and pops up a transient icon over other apps. in iOS drawing over other app is not possible.
So if you want your feature to show up in Medium App then they have to add the UI and they have to call your 'API'.
In a business context (not commercial app), I need to avoid middle button click behaviour, that is to say displaying Home Screen
I spent hours browsing Stackoverflow pages, and the conclusion is often :
it's not possible, regarding obvious security considerations
My need is a bit different :
I use a connected mouse, I don't want to override device hardware button.
my app will only be use in a business context, not publicly.
Details :
my device is a Samsung Galaxy 3 (Model Number GT-P5210, Android version 4.2.2)
the mouse is a classical 3-buttons mouse (left-click, mouse wheel, right-click)
I can accept :
to override OnPause, OnUserLeaveEvents (https://stackoverflow.com/a/32938986/2773267 doesn't work in my case)
to modify my manifest
to use a service (watchdog-like), that prevent Home display
to root the device (last-chance solution):
modify /system/usr/keylayout (part of https://stackoverflow.com/a/29311126/2773267 answer)
all others solution, excepted those I can't accept :)
I can't accept :
using service (as in http://www.piwai.info/chatheads-basics/)
--
Thanks, Jerome.
Excuse my awful english, I'm french !
Putting this 3 lines to the manifest solved the problem.
Firstly it didn't work because I made a mistake on activity name
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Thanks !
--
Jerome
You can build your app as a HOME-screen replacement. In this case, your app IS the HOME-screen, so pressing HOME does nothing.
I am using the Cast Companion Library and it is mostly working fine, I get the mini player, and also the lock screen controls and the activity for playing content, but I can never get the notification screen to show. I am doing the following when initializing:
mCastMgr.enableFeatures(VideoCastManager.FEATURE_NOTIFICATION |
VideoCastManager.FEATURE_LOCKSCREEN |
VideoCastManager.FEATURE_DEBUGGING);
and I am doing the incrementUiCounter() on resume and decrementUiCounter() on pause.
I don't see any errors, I just don't see what I am doing wrong. The only thing I am missing is that I am not passing URLs for images when telling media to play because my URLs are local assets to my app and I'm just not sure how to pass those.
Are you using that with your own app or with CastVideos-android? If your own app, first I suggest you try the CastVideos-android app to make sure that works for you.
I suggest you print out the value of mVisibilityCounter in BaseCastManager.incrementUiCounter() and decrementUiCounter() to see if as you move in and out of different activities, it reflects the correct counter. When that counter reaches zero, then notification should show up. If the counter is reaching zero and the notification doesn't show up, I suggest you check your manifest file and see if you have the following in your Manifest:
<service
android:name="com.google.sample.castcompanionlibrary.notification.VideoCastNotificationService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.sample.castcompanionlibrary.action.toggleplayback" />
<action android:name="com.google.sample.castcompanionlibrary.action.stop" />
<action android:name="com.google.sample.castcompanionlibrary.action.notificationvisibility" />
</intent-filter>
</service>
(you can copy-and-paste from the CastVideos-android manifest file). You may have grabbed what it is from the documentation; there is an error there (I am planning to update a bunch of things tonight or tomorrow and the documentation will be updated as well); basically when the counter reaches zero, it calls into the notification service (see the onUiVisibilityChanged() in VideoCastManager) and if that action in manifest is not correctly set, the notification never gets our memo! Let me know if that is not the issue.
I had the same trouble. Just an FYI to those looking at this in 2016. The manifest entry is now different. I suggest to grab whatever is in the manifest of the CastVideos-android project.
<receiver android:name="com.google.android.libraries.cast.companionlibrary.remotecontrol.VideoIntentReceiver" />
<service
android:name="com.google.android.libraries.cast.companionlibrary.notification.VideoCastNotificationService" />
<service android:name="com.google.android.libraries.cast.companionlibrary.cast.reconnection.ReconnectionService"/>
Hello my question is a bit difficult let me explain and try to understood
I have a custom Home who is set as default when user press home. Know i need a way to ask wich home use when i press on a setting key, or a way to launch Setting activity for delete home default action.
In fact i wan't a way to go back to home app installed by google instead of mine just in case.
I need this because my custom home is still in dev and don't have all feature yet.
I need to keep my home as a default action when user press home buton but i need to add a home selector in special case.
I have try to use finish() when i need to go back to old home but mine as default is automaticly relaunch because he is the default one.
Any idea?
EDIT
I try to reformul a bit.
I'm making a home apps. I set it as default on my tablet. My home apps don't have all feature yet. And when i will launch something or go to setting i need to relaunch default home app.
So i need a way inside my app to reset default home action or launch a home apps, or ask user to choice wich app he will use has home apps.
Hope this is clear for all.
Probably you should use this one to implement your idea. keep the below lines in your manifest file.
<activity android:name="Home"
android:theme="#style/Theme"
android:launchMode="singleInstance"
android:stateNotNeeded="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
For more info about the sample project. just go the below path in your Android SDK
\android-sdk\samples\android-8\Home
EDIT :
Hi Please check this to pro grammatically unset the default application.
How do I use PackageManager.addPreferredActivity()?
for more info go through this also to clear the clearPackagePreferredActivities
http://developer.android.com/reference/android/content/pm/PackageManager.html#clearPackagePreferredActivities%28java.lang.String%29
hope this helps you.
i have an application which associates pdf files in my Manifest(via intent-filters), so when someone click on pdf link in the default browser i can execute that action with my app and download it with a progressbar. my question is, is it a way that i can associate other files but not "hard coded" in my manifest, but to let the user choose(or write) that file extention in preferences for example and i can add it dynamically from code. i know that probably this can be done with broadcast receiver but cant find any examples or simple code for that matter. ive seen preference menu like that in bsplayer settings .. but cant post image cuz dont have enough reputation.
I will try to explain more detailed my problem, because i think that there was some misunderstanding with the answer below.
i have an application which have the fallowing code in my manifest.
<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:host="*" />
<data android:pathPattern=".*\\.pdf" />
</intent-filter>
2.i launch my app which registers .pdf files with it. so next time i click on pdf link in my browser, a window pops up, making me choose with what application should i complete that action. if i choose my application, my main activity is launched, in which i use getIntent() and my app downloads the file using progressbar.
3.the problem is that i want to download and other files like that ie. jpg, png .. etc, but giving the user a choice which ones, or even making him write the extentions for the files he wants to download using my application if clicks on link somewhere that leads to that kind of files.
4.to make this thing happen, file extensions should be added dynamically in code somewow and not in manifest. i was looking some examples for broadcast receiver, since that class can use IntentFilter class, but cant really understand what i should be doing with it.
5.My main goal: starting my app, there is layout with some spinner or edit box. the user choose/writes some extension (.dwf). that extension is now registered with my app. if the next time the user browsing internet clicks on link which leads to .dwf file he could choose to continue the action with my app. and the file should be downloaded just like the .pdf
6.sry for my bad english and some help will be appreciated. also code ;)
boolean enabled=prefs.getBoolean(key, false);
int flag=(enabled ?
PackageManager.COMPONENT_ENABLED_STATE_ENABLED :
PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
ComponentName component=new ComponentName(MyActivity.this, TargetActivity.class);
getPackageManager()
.setComponentEnabledSetting(component, flag,
PackageManager.DONT_KILL_APP);
Depending upon your preference you can Disable the activity that handles the File type in your BOOT_COMPLETED Reciever. I Believe you will have to have different activities to handle different file types and then disable selectively