cancel
Showing results for 
Search instead for 
Did you mean: 

Quick question - Android app works on simulator, not on devices

vladimir_erakovic
Contributor
0 Kudos

This is probably something stupid, but I can't see it right now.

I tried famous SMP101 tutorial app and it works fine on simulator but not on devices: Galaxy Tab 2 and Galaxy S2.

I think that both devices are already registered in SCC, can see them in Application Connections but there are offline:

What am I missing?

Accepted Solutions (1)

Accepted Solutions (1)

vladimir_erakovic
Contributor
0 Kudos

Ok now everything works. Thank you all for help.

To make a summary for someone with same problems:

Solution for problem with WiFi on devices is adding android.permission.ACCESS_NETWORK_STATE in AndroidManifest.xml.

Solution for crashing when change orientation is:

<activity
            android:name=".SMP101SampleActivity"
            android:screenOrientation="portrait"
            android:configChanges="keyboardHidden|orientation|screenSize">

in AndroidManifest.xml.

Answers (2)

Answers (2)

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Strange.. You have to check in server and client logs for more information.

Btw: which simulator (android version) you have tested this app?

what about device's android OS version?

Rgrds,

Jitendra

vladimir_erakovic
Contributor
0 Kudos

In AndroidManifest.xml is this:

    <uses-sdk

    android:minSdkVersion="15"

    android:targetSdkVersion="19" />

Simulator is 4.0.3 (API level 15), Galaxy TAB is 4.1.2 (API level 16) and Galaxy S2 is 4.0.4.

One more thing, I must connect to mobile server through VPN (Cisco AnyConnect application for Android), but simulator is also on VPN with laptop..

Former Member
0 Kudos

Please double check if the device is able to reach the server with VPN.  E.g. in the device's browser application, if you put in http://servername:port/tm (the default port is 5001), is a response received?

Thanks,

Andrew.

former_member186566
Active Participant
0 Kudos

Hi Vladimir,

AnyConnect will not support some of the Galaxy Tab versions(Samsung Galaxy Tab 7) Refer the below link.

http://www.cisco.com/en/US/docs/security/vpn_client/anyconnect/anyconnect25/android-user/guide/andro...

This could be the reason, i found several users has the nw issue with Anyconnect. So Try to connect with enterprise WIFI and then execute the application.

You have mentioned users for the device have registered already? how did it happen?

Remove the existing user and try to execute the application.

Regards

Yokesvaran Kumarasamy

vladimir_erakovic
Contributor
0 Kudos

Yes they can. I tried with browser and it downloads tm.bin (?). Both devices works with Hybrid apps. By log it seems to have something with WiFi:

01-08 16:12:53.205: I/MocaLog(28256): 08T161253, T1, WiFi Connected

01-08 16:12:53.215: D/AndroidRuntime(28256): Shutting down VM

01-08 16:12:53.215: W/dalvikvm(28256): threadid=1: thread exiting with uncaught exception (group=0x40c6e1f8)

01-08 16:12:53.220: E/AndroidRuntime(28256): FATAL EXCEPTION: main

01-08 16:12:53.220: E/AndroidRuntime(28256): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.wifi.WIFI_STATE_CHANGED flg=0x10000010 (has extras) } in com.sybase.mo.MessagingService$MoTelephonyListener$1@41578b90

01-08 16:12:53.220: E/AndroidRuntime(28256): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:737)

01-08 16:12:53.220: E/AndroidRuntime(28256): at android.os.Handler.handleCallback(Handler.java:605)

01-08 16:12:53.220: E/AndroidRuntime(28256): at android.os.Handler.dispatchMessage(Handler.java:92)

01-08 16:12:53.220: E/AndroidRuntime(28256): at android.os.Looper.loop(Looper.java:137)

01-08 16:12:53.220: E/AndroidRuntime(28256): at android.app.ActivityThread.main(ActivityThread.java:4511)

01-08 16:12:53.220: E/AndroidRuntime(28256): at java.lang.reflect.Method.invokeNative(Native Method)

01-08 16:12:53.220: E/AndroidRuntime(28256): at java.lang.reflect.Method.invoke(Method.java:511)

