Android Hello World app crashes: IllegalArgumentException from Surface.lockCanvasNative - android

I am trying to run the simplest Hello World example app and looks like I can crash it even all it does is showing a TextView.
Steps to reproduce: Launch it in the emulator (1.5). Open the app - it shows the text view, then lock the phone by pressing "end call" button. Unlock by pressing "menu", then press "back". App crashes with "The process android.process.acore has stopped unexpectedly..." and Force Close button. It does not happen all the time, but I am able to reproduce it every time after wiping the user data at least.
I wonder if default Hello World is missing a detail which was considered too advanced for a hello world... Such problems with a basic example does not look very encouraging =)
Any idea what detail is missing and how to avoid this crash?
Stack (I've truncated timestamps):
37.478: DEBUG/KeyguardViewMediator(576): wakeWhenReadyLocked(82)
37.481: DEBUG/KeyguardViewMediator(576): handleWakeWhenReady(82)
37.481: DEBUG/KeyguardViewMediator(576): pokeWakelock(5000)
39.110: DEBUG/KeyguardViewMediator(576): pokeWakelock(5000)
39.140: WARN/InputManagerService(576): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#436e3fc0
40.990: ERROR/IMemory(679): binder=0x238aa8 transaction failed fd=-2147483647, size=0, err=-2147483646 (Unknown error: 2147483646)
40.990: ERROR/IMemory(679): cannot dup fd=-2147483647, size=0, err=-2147483646 (Bad file number)
40.990: ERROR/IMemory(679): cannot map BpMemoryHeap (binder=0x238aa8), size=0, fd=-1 (Bad file number)
40.990: ERROR/Surface(679): Couldn't map Surface's heap (binder=0x238aa8, heap=0x238b00)
40.990: DEBUG/AndroidRuntime(679): Shutting down VM
40.990: WARN/dalvikvm(679): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
40.990: ERROR/AndroidRuntime(679): Uncaught handler: thread main exiting due to uncaught exception
40.990: ERROR/AndroidRuntime(679): java.lang.IllegalArgumentException
40.990: ERROR/AndroidRuntime(679): at android.view.Surface.lockCanvasNative(Native Method)
40.990: ERROR/AndroidRuntime(679): at android.view.Surface.lockCanvas(Surface.java:196)
40.990: ERROR/AndroidRuntime(679): at android.view.ViewRoot.draw(ViewRoot.java:1175)
40.990: ERROR/AndroidRuntime(679): at android.view.ViewRoot.performTraversals(ViewRoot.java:1030)
40.990: ERROR/AndroidRuntime(679): at android.view.ViewRoot.handleMessage(ViewRoot.java:1482)
40.990: ERROR/AndroidRuntime(679): at android.os.Handler.dispatchMessage(Handler.java:99)
40.990: ERROR/AndroidRuntime(679): at android.os.Looper.loop(Looper.java:123)
40.990: ERROR/AndroidRuntime(679): at android.app.ActivityThread.main(ActivityThread.java:3948)
40.990: ERROR/AndroidRuntime(679): at java.lang.reflect.Method.invokeNative(Native Method)
40.990: ERROR/AndroidRuntime(679): at java.lang.reflect.Method.invoke(Method.java:521)
40.990: ERROR/AndroidRuntime(679): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
40.990: ERROR/AndroidRuntime(679): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
40.990: ERROR/AndroidRuntime(679): at dalvik.system.NativeStart.main(Native Method)
41.000: INFO/Process(576): Sending signal. PID: 679 SIG: 3
41.000: INFO/dalvikvm(679): threadid=7: reacting to signal 3
41.030: ERROR/ActivityThread(576): Failed to find provider info for android.server.checkin
41.030: ERROR/Checkin(576): Error reporting crash: java.lang.IllegalArgumentException: Unknown URL content://android.server.checkin/crashes
41.070: INFO/dalvikvm(679): Wrote stack trace to '/data/anr/traces.txt'
50.940: WARN/ActivityManager(576): Launch timeout has expired, giving up wake lock!
50.980: WARN/ActivityManager(576): Activity idle timeout for HistoryRecord{4366ac40 {com.android.launcher/com.android.launcher.Launcher}}

sounds to me more like something wrong with your emulator. Why dont you delete your emulator and create a new one and try again with a fresh project.
Hope that will help you. BTW why are you using emulator on 1.5?? Start to build applications for min 2.1.
Good luck.

Related

Current AndroidStudio sample fails on phone due to runtime native library link error. Why?

Its on an HTC Aria, running 2.2 (API 8)
https://en.wikipedia.org/wiki/HTC_Aria
The aria is an armv6 device that supports opengles 2
If you open up the latest Android Studio (im working on windows 7), then import the HelloGL2 sample, then simply try to run it on the above device, it will fail as soon as it tries to make a call into the native library.
Here is the log:
01-06 11:14:08.467 12771-12813/com.android.gl2jni D/dalvikvm: Trying to load lib /data/data/com.android.gl2jni/lib/libgl2jni.so 0x44c165d0
01-06 11:14:08.467 12771-12813/com.android.gl2jni I/dalvikvm: Unable to dlopen(/data/data/com.android.gl2jni/lib/libgl2jni.so): Cannot load library: link_image[1995]: failed to link libgl2jni.so
01-06 11:14:08.477 12771-12813/com.android.gl2jni W/dalvikvm: Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lcom/android/gl2jni/GL2JNILib;.<clinit>
01-06 11:14:08.497 12771-12813/com.android.gl2jni W/dalvikvm: threadid=8: thread exiting with uncaught exception (group=0x40028a00)
01-06 11:14:08.517 95-121/? I/ActivityManager: Displayed activity com.android.gl2jni/.GL2JNIActivity: 9823 ms (total 2027818 ms)
01-06 11:14:08.567 12771-12813/com.android.gl2jni E/AndroidRuntime: FATAL EXCEPTION: GLThread 9
java.lang.ExceptionInInitializerError
at com.android.gl2jni.GL2JNIView$Renderer.onSurfaceChanged(GL2JNIView.java:332)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1327)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
Caused by: java.lang.UnsatisfiedLinkError: Library gl2jni not found
at java.lang.Runtime.loadLibrary(Runtime.java:461)
at java.lang.System.loadLibrary(System.java:557)
at com.android.gl2jni.GL2JNILib.<clinit>(GL2JNILib.java:24)
at com.android.gl2jni.GL2JNIView$Renderer.onSurfaceChanged(GL2JNIView.java:332) 
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1327) 
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118) 
01-06 11:14:08.607 95-164/? W/ActivityManager: Force finishing activity com.android.gl2jni/.GL2JNIActivity
This sample works on the 3 other devices i've tried (Galaxy s5, Galaxy J1, Nexus s)
The line: 'Unable to dlopen(/data/data/com.android.gl2jni/lib/libgl2jni.so): Cannot load library: link_image[1995]: failed to link libgl2jni.so' is probably key. I tried loading the library explicitly using system.loadlibrary, but the same problem happens on that call.
I think it might be something to do with the processor being armv6?
The sample is configured to do 'armeabi' though.

