Perry Hoekstra

Greenhorn
+ Follow
since Dec 07, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Perry Hoekstra

Well, there are a number of approaches to getting this to work. The first approach is to get Android to accept a self-signed cert.

I pointed out one website and here is another: http://blog.antoine.li/index.php/2010/10/android-trusting-ssl-certificates

Also, there is also the Signing in Debug Mode: http://developer.android.com/guide/publishing/app-signing.html

I have not used this approach.

The final option is to deal with the self-signed cert programmaticly. This is usually done by implementing a version of the SSL Socket factory class where the verification is always set to true. There are numerous examples including:

http://mobile.synyx.de/2010/06/android-and-self-signed-ssl-certificates
http://developer.android.com/reference/org/apache/http/conn/ssl/SSLSocketFactory.html
10 years ago
Bob Lee posted on his blog a solution to this:

http://blog.crazybob.org/2010_02_01_archive.html
10 years ago
The problem you will run into trying to get a JMS client on an Android is that while Android has most of the base J2SE stack, it does not have any of the javax.* classes. All of the JMS clients use packages such as javax.naming or javax.transaction. You would be in for a bit of work getting something up and running.

Now, as an alternative, if you are not wedded to a particular JMS implementation, JBoss/HornetQ has a REST API for JMS that would be callable from a Android phone.

Perry Hoekstra
10 years ago
There are a number of ways you can push messages to your device:

-> Polling - The mobile application would periodically poll one of your services and check for messages. However, as numerous people have pointed out, notifications are no good if they’re delayed due to a low polling period but the more frequently you poll, the more the battery is going to die.

-> SMS - Android can intercept SMS messages but you are limited by the size of the SMS payload.

-> Open a persistent connection - This fixes the polling issue listed above but would kill the battery.

Now, the leading push notification framework for Android seems to be Android Cloud to Device Messaging Framework (http://code.google.com/android/c2dm/#push) but it is in beta and you have to apply.

Another option is MQTT (IBM), a real good overview can be found here (http://tokudu.com/2010/how-to-implement-push-notifications-for-android).

Perry Hoekstra
10 years ago
I did not think that *.pem files were supported in Android, only *.p12 (PKCS#12).
10 years ago
If it is coming back through SOAP, there is the http://code.google.com/p/ksoap2-android project. If not SOAP, you would have to post a bit more information.

Perry Hoekstra
10 years ago
Not necessarily. Just because you are accessing records against a DB on the server does not mean you need a DB of any kind on the client side (your phone).

If you do not need to store the data on the phone, there is no need to keep in SQLite. If you just want to display the data on your phone, you would be better off defining common access paths to the data on the server (all records that match a certain date or region, all records pertaining to a particular business unit, etc), building the ability to access that data from a REST-based web service (returning the data using the JSON notation) and calling the web service from the phone (Spring offers their RestTemplate client).

So the first question you need to ask yourself. If a user brings up the app on their phone and there is no network connection, do they need to see the last good set of data brought across from a previous connection? If not, no need to store it. If you do need to display the last best set of data, ask yourself, how sensitive is the data? If the person lost the phone and someone accessed the phone and the data, is that loss critical?
10 years ago
Within an AsyncTask, I am making a REST call to retrieve data. Within that AsyncTask, I may encounter an exception which I would like to package up (the HTTP code) and inform the Activity, which based on the HTTP response code (Timeout, Unauthorized, etc), would display different messages to the user. What would be the best way to bubble that information up to the Activity for processing? I have looked at a number of different Android mechanisms such as Notification, Handler, etc but I can't seem to determine a good architectural direction for this situation.
10 years ago
I guess I don't understand.

Is the underlying data accessible through a web service that you need to retrieve through an HTTP GET or are you trying to retrieve the full HTML, parse it into day of the week chunks and only display sections of the data based on some criteria such as Monday?
10 years ago
For native applications, the only cross-platform framework I am aware of is the Rhodes framework: http://rhomobile.com/products/rhodes

However, a word of warning, you actually code within the Rhodes framework which is Ruby-based. Their products take care of the necessary conversion to the appropriate phone platform environment. This conversion does not generate source code. In the case of Android, Rhodes generates Java bytecodes. For the other platforms, it has a Ruby interpreter that runs on the phones and executes the application as a Ruby app. This means that once you go down the Rhodes path, you are committed. You cannot change your mind six months down the road and just use the individual platform source code deck for each phone type as Rhodes does not generate it.

In addition, the installation/configuration of their product suite is not easy. Preston Thornton posted an entry last last year on how difficult the setup is for the product suite. It all depends on how important it is for you to support multiple platforms. For a single app that does a single task such as track a contact list, probably not. However, a mid to large size corporation that needs to rollout a major business app and support multiple smartphones, Android, iPhone, and Blackberry, Rhomobile is an attractive offering.
10 years ago
There is a Spring Mobile project: http://www.springsource.org/spring-mobile

However, it's focus is not to provide a Spring MVC/Webflow framework for the Android platform. What it does do is provide tools to connect your Android application to REST-based services on the server side (RestTemplate et al). In addition, the Spring Mobile distribution provides tools that you can include within Spring MVC on the server-side to detect that a mobile device is accessing your web-based application and allows you to redirect that user to a mobile-optimized website.
10 years ago
Define other devices? Android-based devices is a yes. iPhone, Windows Mobile, or Blackberry is a no.
10 years ago
If you want to develop Android applications in Ruby, you should look at RhoMobile: http://rhomobile.com

Perry Hoekstra
10 years ago
I guess I don't know what a 10 data response or a 160 data response is. The first steps I would try is to determine if the entire flow is working from Android to server and back again.

So long as your request/response is not encrypted (HTTPS), I would use tcpmon to see the request/response to confirm that Android is sending the proper HTTP request and the server is sending back the correct web service response. You can find tcpmon here: http://ws.apache.org/commons/tcpmon

If you have confirmed that all the plumbing is working correctly, then I would narrow it down to the web service parsing code within your Android app. Is the web service response JSON or SOAP based? Depending on what type, you would use different libraries. You should be able to test your parsing code using a unit test within your IDE. If everything looks good but it is still not working, then LogCat is your friend.

Perry Hoekstra
10 years ago
To determine if the phone is in vibrate mode, I would recommend using the AudioManager class: http://developer.android.com/reference/android/media/AudioManager.html



Now, to access this, I don't believe you need to indicate it in the manifest file. However, if you change it, there is a: MODIFY_AUDIO_SETTINGS


In the case of wanting to make the phone vibrate, you use the Vibrator class.

First, you need to allow the functionality through the manifest file:



and within your application:



You can also make it pulse (think Morse Code):



The JavaDoc can be found here: http://developer.android.com/reference/android/os/Vibrator.html

Perry Hoekstra
10 years ago