01-08 16:12:53.220: E/AndroidRuntime(28256): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)

01-08 16:12:53.220: E/AndroidRuntime(28256): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)

01-08 16:12:53.220: E/AndroidRuntime(28256): at dalvik.system.NativeStart.main(Native Method)

01-08 16:12:53.220: E/AndroidRuntime(28256): Caused by: java.lang.SecurityException: ConnectivityService: Neither user 10122 nor current process has android.permission.ACCESS_NETWORK_STATE.

01-08 16:12:53.220: E/AndroidRuntime(28256): at android.os.Parcel.readException(Parcel.java:1327)

01-08 16:12:53.220: E/AndroidRuntime(28256): at android.os.Parcel.readException(Parcel.java:1281)

01-08 16:12:53.220: E/AndroidRuntime(28256): at android.net.IConnectivityManager$Stub$Proxy.getActiveNetworkInfo(IConnectivityManager.java:597)

01-08 16:12:53.220: E/AndroidRuntime(28256): at android.net.ConnectivityManager.getActiveNetworkInfo(ConnectivityManager.java:418)

01-08 16:12:53.220: E/AndroidRuntime(28256): at com.sybase.mo.MessagingService$MoTelephonyListener$1.onReceive(MessagingService.java:115)

01-08 16:12:53.220: E/AndroidRuntime(28256): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:728)

01-08 16:12:53.220: E/AndroidRuntime(28256): ... 9 more

01-08 16:12:53.260: I/MocaLog(28256): 08T161253, T2, ThreadID = Thread[Thread-3532,5,main] maps to short thread id 2

01-08 16:12:53.260: I/MocaLog(28256): 08T161253, T2, MessagingClientLib: getDeviceID

01-08 16:12:53.275: I/System.out(28256): CONSOLE TRACE: setListener

01-08 16:12:53.275: I/System.out(28256): CONSOLE TRACE: addConnection for Connection key: smp101:1.0

01-08 16:12:53.275: I/System.out(28256): CONSOLE TRACE: leave setListener

01-08 16:12:53.290: I/SMP101(28256): Starting Application Registration

But then it continues registration as if nothing happen. Off course there is black screen on device until I unplug it from laptop. Then it shows application has stopped message..

vladimir_erakovic
Contributor
0 Kudos

I must use AnyConnect. That is the only way to connect to corporate VPN of corporation that is in another country. I don't know why..

I have these connections because I already connected with Hybrid applications. I tried to delete them in this application but it seems that error starts before application can reach server.

Former Member
0 Kudos

For that error with wifi, is the application overriding onResume in any of it's activities?

I agree with Yokesvaran's assessment of AnyConnect, have seen problems with other users as well.

Is Relay Server not an option so you don't need to go through VPN?

Thanks,

Andrew.

vladimir_erakovic
Contributor
0 Kudos

I figured it out. All I have to do is to place android.permission.ACCESS_NETWORK_STATE in AndroidManifest.xml.

Relay Server could be the option but it would be inconvenient to ask for before the application is finished. After all, management must be convinced that concept is working before they decide to invest further in infrastructure..

But now I have a new problem. When flip the device, change orientation, application crashes:

01-09 09:13:26.140: E/AndroidRuntime(8504): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycorp.smp101.app/com.mycorp.smp101.app.SMP101SampleActivity}: com.sybase.mobile.ApplicationRuntimeException: The value does not match the current set value. The application identifier can not be changed once set.

Thanks for help

Former Member
0 Kudos

Hi Vladimir,

The Activity gets recreated every time when there is change in orientation , Try adding the below line in the android AndroidManifest.xml

android:configChanges="keyboardHidden|orientation|screenSize"

Cheers

Yogesh

midhun_vp
Active Contributor
0 Kudos

Former Member is right, android restarts the running activity when orientation changes. You can use the below code too, this make make the app work only in portrait mode.

<activity android:name=".POListActivity" android:configChanges="orientation" android:screenOrientation="portrait" />

-Midhun VP

midhun_vp
Active Contributor
0 Kudos

What is in the log? increase the log level to debug in SCC>configuration Log settings (mobilink, dataservices and MMS) and check. Also you can debug the program and check where the code stops.

- Midhun VP