ここの例を見て、答えを再現しようとしました。でも、
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に制限があることがわかりましたが、本当に使いたいです。制限を解除する方法について誰かが私を助けることができますか?