RuntimeException using Camera.open()

This is likely an advanced question since I have a a fair bit of experience with developing camera apps for Android and have the basics right. On some phones, when calling
Camera.open(0);
I get a RuntimeException. My camera app works on most phones (1000+ device types of Android) but fails on a few (about 50+ device types). It also appears to be inconsistent across devices meaning the app will always work or fail on the same model of the device. E.g. the app works on some Galaxy S2's but fails on other S2's.
I have couple of logcats:
On Android 4.0.4
05-26 12:22:26.150 I/CameraService( 85): Opening camera 0<br/>
05-26 12:22:26.150 I/NvOmxCamera( 85): HAL_camera_device_open: open camera 0<br/>
05-26 12:22:26.150 D/NvOmxCamera( 85): HAL_openCameraHardware() use_camera_1st_source=1<br/>
05-26 12:22:26.150 E/NvOmxCamera( 85): Invalid camera ID 0, hardware does not support simultaneous CSI camera use<br/>
05-26 12:22:26.150 E/CameraService( 85): Could not open camera 0: -38<br/>
05-26 12:22:26.150 I/CameraService( 85): Destroying camera 0<br/>
05-26 12:22:26.160 D/AndroidRuntime(25895): Shutting down VM<br/>
05-26 12:22:26.160 W/dalvikvm(25895): threadid=1: thread exiting with uncaught exception (group=0x40a5a1f8)<br/>
05-26 12:22:26.180 E/Crittercism(25895): java.lang.RuntimeException: Fail to connect to camera service<br/>
05-26 12:22:26.180 E/Crittercism(25895): at android.hardware.Camera.native_setup(Native Method)<br/>
05-26 12:22:26.180 E/Crittercism(25895): at android.hardware.Camera.<init>(Camera.java:304)<br/>
05-26 12:22:26.180 E/Crittercism(25895): at android.hardware.Camera.open(Camera.java:264)<br/>
On Android 2.3.6
05-26 11:27:16.984 W/CameraSwitch( 7088): open main camera<br/>
05-26 11:27:16.984 W/CameraSwitch( 7088): no file - can't switch camera<br/>
05-26 11:27:16.994 D/CameraService( 66): CameraService::connect E (pid 7088, client 0xad08)<br/>
05-26 11:27:16.994 D/CameraService( 66): CameraService::connect X (pid 7088, new client 0xad08) rejected. (old pid 7173, old client 0x3ca30)<br/>
05-26 11:27:16.994 D/CameraService( 66): The old client is dead!<br/>
05-26 11:27:16.994 D/AndroidRuntime( 7088): Shutting down VM<br/>
05-26 11:27:16.994 W/dalvikvm( 7088): threadid=1: thread exiting with uncaught exception (group=0x400259f8)<br/>
05-26 11:27:17.094 D/dalvikvm( 7088): GC_FOR_MALLOC freed 15803 objects / 957392 bytes in 93ms<br/>
05-26 11:27:17.114 E/Crittercism( 7088): java.lang.RuntimeException: Fail to connect to camera service<br/>
05-26 11:27:17.114 E/Crittercism( 7088): at android.hardware.Camera.native_setup(Native Method)<br/>
05-26 11:27:17.114 E/Crittercism( 7088): at android.hardware.Camera.<init>(Camera.java:118)<br/>
05-26 11:27:17.114 E/Crittercism( 7088): at android.hardware.Camera.open(Camera.java:91)
<br/>
I have tried a lot of things but I just cannot figure out what the problem is. This line of code is one of the first lines to execute (Camera.open()) so it is unlikely the error is in my code. Any insight as to why this line fails on some cameras will be very helpful.
If it is relevant, I am opening the camera from a service. I can post any information that is needed to diagnose this problem. Thanks.
do you include camera permissions and features in your app?
if yes, maybe the camera is in use in another app.
from android developers:
"Throws RuntimeException if opening the camera fails (for example, if the camera is in use by another process or device policy manager has disabled the camera)."

