My Question is how can I add my application to the android default Dialer selection, to be more specific without using the android.intent.action.CALL_PRIVILEGED?
Now I am using this code below, this works fine:
<intent-filter>
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
</intent-filter>
HOWEVER Google recently posted: http://productforums.google.com/forum/#!topic/mobile/wXqnbynsL8Y
And mailed this to the programmes who does use the intent android.intent.action.CALL_PRIVILEGED:
Issue:
Users of your application may not be able to make emergency
phone calls through the system phone dialer if they've elected to have
your application route calls. As noted in the documentation,
applications that listen for the CALL_PRIVILEGED Intent action will
intercept emergency service calls from the system, but may not be able
to route them properly. Please note that CALL_PRIVILEGED is a
restricted API, not intended for use within third party applications
that cannot route emergency calls properly.
Solution:
• Remove CALL_PRIVILEGED from Intent filters in Java code and AndroidManifest.xml.
• Update your Google Play listing
description to include a statement that using your app as a default
dialer may interfere with dialing 911 emergency services.
The easiest solution my be deleting but then the application would use functionality. But is there another way to add the application to the default Dialer selection? but then without the CALL_PRIVILEGED intent?
Thanks in advance
Just an example of the default Dialer selection
Edit:
My other intents that I use:
<intent-filter>
<action android:name="android.intent.action.CALL_BUTTON" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
</intent-filter>
More important is that privileged call action is needed in intent filter with data as "tel" for uri.
Also below permission tag is need to allow phone call.
Missing in your code in category Launcher.
<uses-permission android:name="android.permission.CALL_PHONE" />
You don't need to intercept CALL_PRIVILEGED to make a dialer. There are 3 intents of interest:
ACTION_DIAL: invokes the dialer. You should intercept this.
CALL: places a call. I suppose you need to intercept this if you are routing the call via VoIP, else just pass it on to the system.
CALL_PRIVILEGED: places an Emergency call (911 in US etc). You don't need to intercept this, since these calls are routed specially, even without a SIM card, and without charging the user.
For what it's worth, I got the same email from Google. My app doesn't even use CALL or CALL_PRIVILEGED intents. There was however, a check in the code that the passed intent was not this action (just for the sake of completeness). So, I think they just scan the data section of the apk to see if this string is used anywhere.
Edit try this, it works for my app:
<activity android:name=".ActivityName"
android:label="#string/activity_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.DIAL" />
<action android:name="android.intent.action.CALL_BUTTON" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity-alias android:targetActivity="fully.qualified.ActivityName"
android:name="fully.qualified.ActivityName_HTC_hack"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.DIAL" />
<data android:scheme="tel" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity-alias>
Try "android.intent.action.DIAL". The user has to start the call manually, but i think it's the best solution.
Input: If nothing, an empty dialer is started; else getData() is URI of a phone number to be dialed or a tel: URI of an explicit phone number.
ref: developer page
Related
i need to launch my app when click on link that is received by sms or email.I mean, the person who receives the SMS simply taps on the link provided, and that launches the application.
Which ever Activity you want to open, when Link is clicked
Need to be use IntentFilter in Menifest like this
<activity
android:name=".interacting.InteractWithApps"
android:parentActivityName=".index.IndexActivity">
<intent-filter>
<data
android:host="www.domain.com"
android:scheme="http" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
You also need to define link schema and host
You should follow as per this link
When a user performs a phone call via the dialer or the contacts, I'd like to be listed as one of the apps which can manage it, like it happens for Skype or Viber or other phone apps.
I've tried without success many different solutions, like to add the following intent-filter in a receiver in the manifest file:
<intent-filter>
<action android:name="android.intent.action.CALL_BUTTON" />
<action android:name="android.intent.action.CALL" />
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
<data android:scheme="dial" />
</intent-filter>
All the questions about it here on stackoverflow are not helping me; they are vague and they don't work.
EDIT:
tried to put the intent-filter also in the activity manifest tag. Same result. I've also tried with the CALL_PRIVILEGED action, even if it should not be used by 3rd party apps:
<intent-filter>
<action android:name="android.intent.action.CALL_PRIVILEGED"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
</intent-filter>
I have an app that scans NFC tags, collects the data from the tag and sends that data to the server. The data on the tag is in the following format:
1,3,30012,somebodys name
These tags are placed in client's houses for carers to scan. Each scan logs them into a call.
This has been working fine so far. The problem i have now is that the carers must use another app alongside our app which scans a different NFC tag, with different data on it and sends it to a different server. This app is installed on the same carer's phone.
This other app will scan NFC tags that might have data on it in the following format:
abc|123??
The question is how can i ensure that when the carer scans our tag, ONLY our app is launched?
Is there a way in the manifest of specifying this in the intent-filters for my app?
This is what i have in the manifest for my Activity. I understand that if an Intent is launched and there are 2 apps that could process an NFC tag then a list is presented to the user. The Android docs discourage against this.
Thanks in advance.
[Edit]
One thing i have noticed, if the phone is on the home screen and i scan a tag, then my app is launched. This is fine if the carer scans the correct tag.
<activity android:name=".NfcscannerActivity"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="com.carefreegroup.rr3.QRCODE_ACTION" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="#xml/nfc_tech_filter" />
</activity>
You could create a custom mimeType in your NDEF message and then create an intent-filter which matches it exactly. This would mean your app would be launched as it is the most specific filter.
Example:
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/vnd.com.my.app.package.customString" />
</intent-filter>
Edit:
Alternatively if you cannot create a custom mimeType then perhaps your utility will create a custom URL? Then you can create a filter for the custom url instead:
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:scheme="http"
android:host="www.mywebsite.net"
android:path="/customPathForAction" />
</intent-filter>
What happens when we click the default message app in android.I mean does it broadcast an intent? Actually I am trying to make an app that will ask for a password in an new activity when user clicks on message icon and is redirected to list of messages only if password is correct.But my activity is not shown.Here is how I am trying to do it.Added a receiver in manifest.
<receiver android:name="Receiver">
<intent-filter android:priority="100">
<action android:name="android.intent.action.GET_CONTENT">
</action>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType = "vnd.android-dir/mms-sms" />
</intent-filter>
</receiver>
You are asking about "launching" an activity. Typically that is done with an intent created as such:
Intent launch = new Intent(Intent.ACTION_MAIN);
launch.setPackage("com.your.package.name");
startActivity(launch);
Because the package name is set, you cannot intercept this intent. It is not broadcast to any receiver.
If you write a launcher app, you could intercept such a launch request and launch a different app in front of it. But it would not really be possible to prevent users from side-stepping this by returning to the default Android launcher.
However, there are several other means of "launching" the "default" SMS app. For example, an app that requests an SMS be sent through the default SMS app will create an intent like this:
Intent launch = new Intent("android.intent.action.SENDTO");
There are several others as well. And your app can register an activity for these intent in the manifest like this:
<activity
android:name="com.your.package.name.MyMessageActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android-dir/mms-sms" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
<data android:scheme="mms" />
<data android:scheme="mmsto" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
In Android KitKat a user must actually set your app as the "Default SMS App" in order for it to be able to write to the SMS provider/database and also to receive the "SMS_DELIVER" intent. In all versions of Android, any app can register for the "SMS_RECEIVED" intent but in KitKat+ it cannot be aborted, like in earlier versions.
You may notice that one filter specified above is similar to yours - using mimeType "vnd.android-dir/mms-sms" as a "DEFAULT" action. This places your app as one option for the user to "Complete Action Using" when, for example, they select a contact they want to message.
If you do all of this, then your activity can require a password in order to "view" messages. However, you should be aware that unless you are using a separate data store for the messages, all SMS can be read through the MMS-SMS provider (assuming the app has requested permission to do so).
What you are trying to achieve is not possible, please see this:
https://stackoverflow.com/a/21469133/2452039
You cannot prevent native applications from opening with an outside app. The only thing you could do would be to intercept incoming messages, preventing them from reaching the SMS app inbox, and store them in your application, and there you could prevent them from opening. I must warn you that since API level 19 that is no longer possible...
I have an Android application that can make calls via internet or " VoIP ".
So, I need the telephony API to put my application as a suggestion when a user dials-up a number !
any suggestions on how to do that ?!
You need to register an intent filter in the manifest for your dialer activity:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>