What is "DesktopIcon"? I don't understand what you are describing.
On Tue, Jul 17, 2012 at 2:46 PM, HV <harishv.athr...@gmail.com> wrote: > Ok, I got this working. A simple JAVA app (say JNIDemo) that calls a > native method (in say NativeLib.so), which in turn calls back a JNIDemo > method. All of this is working seamlessly. Now, the next problem I have is > context related. I have a desktop icon which is supposed to launch an > Android app (such as DragonHunter) and that is failing: > > 1. JNIDemo -> NativeLib -> JNIDemo (works fine) > 2. DesktopIcon -> NativeLib -> JNIDemo (fails to launch an app such as > DragonHunter) > > Now, since 1 & 2 are running in separate processes, the JNI variables are > no longer valid in #2. Any ideas? > > On Saturday, July 7, 2012 11:40:05 PM UTC-7, HV wrote: >> >> 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+unsubscribe@**googlegroups.com<android-porting%2bunsubscr...@googlegroups.com> >>>> website: >>>> http://groups.google.com/**group/android-porting<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 > -- 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