Android에서 애플리케이션 “링크”공유 앱을 다른

내 애플리케이션 사용자가 내 앱을 다른 사용자와 공유 / 추천 할 수 있기를 원합니다. ACTION_SEND 인 텐트를 사용합니다. 다음 줄을 따라 일반 텍스트를 추가합니다.이 멋진 응용 프로그램을 설치합니다. 하지만 예를 들어 사용자가 마켓 플레이스의 설치 화면으로 직접 이동할 수있는 방법을 찾을 수 없습니다. 내가 제공 할 수있는 것은 웹 링크 나 텍스트뿐입니다. 즉, Android 사용자가 내 앱을 설치하는 매우 직접적인 방법을 찾고 있습니다.

도움 / 포인터 감사합니다.

도마



답변

이렇게하면 이메일, whatsapp 등에서 선택할 수 있습니다.

try { 
    Intent shareIntent = new Intent(Intent.ACTION_SEND);  
    shareIntent.setType("text/plain");
    shareIntent.putExtra(Intent.EXTRA_SUBJECT, "My application name");
    String shareMessage= "\nLet me recommend you this application\n\n";
    shareMessage = shareMessage + "https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID +"\n\n";
    shareIntent.putExtra(Intent.EXTRA_TEXT, shareMessage);  
    startActivity(Intent.createChooser(shareIntent, "choose one"));
} catch(Exception e) { 
    //e.toString();
}   

답변

지원 라이브러리의 ShareCompat 클래스 도 사용할 수 있습니다 .

ShareCompat.IntentBuilder.from(activity)
    .setType("text/plain")
    .setChooserTitle("Chooser title")
    .setText("http://play.google.com/store/apps/details?id=" + activity.getPackageName())
    .startChooser();

https://developer.android.com/reference/android/support/v4/app/ShareCompat.html


답변

도마,

사용자에게 market://앱의 세부 정보 페이지로 직접 연결되는 링크 를 제공 할 수 있습니다. 다음은 developer.android.com에서 가져온 것입니다.

응용 프로그램의 세부 정보 페이지로드

Android 마켓에서 모든 애플리케이션에는 사용자에게 애플리케이션의 개요를 제공하는 세부 정보 페이지가 있습니다. 예를 들어 페이지에는 개발자가 제공 한 경우 앱에 대한 간단한 설명과 사용중인 앱의 스크린 샷, 사용자의 피드백 및 개발자에 대한 정보가 포함됩니다. 세부 정보 페이지에는 사용자가 애플리케이션의 다운로드 / 구매를 트리거 할 수있는 “설치”버튼도 포함되어 있습니다.

사용자에게 특정 애플리케이션을 추천하려는 경우 애플리케이션은 사용자를 애플리케이션의 세부 정보 페이지로 직접 안내 할 수 있습니다. 이를 위해 애플리케이션은 다음 형식의 URI 및 쿼리 매개 변수를 포함하는 ACTION_VIEW 인 텐트를 전송합니다.

market : // details? id =

이 경우 packagename 매개 변수는 애플리케이션의 manifest 파일에있는 manifest 요소의 package 속성에 선언 된대로 대상 애플리케이션의 정규화 된 패키지 이름입니다. 예를 들면 :

market : // details? id = com.example.android.jetboy

출처 : http://developer.android.com/guide/publishing/publishing.html


답변

이 메서드를 호출하십시오.

public static void shareApp(Context context)
{
    final String appPackageName = context.getPackageName();
    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, "Check out the App at: https://play.google.com/store/apps/details?id=" + appPackageName);
    sendIntent.setType("text/plain");
    context.startActivity(sendIntent);
}

답변

더 정확하게

   Intent intent = new Intent(Intent.ACTION_VIEW);
   intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.android.example"));
   startActivity(intent);

또는 개발자의 다른 앱을 공유하려는 경우. 계정 당신은 이와 같은 것을 할 수 있습니다

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://play.google.com/store/apps/developer?id=Your_Publisher_Name"));
startActivity(intent);

답변

애플리케이션 이름과 애플리케이션 ID를 자동으로 채우려면 다음을 사용할 수 있습니다.

int applicationNameId = context.getApplicationInfo().labelRes;
final String appPackageName = context.getPackageName();
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_SUBJECT, activity.getString(applicationNameId));
String text = "Install this cool application: ";
String link = "https://play.google.com/store/apps/details?id=" + appPackageName;
i.putExtra(Intent.EXTRA_TEXT, text + " " + link);
startActivity(Intent.createChooser(i, "Share link:"));

답변

제목이 app_name 인 애플리케이션 공유, 콘텐츠는 애플리케이션 링크

private static void shareApp(Context context) {
    final String appPackageName = BuildConfig.APPLICATION_ID;
    final String appName = context.getString(R.string.app_name);
    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.setType("text/plain");
    String shareBodyText = "https://play.google.com/store/apps/details?id=" +
            appPackageName;
    shareIntent.putExtra(Intent.EXTRA_SUBJECT, appName);
    shareIntent.putExtra(Intent.EXTRA_TEXT, shareBodyText);
    context.startActivity(Intent.createChooser(shareIntent, context.getString(R.string
            .share_with)));
}