0

I have written the following code in java file in eclipse to make launch of snapchat application on my android device through my application. But when i am running it in my android device it shows "no apps can perform this action".

if(view.getId()==R.id.LaunchSnapchat){
    intent= new Intent(android.content.Intent.ACTION_VIEW); 
    intent.setData(Uri.parse("snapchat://details?id=com.snapchat.android&hl=en&rdid=com.snapchat.android"));
    chooser=Intent.createChooser(intent,"Launch Snapchat");
    startActivity(chooser);
}

what is the solution??

dev
  • 55
  • 7

2 Answers2

0

Try this

Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("*/*");
    intent.setPackage("com.snapchat.android");
    startActivity(Intent.createChooser(intent, "Open Snapchat"));

Also work this it is because mabe you did not have snapchat installed (emulator)

if(view.getId()==R.id.LaunchSnapchat){
    intent= new Intent(android.content.Intent.ACTION_VIEW); 
    intent.setData(Uri.parse("snapchat://details?id=com.snapchat.android&hl=en&rdid=com.snapchat.android"));
    chooser=Intent.createChooser(intent,"Launch Snapchat");
    startActivity(chooser);
}
Kiran Benny Joseph
  • 6,271
  • 3
  • 34
  • 55
0

Simple answer, as taken from here

If you don't know the main activity, then the package name can be used to launch the application.

Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.snapchat.android");
if (launchIntent != null) { 
    startActivity(launchIntent);//null pointer check in case package name was not found
}
Community
  • 1
  • 1
RobCo
  • 4,924
  • 2
  • 15
  • 25