I am trying to send open fb-messenger in a specific chat with a user from within my app. I have the user's app_scope_id, relevant for my app. However, from what I could figure out so far, I need the global facebook id in order for the messenger to launch in a conversation with that person. Is there any way to achieve that with the app_scope_id?
Code:
Uri uri = Uri.parse("fb-messenger://user/");
uri = ContentUris.withAppendedId(uri,[APP SCOPE ID]);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
Related
I am trying to sharing my data on Instagram but when I am shared my content on Instagram. I haven't gotten any success callback or when not shared then also not get failure callback. I am unable to found SDK for Instagram sharing as well as any API. Below I have mentioned my code by which I tried to sharing content on Instagram.
// Create the new Intent using the 'Send' action.
Intent share = new Intent(Intent.ACTION_SEND);
// Limit this call to instagram
share.setPackage("com.instagram.android");
// Set the MIME type
share.setType(type);
// Create the URI from the media
File media = new File(mediaPath);
Uri uri = Uri.fromFile(media);
// Add the URI to the Intent.
share.putExtra(Intent.EXTRA_STREAM, uri);
try {
// Fire the Intent.
startActivityForResult(share, REQUEST_CODE);
} catch(ActivityNotFoundException e) {
// instagram not installed
}
As mentioned in Instagram docs. They didn't provide any callback to such sharing.
If your application creates photos or videos and you would like your users to share them using Instagram, you can use Android Intents to open your media in Instagram's sharing flow.
I'm getting Cursor with RAW_CONTACTS for person in my app.
How can i use this data to start an Intent to communicate with this person via one of selected raw-contacts?
For example, one contacts has several raw-contacts: phone, whatsapp, viber etc. When i click whatsapp raw_contact, app should start WhatsApp to communicate with selected person.
So simple...
Uri uri = Uri.parse("content://com.android.contacts/data/" + rawContactId);
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(uri, rawContactMimetype);
My question is simple, i want to make an intent to instagram app from my app, but i want to show the timeline (just like we are open the instagram app manually), how can i do this?
This method is working to show an user profile, but i want to show the timeline.
private void createInstagramIntent() {
//Creamos intent de instagram y lanzamos la activity
Uri uri = Uri.parse("http://instagram.com/_u/javierjsanchezg");
Intent share = new Intent(Intent.ACTION_VIEW, uri);
share.setPackage("com.instagram.android");
startActivity(share);
}
Instagram is mainly a Photo Sharing App and you need to specify the content type. Check the code below. It will open the Instagram App Home Screen of the App is installed in the device and says no app can perform this action if not installed.
Intent is just a way to connect with other apps and it has minimized
control over the other App.
Uri uri = Uri.parse("http://www.google.com");
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("*/*");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Hi Android Share intent");
sharingIntent.putExtra(Intent.EXTRA_STREAM, uri);
sharingIntent.setPackage("com.instagram.android");
startActivity(Intent.createChooser(sharingIntent, "Choose"));
Happy Coding..!!
You can simplify your code to :
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")));
Now as per the user's timeline it depends if it is private or public in order to view it. Hope it helps.
I have to share an image from my application to instagram. I have gone through Instagram developer documentation and there they mentioning only about sharing via Intent method, but what I need is I have to get a callback after posting successfully.
private void createInstagramIntent(String type, String mediaPath){
// Create the new Intent using the 'Send' action.
Intent share = new Intent(Intent.ACTION_SEND);
// Set the MIME type
share.setType(type);
// Create the URI from the media
File media = new File(mediaPath);
Uri uri = Uri.fromFile(media);
// Add the URI to the Intent.
share.putExtra(Intent.EXTRA_STREAM, uri);
// Broadcast the Intent.
startActivity(Intent.createChooser(share, "Share to"));
}
is there any way to do this ?
There are several options depending on their API. At first referring their Android Intents, that is a bad example IMHO, this is more or less the default way in Android how to share data. What you want is something more like to open just their app. For such cases is there the setPackage() option:
// Create the new Intent using the 'Send' action.
Intent share = new Intent(Intent.ACTION_SEND);
// Limit this call to instagram
share.setPackage("com.instagram.android");
// Set the MIME type
share.setType(type);
// Create the URI from the media
File media = new File(mediaPath);
Uri uri = Uri.fromFile(media);
// Add the URI to the Intent.
share.putExtra(Intent.EXTRA_STREAM, uri);
try {
// Fire the Intent.
startActivityForResult(share, REQUEST_CODE);
} catch(ActivityNotFoundException e) {
// instagram not installed
}
Now for the case that instagram is not installed you are almost lost. If there is no other SDK there is nothing you can do.
A very complex workaround might be to upload the file to your own backend. Then open the browser to gain access to an oauth token to upload the image via your backend. However this is a quiet expensive solution which I would avoid.
I'm an trying to get the image to attach to mms after you pick my app form the attachment picklist. The image code is fine.
What I want to happen
1.You are in a text message, you click the attach button
2.you select images, it pulls up the chooser of apps
3.select my application, has gridview of images
4.(The Issue) - you select the photo you want from my app and it sends it back into the mms you where in
I'm not sure how to respond though to the ACTION_GET_CONTENT from the sms/mms app so that my app sends the image back to it.
Uri uri = Uri.fromFile(file);
Intent localIntent = new Intent(android.content.Intent.ACTION_SEND);
localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
localIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
//localIntent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
localIntent.putExtra("android.intent.extra.STREAM", uri);
localIntent.setType("image/jpeg");
startActivity(localIntent);
After literally a week of looking around I found it.
Intent localIntent = new Intent(); localIntent.setData(imageURI(position));
setResult(Activity.RESULT_OK, localIntent);
dialog.dismiss();
finish();
I needed to use setResult