1

ここの例を見て、答えを再現しようとしました。でも、

Intent callIntent = new Intent(Intent.ACTION_CALL);その間何もしない

Intent callIntent = new Intent(Intent.ACTION_DIAL);プリセット番号のテンキーに移動します。

テンキーに移動せずに番号に電話をかけたい。どうすれば機能しますか?

onUpdate():

public void onUpdate(Context context, AppWidgetManager appWidgetManager,
        int[] appWidgetIds) {
    // TODO Auto-generated method stub
    super.onUpdate(context, appWidgetManager, appWidgetIds);
       Log.d("HomeWidget", "onUpdate(): ");
        for (int appWidgetId : appWidgetIds) {

            Intent callIntent = new Intent(Intent.ACTION_CALL);
            callIntent.setData(Uri.parse("tel:"+12345678));
            PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, callIntent, 0);

            // Get the layout for the App Widget and attach an on-click listener to the button
            RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
            views.setOnClickPendingIntent(R.id.call, pendingIntent);

            // Tell the AppWidgetManager to perform an update on the current App Widget
            appWidgetManager.updateAppWidget(appWidgetId, views);
        }
}

編集

以下の回答から、Intent.CALLに制限があることがわかりましたが、本当に使いたいです。制限を解除する方法について誰かが私を助けることができますか?

4

2 に答える 2

0

ACTION_CALL;を使用して通話を開始できるアプリケーションには制限があります。ほとんどのアプリケーションはを使用する必要がありますACTION_DIAL

http://developer.android.com/reference/android/content/Intent.html#ACTION_CALLを参照してください

于 2012-07-25T04:14:36.933 に答える
0

私が必要なのはただ

<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>

于 2012-07-25T09:00:03.140 に答える