Hi Mr. Anderson,

Thanks for your reply,

I think the package name (com.android.phone) is same on all devices as I
checked or debug but the dialer package names are different. As I got this
package name have one OutgoingCallBroadcast class which broadcast the
Intent.ACTION_CALL and android system find the dialers which implement this
Intent as per my Knowledge, *If I am saying anything wrong please correct
me.*

 And I hardcoded the package name because I did not get any option to do
this task so I used this way. Actually call from the native dialer is a
product requirement. So I have to implement. If you have any sample code
related to this, please share with me

Thanks


On 2 December 2013 22:57, Justin Anderson <magouyaw...@gmail.com> wrote:

> Perhaps you should rethink forcing the user to use the native dialer...
> especially where you are hard-coding the package name. Not only is that
> just plain bad practice and really annoying for your end user, but the
> native dialer may not have the same package name on all devices...
>
> Here is a real-world example: I used to use Google Voice as my default
> option for making phone calls.  I explicitly set it up that way.  If I ever
> came across an app that didn't respect the way I wanted to use my phone it
> was immediately uninstalled and I gave the app an automatic 1 star rating.
>
>
> Thanks,
> Justin Anderson
> MagouyaWare Developer
> http://sites.google.com/site/magouyaware
>
>
> On Wed, Nov 27, 2013 at 10:34 PM, Johnny <ask2iq...@gmail.com> wrote:
>
>>
>>
>> *Target: Call from native dialer only , bypass all dialers.*
>>
>> This is my method to call from Native Dialer , this method bypass the
>> chooser dialog as I experienced.
>>
>> Intent i = CallUtils.callfromDefaultDialer(ctxt,dat[1]);
>> ctxt.startActivity(i);
>>
>>
>> public static Intent callfromDefaultDialer(Context ctxt, String no) {
>>
>>         Intent i = new Intent();
>>         i.setAction(Intent.ACTION_CALL);
>>         i.setData(Uri.parse("tel:" + no));
>>         PackageManager pm = ctxt.getPackageManager();
>>         List<ResolveInfo> list = pm.queryIntentActivities(i, 0);
>>         for (ResolveInfo info : list) {
>>             String pkgnam = info.activityInfo.packageName;
>>             if (pkgnam.toLowerCase().equals("com.android.phone")) {
>>                 i.setClassName(pkgnam, info.activityInfo.name);
>>                 return i;
>>             }
>>         }
>>
>>        return i;
>>     }
>>
>>
>> But some time it gives me option to choose . It gives me two dialog two
>> choose, you can see the images in attachment.But second dialog
>> (chooser_win.png) I bypass using above code. but when when i get the first
>> dialog(call_win.png) then the second dialog(chooser_win.png) auto come
>> up(you can say its root of chooser dialog).
>>
>>
>> But using below code I bypass the first dialog (call_win.png). But not
>> second dialog(chooser_win.png)
>>
>> public static Intent callfromDefaultDialer(Context ctxt, String no) {
>>
>>         List<Intent> targetedShareIntents = new ArrayList<Intent>();
>>
>>         Intent i = new Intent();
>>         i.setAction(Intent.ACTION_CALL);
>>         //i.addCategory(Intent.ACTION_DEFAULT);
>>         i.setData(Uri.parse("tel:" + no));
>>         PackageManager pm = ctxt.getPackageManager();
>>         List<ResolveInfo> list = pm.queryIntentActivities(i, 0);
>>         for (ResolveInfo info : list) {
>>             String pkgnam = info.activityInfo.packageName;
>>             Intent targetedShareIntent = new Intent(Intent.ACTION_CALL);
>>             if (pkgnam.toLowerCase().equals("com.android.phone")) {
>>                 targetedShareIntent.setData(Uri.parse("tel:" + no));
>>                 targetedShareIntent.setClassName(pkgnam,
>> info.activityInfo.name);
>>                 targetedShareIntents.add(targetedShareIntent);
>>                 //return targetedShareIntent;
>>                 //i.setClassName(pkgnam, info.activityInfo.name);
>>                 //return i;
>>             }
>>         }
>>
>>         Intent chooserIntent =
>> Intent.createChooser(targetedShareIntents.remove(0), "Select app to Call");
>>         chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS,
>> targetedShareIntents.toArray(new Parcelable[targetedShareIntents.size()]));
>>
>>         return chooserIntent;
>>     }
>>
>> I tried this code to get Intent.EXTRA_INITIAL_INTENTS . but not got
>> success. its giving always blank parcelable list.
>>
>> Intent intent = CallUtils.callfromDefaultDialer(ctxt,dat[1]);
>> Parcelable<http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.4_r1/android/os/Parcelable.java#Parcelable%5B%5D>
>> [] pa = 
>> intent.getParcelableArrayExtra<http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.4_r1/android/content/Intent.java#Intent.getParcelableArrayExtra%28java.lang.String%29>
>> (Intent<http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.4_r1/android/content/Intent.java#Intent.0EXTRA_INITIAL_INTENTS>
>> .EXTRA_INITIAL_INTENTS<http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.4_r1/android/content/Intent.java#Intent.0EXTRA_INITIAL_INTENTS>
>> );
>>
>>         Intent 
>> <http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.4_r1/android/content/Intent.java#Intent%5B%5D>[]
>>  initialIntents = null;
>>
>>         if (pa != null) {
>>
>>             initialIntents = new Intent 
>> <http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.4_r1/android/content/Intent.java#Intent>[pa.length];
>>
>>             for (int i=0; i<pa.length; i++) {
>>
>>                 if (!(pa[i] instanceof Intent 
>> <http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.4_r1/android/content/Intent.java#Intent>))
>>  {
>>
>>                     Log.w 
>> <http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.4_r1/android/util/Log.java#Log.w%28java.lang.String%2Cjava.lang.String%29>("ChooseActivity",
>>  "Initial intent #" + i
>>
>>                             + " not an Intent: " + pa[i]);
>>
>>                 }
>>
>>                 initialIntents[i] = (Intent 
>> <http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.4_r1/android/content/Intent.java#Intent>)pa[i];
>>
>>             }
>>
>>         }
>>
>>
>> Reference of this Link:
>> http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.4_r1/com/android/internal/app/ChooserActivity.java
>>
>>
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Android Developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to android-developers+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Android Developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/android-developers/_oxhs-_fUjQ/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> android-developers+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Thanks & Regards
Iqbal Ahmed
(+919711667728)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to