Intent to open a chat with a specific user on snapchat app
Asked Answered
D

1

11

I'm trying to find if there is any app schema,

to open the Snapchat app (via Intent) with a specific userID that I want to chat with?

BTW, to find the userID:

enter image description here

Drain answered 15/7, 2015 at 16:31 Comment(1)
i am also looking for same thing but did n't get any help , please anyone guide us?Whirlybird
T
14

This the only thing that works for me. Unfortunately, it adds the extra step of making the user choose the browser or Snapchat app.

Intent nativeAppIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://snapchat.com/add/" + snapchatId));
startActivity(nativeAppIntent);

Oddly enough, the URL scheme snapchat://add/" + snapchatId works on iOS but not on Android (it opens the Android app, but does not pop up the user).

EDIT: Add intent.setPackage("com.snapchat.android"); and it will open the app without the chooser. But adding this means you will need to surround everything with a try/catch to prevent a crash.

try {
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://snapchat.com/add/" + snapchatId));
    intent.setPackage("com.snapchat.android");
    startActivity(intent);
} catch (Exception e) {
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://snapchat.com/add/" + snapchatId)));
}
Tripartition answered 27/5, 2016 at 19:9 Comment(1)
On Android we can open with "snapchat://app/add", but it can't open profileAlmandine

© 2022 - 2024 — McMap. All rights reserved.