Memory error in Android after capturing images

In my Android application I'm trying to capture three images and upload this three images. I'm capturing two images one by one no problem but when I capture third images the application crashes with error:
09-26 16:17:31.398: ERROR/AndroidRuntime(24115): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
09-26 16:17:31.398: ERROR/AndroidRuntime(24115): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
09-26 16:17:31.398: ERROR/AndroidRuntime(24115): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:459)
09-26 16:17:31.398: ERROR/AndroidRuntime(24115): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:271)
09-26 16:17:31.398: ERROR/AndroidRuntime(24115): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:296)
How can I solve the error like this?

libs suddenly won't load in dynamic linker (NDK)

I've been developing an NDK app for quite some time and it's been working well. However, today the app randomly decided to not start anymore, after I compiled it after making some nominal change. It's caused by a cryptic problem with loading the app's main library. Here's some log output:
08-11 18:38:11.220 D/dalvikvm( 1237): Added shared lib /mnt/asec/com.audia.rta-1/lib/libqtandroid.so 0x40513bd8
08-11 18:38:11.220 D/dalvikvm( 1237): No JNI_OnLoad found in /mnt/asec/com.audia.rta-1/lib/libqtandroid.so 0x40513bd8, skipping init
08-11 18:38:11.220 D/dalvikvm( 1237): Trying to load lib /mnt/asec/com.audia.rta-1/lib/librta.so 0x40513bd8
08-11 18:38:11.260 D/AndroidRuntime( 1237): Shutting down VM
08-11 18:38:11.260 W/dalvikvm( 1237): threadid=1: thread exiting with uncaught exception (group=0x40015560)
08-11 18:38:11.260 E/AndroidRuntime( 1237): FATAL EXCEPTION: main
08-11 18:38:11.260 E/AndroidRuntime( 1237): java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1311]: 67 cannot locate '_ZNSaIcEC1Ev'...
08-11 18:38:11.260 E/AndroidRuntime( 1237):
08-11 18:38:11.260 E/AndroidRuntime( 1237): at java.lang.Runtime.loadLibrary(Runtime.java:434)
08-11 18:38:11.260 E/AndroidRuntime( 1237): at java.lang.System.loadLibrary(System.java:554)
08-11 18:38:11.260 E/AndroidRuntime( 1237): at com.audia.rta.RTA.onCreate(RTA.java:139)
According to some Google results, _ZNSaIcEC1Ev is part of libstdc++. I've checked, and it gets linked in the build process, and g++ is being used for linking.
Oddly enough, reverting to an older apk of the app fixes the problem, but compiling an old revision and installing that doesn't fix the problem. Everything in my build system is checked into version control, and I've done several clean builds. All my builds were working today and then they just stopped working. I didn't upgrade or install anything; it happened while I was in the middle of testing new code. What happened?
Update: Building from a freshly checked out copy doesn't fix the problem.
Update 2: Is there any way I can track down the link to that symbol, maybe with objdump? Maybe this could provide some clues.
I ended up compiling everything with a fresh NDK install, and it worked. It's as if the old one was corrupted somehow, though I have no idea how.
It was also an upgrade from r5b to r6, so maybe it's related to the NDK version.

