24

このコードは、ネイティブの Android システムを備えたプレーンな Google デバイスで動作します。しかし、htc センス デバイスのリストには MMS アプリがなく、Motorola Blur などについてはわかりません。

    final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.setType("image/png");
    emailIntent.putExtra(Intent.EXTRA_STREAM, uri);
    context.startActivity(Intent.createChooser(emailIntent, context.getString(R.string.send_intent_name)));

このコードは htc の意味で機能しますが、セレクターからではなく、私が本当に必要としているものです:

    Intent sendIntent = new Intent("android.intent.action.SEND_MSG");
    sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
    sendIntent.setType("image/png");
    context.startActivity(sendIntent);

しかし、このコード サンプルを組み合わせる方法がわかりません。また、Htc Sense ui をプログラムで決定する方法もわかりません。さまざまなタイプのデバイスをサポートするのは正しい方法ですか?

回答ありがとうございます。

4

3 に答える 3

1

次のように使用できます。

Intent i = new Intent(Intent.ACTION_SEND);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.putExtra(Intent.EXTRA_EMAIL, new String[]{""});
i.setType("video/3gp");
i.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + attachmentFilePath));
startActivity(i);
于 2011-11-16T13:43:45.740 に答える
1

HTCインテントのレスポンダーがあるかどうかを検出して、次のように分岐できます。

intent = new Intent("android.intent.action.SEND_MSG");
intent.putExtra(Intent.EXTRA_STREAM, uri);
intent.setType("image/png");

resolves = getActivity().getPackageManager().queryIntentActivities(intent,
        PackageManager.MATCH_DEFAULT_ONLY);

if (resolves.size() > 0) {
    // This branch is followed only for HTC 
    context.startActivity(intent);
} else {
    // Else launch the non-HTC sense Intent
    intent = new Intent(android.content.Intent.ACTION_SEND);
    intent.setType("image/png");
    intent.putExtra(Intent.EXTRA_STREAM, uri);
    context.startActivity(Intent.createChooser(intent,
            context.getString(R.string.send_intent_name)));    
}
于 2011-11-07T02:45:00.533 に答える
1

センス、特に古いバージョンは苦痛です。Webview コントロールにも多くの問題があります。メッセージの量によっては、Amazon の単純な通知サービスのような Web サービスを使用して SMS メッセージを送信してみてください: http://aws.typepad.com/aws/2011/11/amazon-simple-notification-service-now-supports-sms .html Android ソリューションではありませんが、機能する可能性があります。

于 2011-11-04T12:22:58.607 に答える