As in WhatsApp, if you click on a name to call, down the list you will find the WhatsApp logo in front of the number if you want to txt using WhatsApp.
Can we add the easyPhoneCard in that list, so the user can directly call using that option without clicking on the prompt to call.
You have to add in your manifest some rules.
In that way, Android will be able to list your application as compatible with a specific action (here is call action)
I think it will be something like
<intent-filter>
<action android:name="android.intent.action.CALL" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<data android:scheme="tel" />
</intent-filter>
(add this in your activity node that will handle operations)
Related
I'm trying to code an app to perform some actions with phone numbers when selected, for example, in Chrome.
The fact is that I can't figure out how to configure the filtering so when selecting text, the activity only appears when a phone has been detected (as Phone and SMS app do: https://i.stack.imgur.com/xkgby.png. I want my app to be part of this menu.)
My actual filter is:
<intent-filter>
<action android:name="android.intent.action.PROCESS_TEXT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
But this adds the app to the list no matter what the selected text is (it does not check if it is a phone or not). It should only be allowed if the selected text is a phone number.
Any ideas? Thanks in advance.
Currently I'm trying to create a bunch of simple Android apps to replace the default apps with them.
I already saw in this post how to set the SMS app as default:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android-dir/mms-sms" />
</intent-filter>
But I was wondering how to achieve the same for these apps:
Camera application (To take pictures)
Gallery/Photo application (To select and view images)
Contact application (To view, edit, delete and call contacts)
Telephone application (To call contacts/telephone numbers and receive incoming calls)
Internet browser application (To browse the internet)
Keyboard application (To write text like in the default keyboard)
Launcher application (To display all installed apps on the home screen)
I already noticed that it's nearly impossible to set the app as default app programmatically without the user's interaction. This would be the main goal, but it would be also okay if the user can choose which application they want to use as the default application. But I want to be sure that the apps which I listed above are selectable. So my question is, what mime types do I have to add to the intent filters in the android manifest file?
So my question is, what mime types I have to add to the intent filters in the android manifest file?
mimetype it's just standard of describing content, and it's next processing. This is not something new in Android, you can check more information about Media Types Wiki page. This information about mimetype attribute in the the Android Documentation:
android:mimeType - A MIME media type, such as image/jpeg or audio/mpeg4-generic. The subtype can be the asterisk wildcard to indicate that any subtype matches
However as you can see the vnd prefix on a MIME type is a "vendor prefix", meaning that it is not an official IETF MIME type. So you will need to check this type for each application. Just some examples, what we have below.
Note! In order to set default application, you need to specify android.intent.action first. Because it's main flags between process interaction, so Launcher (for ex.) won't have mimetype, and only intent actions android.intent.action.MAIN, android.intent.action.SET_WALLPAPER.
Camera:
<data android:mimeType="vnd.android.cursor.dir/image" />
<data android:mimeType="vnd.android.cursor.dir/video" />
Image/Video/Audio:
<data android:mimeType="video/*" />
<data android:mimeType="video/mpeg4" />
<data android:mimeType="video/mp4" />
<data android:mimeType="video/3gp" />
......
<data android:mimeType="image/*" />
<data android:mimeType="application/sdp" />
......
<data android:mimeType="audio/x-mpegurl" />
<data android:mimeType="audio/mpegurl" />
<data android:mimeType="application/vnd.apple.mpegurl" />
<data android:mimeType="application/x-mpegurl" />
....
Contacts:
<data android:mimeType="vnd.android.cursor.item/phone" />
<data android:mimeType="vnd.android.cursor.item/person" />
<data android:mimeType="vnd.android.cursor.dir/calls" />
Browser:
<data android:mimeType="application/xhtml+xml"/>
<data android:mimeType="application/vnd.wap.xhtml+xml"/>
<data android:mimeType="vnd.android.cursor.item/postal-address" />
<data android:mimeType="vnd.android.cursor.dir/bookmark"/>
<data android:mimeType="vnd.android.cursor.item/download"/>
You need to register an Intent Filter for the file types, actions, or categories for which you want your app to be the default app. The user will then be able to choose your app as the default app if they want to.
Look here for more information on Intents and Intent Filters.
Forcing your app as the default app for something is only possible with root access.
I am not sure but using Intent.createChooser() you will get the solution
click here
I am developing an application for searching for places. In the application there is a button where user can share a specific place with other user. I was thinking about sharing a link that when other user, "the invited one", clicks on it, my application opens on the shared place page. Just like Clash Royale game, if you know it. The idea is that. How can I do so? Does anyone have idea how to implement this?
Thanks in advance.
To achieve this you need to Create Deep Links to App Content
Code would be something like this:
1) Add intent filter in your activity
<activity android:name="...">
<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:host="example.com"
android:scheme="schemeName" />
</intent-filter>
</activity>
2) Get data in you activity
Intent intent = getIntent();
String action = intent.getAction();
Uri data = intent.getData();
3) Create sharable URL
eg - http://example.com?data=<your data to share>
4) Now you need to write some script for your page (http://example.com)
that will receive your header data and redirect to open app.
for this get some idea from here
* This is not a complete code but hope will help you.
In my app manifest i wrote this code to open some links with my app adding the intent-filter:
<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="https" android:host="example.com" />
</intent-filter>
I tried to send via email to myself a link; for example: http://www.example.com/1234. click over the link i open the app.. That's great. Now, is it possible take the 1234 part of the link and put it into a textview? Something like:
mTextView.setText(textFromLink);
thanks
Did you already get access to the URL inside your app? If not, you can get it e.g. in your onCreate method with
Uri link = getIntent().getData();
which returns a Uri object:
http://developer.android.com/reference/android/net/Uri.html
This object has several methods to get the specific parts of the URL. In your case it will probably be
String content = link.getLastPathSegment():
http://developer.android.com/reference/android/net/Uri.html#getLastPathSegment()
This returns a string that you can set in your TextView:
mTextView.setText(content);
I am new in android development, I want to build a music player but the problem in front of me is how do i make my app open from gallery.
For example,
if we want to open any music file then we select it, the the android mobile ask which player do we want to use.
so how can I add my app in that option.
please help.
If you want your app to be in the list for opening an audio file, you need to tell the system your app can open those files. You can do that by adding something like the following to your activity tag in your AndroidManifest.xml:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="content"/>
<data android:scheme="file"/>
<data android:mimeType="audio/*"/>
<data android:mimeType="application/ogg"/>
<data android:mimeType="application/x-ogg"/>
<data android:mimeType="application/itunes"/>
</intent-filter>
Intent filters are part of the core principles in Android development. You should try to get some knowledge on these basic topics before getting started.
It helps you
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
File file = new File(YOUR_SONG_URI);
intent.setDataAndType(Uri.fromFile(file), "audio/*");
startActivity(intent);
Actually you can open activity not app at self just simply add action intent filter in mainfest like this
<activity class=".foo" android:label="#string/title_notes_list">
<intent-filter>
<action android:name="com.me.love" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
other app code :
Intent intent = new Intent("com.me.love");
startActivity(intent);
however if you want to tell android system that your activity can handle some actions like share or send data you just have to add "send" action to your activity in mainfest like so :
<activity class=".boo" android:label="#string/title_notes_list">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
so now when ever user click share button android system will check all activitys that have action string "android.intent.action.SEND" then give the user list of activitys that have send action and if you did added same action as boo activity dose to your activity then it will be one of chooses in the list.