Launch market place with id of an application that doesn't exist in the android market place

I am creating an application that checks the installation of a package and then launches the market-place with its id.
When I try to launch market place with id of an application say com.mybrowser.android by throwing an intent android.intent.action.VIEW with url: market://details?id=com.mybrowser.android, the market place application does launches but crashes after launch.
Note: the application com.mybrowser.android doesn't exists in the market-place.
MyApplication is my application.
$ adb logcat
I/ActivityManager( 1030): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=myapp.testapp/.MyApplication }
I/ActivityManager( 1030): Start proc myapp.testapp for activity myapp.testapp/.MyApplication: pid=3858 uid=10047 gids={1015, 3003}
I/MyApplication( 3858): [ Activity CREATED ]
I/MyApplication( 3858): [ Activity STARTED ]
I/MyApplication( 3858): onResume
D/dalvikvm( 1109): GC freed 6571 objects / 423480 bytes in 73ms
I/MyApplication( 3858): Pressed OK button
I/MyApplication( 3858): Broadcasting Intent: android.intent.action.VIEW, data: market://details?id=com.mybrowser.android
I/ActivityManager( 1030): Starting activity: Intent { act=android.intent.action.VIEW dat=market://details?id=com.mybrowser.android flg=0x10000000 cmp=com.android.ven
ding/.AssetInfoActivity }
I/MyApplication( 3858): onPause
I/ActivityManager( 1030): Start proc com.android.vending for activity com.android.vending/.AssetInfoActivity: pid=3865 uid=10023 gids={3003}
I/ActivityThread( 3865): Publishing provider com.android.vending.SuggestionsProvider: com.android.vending.SuggestionsProvider
D/dalvikvm( 1030): GREF has increased to 701
I/vending ( 3865): com.android.vending.api.RadioHttpClient$1.handleMessage(): Handle DATA_STATE_CHANGED event: NetworkInfo: type: WIFI[], state: CONNECTED/CO
NNECTED, reason: (unspecified), extra: (none), roaming: false, failover: false, isAvailable: true
I/ActivityManager( 1030): Displayed activity com.android.vending/.AssetInfoActivity: 609 ms (total 7678 ms)
D/dalvikvm( 1030): GC freed 10458 objects / 676440 bytes in 128ms
I/MyApplication( 3858): [ Activity STOPPED ]
D/dalvikvm( 3865): GC freed 3538 objects / 254008 bytes in 84ms
W/dalvikvm( 3865): threadid=19: thread exiting with uncaught exception (group=0x4001b180)
E/AndroidRuntime( 3865): Uncaught handler: thread AsyncTask #1 exiting due to uncaught exception
E/AndroidRuntime( 3865): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime( 3865): at android.os.AsyncTask$3.done(AsyncTask.java:200)
E/AndroidRuntime( 3865): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
E/AndroidRuntime( 3865): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
E/AndroidRuntime( 3865): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
E/AndroidRuntime( 3865): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
E/AndroidRuntime( 3865): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
E/AndroidRuntime( 3865): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
E/AndroidRuntime( 3865): at java.lang.Thread.run(Thread.java:1096)
E/AndroidRuntime( 3865): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 3865): at com.android.vending.AssetItemAdapter$ReloadLocalAssetInformationTask.doInBackground(AssetItemAdapter.java:845)
E/AndroidRuntime( 3865): at com.android.vending.AssetItemAdapter$ReloadLocalAssetInformationTask.doInBackground(AssetItemAdapter.java:831)
E/AndroidRuntime( 3865): at android.os.AsyncTask$2.call(AsyncTask.java:185)
E/AndroidRuntime( 3865): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
E/AndroidRuntime( 3865): ... 4 more
I/Process ( 1030): Sending signal. PID: 3865 SIG: 3
I/dalvikvm( 3865): threadid=7: reacting to signal 3
I/dalvikvm( 3865): Wrote stack trace to '/data/anr/traces.txt'
I/DumpStateReceiver( 1030): Added state dump to 1 crashes
D/AndroidRuntime( 3865): Shutting down VM
W/dalvikvm( 3865): threadid=3: thread exiting with uncaught exception (group=0x4001b180)
E/AndroidRuntime( 3865): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 3865): java.lang.NullPointerException
E/AndroidRuntime( 3865): at com.android.vending.controller.AssetInfoActivityController.getIdDeferToLocal(AssetInfoActivityController.java:637)
E/AndroidRuntime( 3865): at com.android.vending.AssetInfoActivity.displayAssetInfo(AssetInfoActivity.java:556)
E/AndroidRuntime( 3865): at com.android.vending.AssetInfoActivity.access$800(AssetInfoActivity.java:74)
E/AndroidRuntime( 3865): at com.android.vending.AssetInfoActivity$LoadAssetInfoAction$1.run(AssetInfoActivity.java:917)
E/AndroidRuntime( 3865): at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 3865): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 3865): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 3865): at android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime( 3865): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3865): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 3865): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 3865): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime( 3865): at dalvik.system.NativeStart.main(Native Method)
I/Process ( 1030): Sending signal. PID: 3865 SIG: 3
W/ActivityManager( 1030): Process com.android.vending has crashed too many times: killing!
D/ActivityManager( 1030): Force finishing activity com.android.vending/.AssetInfoActivity
I/dalvikvm( 3865): threadid=7: reacting to signal 3
D/ActivityManager( 1030): Force removing process ProcessRecord{44e48548 3865:com.android.vending/10023} (com.android.vending/10023)
However, when I try to launch the market place for a package that exists in the market place say com.opera.mini.android, everything works. Log for this case:
D/dalvikvm( 966): GC freed 2781 objects / 195056 bytes in 99ms
I/MyApplication( 1165): Pressed OK button
I/MyApplication( 1165): Broadcasting Intent: android.intent.action.VIEW, data: market://details?id=com.opera.mini.android
I/ActivityManager( 78): Starting activity: Intent { act=android.intent.action.VIEW dat=market://details?id=com.opera.mini.android flg=0x10000000 cmp=com.android.vending/.AssetInfoActivity }
I/AndroidRuntime( 1165): AndroidRuntime onExit calling exit(0)
I/WindowManager( 78): WIN DEATH: Window{44c72308 myapp.testapp/myapp.testapp.MyApplication paused=true}
I/ActivityManager( 78): Process myapp.testapp (pid 1165) has died.
I/WindowManager( 78): WIN DEATH: Window{44c72958 myapp.testapp/myapp.testapp.MyApplication paused=false}
D/dalvikvm( 78): GC freed 31778 objects / 1796368 bytes in 142ms
I/ActivityManager( 78): Displayed activity com.android.vending/.AssetInfoActivity: 214 ms (total 22866 ms)
W/KeyCharacterMap( 978): No keyboard for id 65540
W/KeyCharacterMap( 978): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
V/RenderScript_jni( 966): surfaceCreated
V/RenderScript_jni( 966): surfaceChanged
V/RenderScript( 966): setSurface 480 762 0x573430
D/ViewFlipper( 966): updateRunning() mVisible=true, mStarted=true, mUserPresent=true, mRunning=true
D/dalvikvm( 978): GC freed 10065 objects / 624440 bytes in 95ms
Any ideas?
I am having similar problem when trying to open a detail page in Market app using "market://details?id=pname:org.rabold.android.puzzleblox" URL from an application.
I can create a shortcut using AnyCut like this:
action: android.intent.action.VIEW
data: market://details?id=pname:org.rabold.android.puzzleblox
type:
then it works fine.
However, if I create an Android application with a button to launch Market with the same Uri as above, then I get an error in Market app like this: "Attention: A server error has occurred. Retry, or cancel and return to the previous screen."
The code of my button's listener looks like this:
okButton = (Button) findViewById(R.id.okButton);
okButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("market://details?id=pname:org.rabold.android.puzzleblox"));
//Uri.parse("market://search?q=pname:org.rabold.android.puzzleblox"));
startActivity(intent);
}
});
Note in the above code, if I use 'search' instead of 'details' then it works. I'd like to use 'details' instead of 'search' because I know that my app will be available on Market when it's done. Thanks.
Update!:
Do not use "pname:"
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.example.android"));
startActivity(intent);
Works perfectly.
per:
http://developer.android.com/distribute/googleplay/promote/linking.html#android-app
☮ ♥ ☺
thnx Daniel, I can confirm that your solution is working fine on device.
#TPham: please try with correct url (append id only),
passing correct id also working fine, see example below;
static final String APP_MARKET_URL = "market://details?id=com.wareninja.android.fotolicke";
Intent intent = new Intent( Intent.ACTION_VIEW,
Uri.parse(APP_MARKET_URL));
startActivity(intent);
instead of launching with the exact ID, you can try doing it by searching by the package.
Intent intent = new Intent( Intent.ACTION_VIEW,
Uri.parse("market://search?q=pname:com.package.package2.package3"));
startActivity(intent);

Categories

Resources