Thanks Dianne, that's what I thought, hence this question. Glad to know 
that using 'am' is not the way to go. Could you please provide a link to 
the SDK where it talks about this? If there is an example, that'll be 
awesome

Thanks again
HV

On Saturday, July 7, 2012 5:13:07 PM UTC-7, Dianne Hackborn wrote:
>
> No don't do that, the am command is not part of the SDK, and doing it this 
> way is horrible inefficient (you need to spin up and initialize a fresh 
> Dalvik vm for the am command, which takes a second or more), and usually 
> totally broken because you are not launching the activity from your own 
> context for the system to correctly associate the call with you.
>
> And on top of that, your example here uses an explicit component name of 
> the browser activity, which is *completely* an implementation detail: it is 
> likely to be different across different devices, it is *definitely* 
> different on devices that ship with Chrome as the default browser, etc.
>
> This is totally wrong.
>
> The right thing to do is follow the SDK and do it the right way, the way 
> it is documented.  If you need to write a little bit of JNI code (and it 
> *is* a little bit, just a method call into your own Java method that uses 
> the SDK), then that is what you do.
>
> On Fri, Jul 6, 2012 at 11:58 PM, Sandeep Kumar <sandeepkumar....@gmail.com
> > wrote:
>
>> try below:-
>>
>> ret = execl("/system/bin/sh", "sh", "-c", "am start -a 
>> android.intent.action.MAIN -n   com.android.browser/.BrowserActivity", (char 
>> *)NULL);
>>
>>
>>
>> On Saturday, July 7, 2012 3:51:58 AM UTC+9, HV wrote:
>>>
>>>  Wanted to know what is the best practice to launch apps from native 
>>> code? Is using 'am' forbidden? It has to be via the system call though, 
>>> like system("am start ..."); Will 'am' support be discontinued going 
>>> forward?
>>>
>>>  Is there any alternative method?
>>>
>>> Thanks much
>>> HV
>>>
>>  -- 
>> unsubscribe: android-porting+unsubscr...@googlegroups.com
>> website: http://groups.google.com/group/android-porting
>>
>
>
>
> -- 
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to 
> provide private support, and so won't reply to such e-mails.  All such 
> questions should be posted on public forums, where I and others can see and 
> answer them.
>
>  

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting

Reply via email to