[android-developers] Google Calendar API v3 OAuth 2.0

2013-05-14 Thread John Goche
Hello,

I am trying to use the Java API for Google Calendar v3 on Android, but I am
stuck. Here is what I've done so far:

Created a google account my...@gmail.com for my application and
registered it with my debug key on code.google.com/apis/console where I
have created all the auth data (client ID, certificate fingerprint, api
key, etc...)

Added some code to my android application:

{

final HttpTransport transport = AndroidHttp.newCompatibleTransport();

final JsonFactory jsonFactory = new GsonFactory();

GoogleAccountCredential credential;

credential = GoogleAccountCredential.usingOAuth2(this,
CalendarScopes.CALENDAR);

credential.setSelectedAccountName("myemailh...@gmail.com");

calendarClient = new
com.google.api.services.calendar.Calendar.Builder(transport,   jsonFactory,
credential)
.setApplicationName("My App Name/1.0").build();

}

Some code on the net also has:

GoogleCredential gc = new GoogleCredential.Builder()
  .setTransport(transport)
  .setJsonFactory(jsonFactory)
  .setServiceAccountId("850381918262.apps.googleusercontent.com")
  .setServiceAccountScopes(CalendarScopes.CALENDAR)
  .setServiceAccountUser("u...@gmail.com")
  /*.setServiceAccountPrivateKeyFromP12File(new
File("D:/3cd8Xd635e-privatekey.p12"))*/
  .build();

But I don't have a private key, so where would I get it. And what would I
do with the GoogleCredential object?
I've seen there is a credential.getToken() function but I'm not sure how to
use it. From what I gather my application should initiate a process where
it asks the user to authorize myapplicat...@google.com to access
myemailh...@google.com 's calendar data, but how do I setup this process?

Also what is the difference between a GoogleAccountCredential and a
GoogleCredential? Which one do I need? Also some posts make reference to a
client secret, but I do not have one (android applications do not have a
secret it seems).

I've searched and searched the web but could only find vague information.
And the sample google calendar api application does not set up access with
the sequence I describe.

I know I need to

Authenticate using OAuth2 for installed applications
Somehow prompt the user if the app can access their calendar data.
Connect and manipulate calendar data.

Could someone here please help me?

Thanks.

John Goche

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[android-developers] Calendar contact provider: custom data

2013-04-28 Thread John Goche

Hello,

I plan to use the Android Calendar contact provider to access calendar 
information
and store events. I need to store some custom fields, however, with each 
event,
but I don't see how I can implement these in Google Calendar or Android 
Calendar
as the API does not offer me the option to define them.

Any ideas on how to overcome this problem,

Thanks,

John Goche

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[android-developers] "textMultiLine and textImeMultiLine"

2013-04-18 Thread John Goche
Hello,

I am trying to understand the difference between the textMultiLine and
textImeMultiLine options for android:inputType in an EditText. However
I have not been able to understand an answer. The documentation
says IME is a control enabling users to enter text but I don't
understand how texMultiLine is different from textImeMultiLine.

Thanks for your help,

John Goche

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[android-developers] Google Calendar API: drawbacks of using Gingerbread vs. Ice Cream Sandwich etc...

2013-04-14 Thread John Goche
Hello,

I've got a few questions regarding the Google Calendar API for Android.

1. Do I really need to be running Ice Cream Sandwich or later to use
the Google Calendar API? The docs seem to imply this but on the
other hand I've found some code which works with API 8.

I've got a Gingerbread device where I can use AccountManager stuff
but I'm not sure what the limitations of this platform as far as the
Google Calendar API is concerned are.

2. Can I debug on the emulator/use the google play application
on the emulator or do I need a real device to debug and test
my google calendar code?

Thanks for your feedback,

John Goche

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[android-developers] droid text on android

2012-02-23 Thread John Goche
Hello,

I am trying to use the free version of iText for android in eclipse.
I have tried following the instructions at:

code.google.com/u/markus.neubrand/

and have downloaded the sources with

svn checkout http://droidtext.googlecode.com/svn/trunk/ droidtext-read-only

where I see the droidtext-read-only/droidTexet directory but I am unable to
import it into eclipse. On the web page above it says:

"It is recommended that you check out the droidText Eclipse project
into your workspace (it is a library project)"
but while I have figured out how to add a libra ry project I do not
know how to check out the droidText eclipse project
(which if I understand should contain an AndroidManifest.xml and all
those files).

So my question is the following very basic question:

How do I check out the droidText eclipse library project into my
workspace and then import it into eclipse?

Thanks for your help,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] PDF on android: request for comments

2012-02-17 Thread John Goche
On Fri, Feb 17, 2012 at 9:51 PM, Mark Murphy  wrote:
> On Fri, Feb 17, 2012 at 3:45 PM, John Goche  
> wrote:
>> I've found the following code which would allow the user to select an
>> email client from a list fired as an intent. The email client on the phone
>> would have the pdf as an attachment. Here the pdf is called shortcuts.pdf.
>> However I don't know how to save it so that it becomes accessible as
>> R.raw.shortcuts . How is this magic achieved? What is R.raw?
>
> R.raw refers to raw resources, stored in res/raw/ in your project (or
> other resource sets, such as res/raw-es/ for Spanish-language raw
> resources).
>
>> Does it reside on external storage?
>
> No.
>
>> Do I really need to use "content://" and a content provider or can I do
>> away with using "android:resource://" as below?
>
> Only if your PDF is a raw resource.

OK. Well I guess since the PDF is being generated dynamically it does
not qualify as a raw resource. I probably don't mind storing the generated
PDF on internal storage and making it world readable as there is not much
other apps can do with it. This seems like the simplest solution as not all
devices possess external storage. I don't see how writing a content provider
would release me from any burden. After all, even if I make the content only
available to email clients I don't gain much (wouldn't that be the extra purpose
of having the content provider?). Plus, how does android know whether an
application is an email client with access to the content provider's content
or not?

Thanks,

JG

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] PDF on android: request for comments

2012-02-17 Thread John Goche
On Fri, Feb 17, 2012 at 6:38 PM, Mark Murphy  wrote:

> You can specify the path to a PDF as an extra, or as the Uri
> associated with the Intent. You need to follow the rules for whatever
> it is that you are trying to do (e.g., ACTION_SEND would use
> EXTRA_STREAM).
>
> Note that paths to files on internal storage are frequently useless,
> as other apps cannot access those files by default. You would either
> need to use MODE_WORLD_READABLE (ick) or create a small
> ContentProvider for serving that file and making it available to other
> apps via a content:// Uri.

I've found the following code which would allow the user to select an
email client from a list fired as an intent. The email client on the phone
would have the pdf as an attachment. Here the pdf is called shortcuts.pdf.
However I don't know how to save it so that it becomes accessible as
R.raw.shortcuts . How is this magic achieved? What is R.raw? Does it
reside on external storage?

Do I really need to use "content://" and a content provider or can I do
away with using "android:resource://" as below? What's the difference?

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
 new String[]{"emailaddress"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Body");

String rawFolderPath = "android.resource://" + getPackageName()
   + "/" + R.raw.shortcuts;

// Here my file name is shortcuts.pdf which i have stored in /res/raw folder
Uri emailUri = Uri.parse(rawFolderPath );
emailIntent.putExtra(Intent.EXTRA_STREAM, emailUri);
emailIntent.setType("application/pdf");
startActivity(Intent.createChooser(emailIntent, "Send mail..."));


Thanks,

JG

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] PDF on android: request for comments

2012-02-17 Thread John Goche
Hello,

I would like to produce a PDF file programmatically in my application.
I have found that itext (http://itextpdf.com/) does the job but that the
later versions are covered by the AGPL rather than the LGPL which
as far as I understand means that if the application is sold then I need
to purchase the license for $1,500 which is quite a lot especially given
that I do not know in advance how many copies of my application will
sell. I have found that there is a bundle from a previous version called
droid text: http://code.google.com/p/droidtext/downloads/list
which is based on the LGPL so that users don't have to pay
for it.

I wonder if anyone knows what the differences are between the old
version and the new version. Are the APIs compatible and what more
does the new version (currently 5.1.3) offer besides PDF 2 support that
the former version does not? I would like to hear from anyone whom has
used droid pdf.

Also, where do I save the PDF? I would like to fire a browser intent which
attaches the generated PDF file as an attachment. Anyone know how to
do that? Where on the file system can I save the generated PDF and can
I specify the PDF as an intent bundle extra?

Thanks,

JG

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] eclipse XML formatting not working

2012-02-13 Thread John Goche
On Mon, Feb 13, 2012 at 4:48 PM, Tor Norbye  wrote:

> Go to Preferences -> Android -> Editors and uncheck the first option
> ("Format XML files using the standard Android XML style rather than
> the configured Eclipse XML style (additional options below)".

Thanks, that worked!

> The builtin Eclipse XML formatter isn't suitable for formatting XML files
> the "standard" Android way (where for example layouts and value files are
> formatted differently), so in Android projects we use an alternate formatter
> (which also sorts attributes etc). If you uncheck the option above, it will
> just use the default Eclipse XML formatter instead.

Not sure what the benefits of having attributes sorted rather than appear in
the order the user wants them to be is, but I guess I'm not going to run into
any problem if I format the XML files my own preferred way. Otherwise, please
let me know.

Thanks,

JG

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] eclipse XML formatting not working

2012-02-13 Thread John Goche
Hello,

I've recently reinstalled eclipse and ADT and android plugin for eclipse.
I am trying to set the formatting properties for my projects by going to
Preferences -> XML -> XML Files -> Editor and setting them, but when
I save and do a CTRL-SHIFT-F eclipse behaves as if I never set any of
them. Anyone have this problem or know how to fix it?

Thanks,

JG

(eclipse SDK 3.7.1 eclipse plugin for developer tools 16.0.1)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] multiline EditText: setting cursor position to top of widget

2012-02-13 Thread John Goche
Thanks!

JG

2012/2/13 Kostya Vasilyev :
> Use android:gravity="top|left" on the second EditText.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] multiline EditText: setting cursor position to top of widget

2012-02-13 Thread John Goche
Hello,

I have the following in my layout XML file. Basically I want the address
EditText to take up all the space available below the other name EditText
so that the first one is a one line edit text and the second one is a multiline
edit text. However, when I run my application the cursor in the second EditText
is placed in the Middle of the widget. I want the cursor at the top. I have seen
this done in some apps on android market but I cannot figure out how to do it.

http://schemas.android.com/apk/res/android";
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
  
   
  

Any ideas on how to achieve the cursor placement at the very top rather than
in the middle.

Currently, when the keyboard shows up I cannot see the text (which ends up
being typed under the keyboard). Ideally I would like the widget to always be
above the android soft keyboard.

Thanks for your feedback,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] installing APK without eclipse/android SDK

2012-02-12 Thread John Goche
Hello,

I would like to send my APK to someone by email so that they
may install it using WIndows Vista. I have searched for info on
how they can install the .apk but only found a pointer to downloading
the Astro file manager and installing from there after copying the apk
to the phone's file system eg. via usb. But when the application is
clicked on the message is: "the application is not installed". The
phone is a Samsung Galaxy S Plus. Any ideas? (I have already enabled
USB debugging and installation of non market apps in the settings).
Installing to the phone via eclipse works, but I want to be able to do
this from the phone's PC which does not have eclipse.

I would like to be able to just compile the Dalvik APK in eclipse and
send it via email for the user to install it from windows vista.

Any ideas?

Thanks,

JG

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] wait and notify in non-UI thread: waiting thread not waking up

2012-02-09 Thread John Goche
Hello,

I have put together the following code that illustrates that
apparently the answer to my question
is that a thread can call join() on another thread which has not yet
started (as s.join() below will
be run before s.run()) resulting in the output "Hello World Bye".

Regards,

JG

final Thread s = new Thread() {
  @Override
  public void run() {
System.out.println("World");
  }
};

Thread t = new Thread() {
  @Override
  public void run() {
System.out.println("Hello");
try { sleep(5000); } catch (Exception e) { e.printStackTrace(); }
s.run();
  }
};

   t.run();

   try { s.join(); } catch (InterruptedException e) { e.printStackTrace(); }

   System.out.println("Bye");


2012/2/9 John Goche :
> Hi all,
>
> The problem I am having is that the thread I need to call join() on so as
> to wait for completion may not even yet be started when I call join(). Is it
> legal in Java to call join() on a thread which is not running, but which will
> eventually be run by a third thread?
>
> Thanks,
>
> JG
>
> 2012/2/9 John Goche :
>> Basically sendRequest() invokes a thread which calls runOnUiThread with
>> a new Runnable() which in turn also invokes a new Thread(). It is this latter
>> thread which I need to wait for to finish. I thought of using the join() 
>> method
>> to force thread completion prior to continuation at a specific spot but I am
>> somewhat new to thread programming and I am not entirely sure
>> about how to set things up. Will give it another go...
>>
>> Thanks for your help,
>>
>> JG
>>
>> 2012/2/9 John Goche :
>>> Thanks Kostya!
>>>
>>> I have traced the code with the debugger and found that even though
>>> notify() is being called from within a thread instantiated from 
>>> sendRequest()
>>> (which is not the same thread as sendRequest()'s thread), the notify() is
>>> being called before the wait().
>>>
>>> I am assuming that if I call notify() before wait() the notification gets 
>>> lost?
>>> If this is not so, someone please let me know.
>>>
>>> The problem I am having is that sendRequest() launches a new thead s,
>>> and I need to be sure thread s completes before the code proceeds past
>>> what I have marked with wait().
>>>
>>> Any ideas on how to solve this synchronization problem?
>>>
>>> Thanks,
>>>
>>> John Goche
>>>
>>>
>>> 2012/2/9 Kostya Vasilyev :
>>>> Are you calling notify() from inside sendRequest()?
>>>>
>>>>
>>>> If so, it's the same thread, and notify has nothing to do.
>>>>
>>>> http://developer.android.com/reference/java/lang/Object.html#notify()
>>>>
>>>> Causes a thread which is waiting on this object's monitor (by means of
>>>> calling one of the wait() methods) to be woken up
>>>>
>>>>
>>>> From looking at the code you posted, there is no thread waiting on the lock
>>>> because you only have one worker thread, and when it's calling notify it's,
>>>> well, calling notify and not waiting on a wait().
>>>>
>>>>
>>>> For debugging, set a breakpoint at lock.notify, and use the DDMS thread
>>>> monitor or the debugger window to examine your threads.
>>>>
>>>>
>>>> You might want to look at this package, which provides higher-level
>>>> concurrency classes, and try to find one that fits what you're trying to 
>>>> do:
>>>>
>>>> http://developer.android.com/reference/java/util/concurrent/package-summary.html
>>>>
>>>> ( ThreadPoolExecutor? BlockingQueue? )
>>>>
>>>> -- Kostya
>>>>
>>>> 10 февраля 2012 г. 0:41 пользователь John Goche 
>>>> 
>>>> написал:
>>>>>
>>>>> Dear Android developers,
>>>>>
>>>>> I am having the following issue in Android:
>>>>>
>>>>> In one class I am having:
>>>>>
>>>>> 
>>>>>
>>>>>  final Object lock = new Object();
>>>>>
>>>>>  Thread thread;
>>>>>
>>>>>  @Override
>>>>>  public void onCreate(Bundle savedInstanceState) {
>>>>>
>>>>>    super.onCreate(savedInstanceState);
>>>>>
>>>

Re: [android-developers] wait and notify in non-UI thread: waiting thread not waking up

2012-02-09 Thread John Goche
Hi all,

The problem I am having is that the thread I need to call join() on so as
to wait for completion may not even yet be started when I call join(). Is it
legal in Java to call join() on a thread which is not running, but which will
eventually be run by a third thread?

Thanks,

JG

2012/2/9 John Goche :
> Basically sendRequest() invokes a thread which calls runOnUiThread with
> a new Runnable() which in turn also invokes a new Thread(). It is this latter
> thread which I need to wait for to finish. I thought of using the join() 
> method
> to force thread completion prior to continuation at a specific spot but I am
> somewhat new to thread programming and I am not entirely sure
> about how to set things up. Will give it another go...
>
> Thanks for your help,
>
> JG
>
> 2012/2/9 John Goche :
>> Thanks Kostya!
>>
>> I have traced the code with the debugger and found that even though
>> notify() is being called from within a thread instantiated from sendRequest()
>> (which is not the same thread as sendRequest()'s thread), the notify() is
>> being called before the wait().
>>
>> I am assuming that if I call notify() before wait() the notification gets 
>> lost?
>> If this is not so, someone please let me know.
>>
>> The problem I am having is that sendRequest() launches a new thead s,
>> and I need to be sure thread s completes before the code proceeds past
>> what I have marked with wait().
>>
>> Any ideas on how to solve this synchronization problem?
>>
>> Thanks,
>>
>> John Goche
>>
>>
>> 2012/2/9 Kostya Vasilyev :
>>> Are you calling notify() from inside sendRequest()?
>>>
>>>
>>> If so, it's the same thread, and notify has nothing to do.
>>>
>>> http://developer.android.com/reference/java/lang/Object.html#notify()
>>>
>>> Causes a thread which is waiting on this object's monitor (by means of
>>> calling one of the wait() methods) to be woken up
>>>
>>>
>>> From looking at the code you posted, there is no thread waiting on the lock
>>> because you only have one worker thread, and when it's calling notify it's,
>>> well, calling notify and not waiting on a wait().
>>>
>>>
>>> For debugging, set a breakpoint at lock.notify, and use the DDMS thread
>>> monitor or the debugger window to examine your threads.
>>>
>>>
>>> You might want to look at this package, which provides higher-level
>>> concurrency classes, and try to find one that fits what you're trying to do:
>>>
>>> http://developer.android.com/reference/java/util/concurrent/package-summary.html
>>>
>>> ( ThreadPoolExecutor? BlockingQueue? )
>>>
>>> -- Kostya
>>>
>>> 10 февраля 2012 г. 0:41 пользователь John Goche 
>>> написал:
>>>>
>>>> Dear Android developers,
>>>>
>>>> I am having the following issue in Android:
>>>>
>>>> In one class I am having:
>>>>
>>>> 
>>>>
>>>>  final Object lock = new Object();
>>>>
>>>>  Thread thread;
>>>>
>>>>  @Override
>>>>  public void onCreate(Bundle savedInstanceState) {
>>>>
>>>>    super.onCreate(savedInstanceState);
>>>>
>>>>    thread = new Thread() {
>>>>
>>>>      @Override
>>>>      public void run() {
>>>>
>>>>        sendRequest("foo");
>>>>
>>>>        synchronized(lock) {
>>>>
>>>>        try { lock.wait(); } catch (InterruptedException e) {
>>>> e.printStackTrace(); }
>>>>
>>>>        }
>>>>
>>>>        System.out.println("GOT HERE!!!");
>>>>
>>>> 
>>>>
>>>> which causes the sendRequest() to do a bunch of stuff. When such stuff
>>>> finishes I call:
>>>>
>>>>      System.out.println("Notifying thread...");
>>>>      synchronized(lock) {
>>>>        lock.notify();
>>>>      }
>>>>      System.out.println("Thread notified.");
>>>>
>>>> -
>>>>
>>>> and this code executed until the "Thread notified." println()
>>>> statement. But then I do
>>>> not see the waiting thread resume from where I calle

Re: [android-developers] wait and notify in non-UI thread: waiting thread not waking up

2012-02-09 Thread John Goche
Basically sendRequest() invokes a thread which calls runOnUiThread with
a new Runnable() which in turn also invokes a new Thread(). It is this latter
thread which I need to wait for to finish. I thought of using the join() method
to force thread completion prior to continuation at a specific spot but I am
somewhat new to thread programming and I am not entirely sure
about how to set things up. Will give it another go...

Thanks for your help,

JG

2012/2/9 John Goche :
> Thanks Kostya!
>
> I have traced the code with the debugger and found that even though
> notify() is being called from within a thread instantiated from sendRequest()
> (which is not the same thread as sendRequest()'s thread), the notify() is
> being called before the wait().
>
> I am assuming that if I call notify() before wait() the notification gets 
> lost?
> If this is not so, someone please let me know.
>
> The problem I am having is that sendRequest() launches a new thead s,
> and I need to be sure thread s completes before the code proceeds past
> what I have marked with wait().
>
> Any ideas on how to solve this synchronization problem?
>
> Thanks,
>
> John Goche
>
>
> 2012/2/9 Kostya Vasilyev :
>> Are you calling notify() from inside sendRequest()?
>>
>>
>> If so, it's the same thread, and notify has nothing to do.
>>
>> http://developer.android.com/reference/java/lang/Object.html#notify()
>>
>> Causes a thread which is waiting on this object's monitor (by means of
>> calling one of the wait() methods) to be woken up
>>
>>
>> From looking at the code you posted, there is no thread waiting on the lock
>> because you only have one worker thread, and when it's calling notify it's,
>> well, calling notify and not waiting on a wait().
>>
>>
>> For debugging, set a breakpoint at lock.notify, and use the DDMS thread
>> monitor or the debugger window to examine your threads.
>>
>>
>> You might want to look at this package, which provides higher-level
>> concurrency classes, and try to find one that fits what you're trying to do:
>>
>> http://developer.android.com/reference/java/util/concurrent/package-summary.html
>>
>> ( ThreadPoolExecutor? BlockingQueue? )
>>
>> -- Kostya
>>
>> 10 февраля 2012 г. 0:41 пользователь John Goche 
>> написал:
>>>
>>> Dear Android developers,
>>>
>>> I am having the following issue in Android:
>>>
>>> In one class I am having:
>>>
>>> 
>>>
>>>  final Object lock = new Object();
>>>
>>>  Thread thread;
>>>
>>>  @Override
>>>  public void onCreate(Bundle savedInstanceState) {
>>>
>>>    super.onCreate(savedInstanceState);
>>>
>>>    thread = new Thread() {
>>>
>>>      @Override
>>>      public void run() {
>>>
>>>        sendRequest("foo");
>>>
>>>        synchronized(lock) {
>>>
>>>        try { lock.wait(); } catch (InterruptedException e) {
>>> e.printStackTrace(); }
>>>
>>>        }
>>>
>>>        System.out.println("GOT HERE!!!");
>>>
>>> 
>>>
>>> which causes the sendRequest() to do a bunch of stuff. When such stuff
>>> finishes I call:
>>>
>>>      System.out.println("Notifying thread...");
>>>      synchronized(lock) {
>>>        lock.notify();
>>>      }
>>>      System.out.println("Thread notified.");
>>>
>>> -
>>>
>>> and this code executed until the "Thread notified." println()
>>> statement. But then I do
>>> not see the waiting thread resume from where I called wait(). Here is the
>>> output
>>> from adb logcat:
>>>
>>> I/System.out( 2395): Thread notified.
>>> W/ActivityManager(   60): Launch timeout has expired, giving up wake lock!
>>>
>>> I do not see where I am going wrong. Any ideas why the code is not
>>> working as expected?
>>>
>>> Thanks,
>>>
>>> John Goche
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Developers" group.
>>> To post to this group, send email to android-developers@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> android-developers+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-developers?hl=en
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] wait and notify in non-UI thread: waiting thread not waking up

2012-02-09 Thread John Goche
Thanks Kostya!

I have traced the code with the debugger and found that even though
notify() is being called from within a thread instantiated from sendRequest()
(which is not the same thread as sendRequest()'s thread), the notify() is
being called before the wait().

I am assuming that if I call notify() before wait() the notification gets lost?
If this is not so, someone please let me know.

The problem I am having is that sendRequest() launches a new thead s,
and I need to be sure thread s completes before the code proceeds past
what I have marked with wait().

Any ideas on how to solve this synchronization problem?

Thanks,

John Goche


2012/2/9 Kostya Vasilyev :
> Are you calling notify() from inside sendRequest()?
>
>
> If so, it's the same thread, and notify has nothing to do.
>
> http://developer.android.com/reference/java/lang/Object.html#notify()
>
> Causes a thread which is waiting on this object's monitor (by means of
> calling one of the wait() methods) to be woken up
>
>
> From looking at the code you posted, there is no thread waiting on the lock
> because you only have one worker thread, and when it's calling notify it's,
> well, calling notify and not waiting on a wait().
>
>
> For debugging, set a breakpoint at lock.notify, and use the DDMS thread
> monitor or the debugger window to examine your threads.
>
>
> You might want to look at this package, which provides higher-level
> concurrency classes, and try to find one that fits what you're trying to do:
>
> http://developer.android.com/reference/java/util/concurrent/package-summary.html
>
> ( ThreadPoolExecutor? BlockingQueue? )
>
> -- Kostya
>
> 10 февраля 2012 г. 0:41 пользователь John Goche 
> написал:
>>
>> Dear Android developers,
>>
>> I am having the following issue in Android:
>>
>> In one class I am having:
>>
>> 
>>
>>  final Object lock = new Object();
>>
>>  Thread thread;
>>
>>  @Override
>>  public void onCreate(Bundle savedInstanceState) {
>>
>>    super.onCreate(savedInstanceState);
>>
>>    thread = new Thread() {
>>
>>      @Override
>>      public void run() {
>>
>>        sendRequest("foo");
>>
>>        synchronized(lock) {
>>
>>        try { lock.wait(); } catch (InterruptedException e) {
>> e.printStackTrace(); }
>>
>>        }
>>
>>        System.out.println("GOT HERE!!!");
>>
>> 
>>
>> which causes the sendRequest() to do a bunch of stuff. When such stuff
>> finishes I call:
>>
>>      System.out.println("Notifying thread...");
>>      synchronized(lock) {
>>        lock.notify();
>>      }
>>      System.out.println("Thread notified.");
>>
>> -
>>
>> and this code executed until the "Thread notified." println()
>> statement. But then I do
>> not see the waiting thread resume from where I called wait(). Here is the
>> output
>> from adb logcat:
>>
>> I/System.out( 2395): Thread notified.
>> W/ActivityManager(   60): Launch timeout has expired, giving up wake lock!
>>
>> I do not see where I am going wrong. Any ideas why the code is not
>> working as expected?
>>
>> Thanks,
>>
>> John Goche
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] wait and notify in non-UI thread: waiting thread not waking up

2012-02-09 Thread John Goche
Dear Android developers,

I am having the following issue in Android:

In one class I am having:



  final Object lock = new Object();

  Thread thread;

  @Override
  public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

thread = new Thread() {

  @Override
  public void run() {

sendRequest("foo");

synchronized(lock) {

try { lock.wait(); } catch (InterruptedException e) {
e.printStackTrace(); }

}

System.out.println("GOT HERE!!!");



which causes the sendRequest() to do a bunch of stuff. When such stuff
finishes I call:

  System.out.println("Notifying thread...");
  synchronized(lock) {
lock.notify();
  }
  System.out.println("Thread notified.");

-

and this code executed until the "Thread notified." println()
statement. But then I do
not see the waiting thread resume from where I called wait(). Here is the output
from adb logcat:

I/System.out( 2395): Thread notified.
W/ActivityManager(   60): Launch timeout has expired, giving up wake lock!

I do not see where I am going wrong. Any ideas why the code is not
working as expected?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] again: App Engine connected *Android* project: someone please help me understand this code

2012-01-18 Thread John Goche
On Wed, Jan 18, 2012 at 2:21 AM, Nikolay Elenkov
wrote:

> On Wed, Jan 18, 2012 at 7:00 AM, John Goche 
> wrote:
> >
> > In AccountsActivity.java we have methods getAuthToken() and
> getAuthCookie().
> > Basically
> > the AccountManager takes care of storing the token information together
> with
> > the account
> > and we store the cookie in preferences together with our default account
> for
> > the application.
>
> Right. It will also get a new token if the current one is expired.
>

Yes, that is also my understanding of it.

> We generate the cookie from the token somehow.
>

 The particular algorithm depends on what authentication mechanism
> you are using. They are documented here:
>
> http://code.google.com/apis/accounts/docs/GettingStarted.html
> http://code.google.com/apis/accounts/
>

OK, but say I have a google email account. How would I know what
is being used. I only need to support google accounts in my applications.
Wouldn't that mean I am using ClientLogin?

http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html

In any case, no matter which protocol is being used, AccountManager
handles the details for you right?


>
> > Next comes AndroidRequestTransport.java. Here I don't understand why we
> have
> > the line:
> >
> > post.setHeader("Content-Type", "application/json;charset=UTF-8");
> >
>
> Because GWT uses JSON to communicate with the server.
>

But isn't GWT used only if you want to write client code in JavaScript?
If not using a web browser to access the server this should be irrelevant
right?


>
> > What if I want to communicate with the app engine server by sending XML
> > instead of JSON.
>
> Set the appropriate content type. However, If you want to use the
> automatically
> generated endpoints, this won't work. You'll have to write your own servlet
> that knows how to process your XML.
>

Yes, I am planning to write a servlet that knows XML and upload it to GAE
so that it communicate with my android applications.


>
> > I think I need to send XML because the messages I send back and forth
> will
> > not correspond
> > directly with Java Objects but will be made up of many bits and pieces.
> >
>
> That doesn't make much sense. You can do pretty much the same thing
> with JSON. Unless you have some predefined XML structure (schema)
> you need to stick to, there is no *need* to use XML (you can if you want
> to).
>

Maybe so, but I am more familiar with XML and thought it is more portable.

> I also don't understand why import
> com.google.web.bindery.requestfactory.shared.RequestTransport
> does not have any abstract methods to implement.
>

 Don't have the code right now, but: generally automatically generated
> code will be harder to understand. Build a simple app manually (without
> wizards and code generation) to understand how the system works,
>

I would like to, but all I have is the generated code, and I'm trying to
understand it.


> once you are comfortable with that, you can use whatever tool makes
> your job easier. In this particular case, what makes you think it needs
> abstract methods?
>
> > I am trying to send data back and forth from the emulator to app engine
> in a
> > way that a response
> > is generated from the server by checking whether the user is
> authenticated
> > (a valid cookie is present)
> > and generating the appropriate response accordingly (the Users google api
> > should let me decide which
> > user is currently logged in on the server side).
>
> If the cookie is set properly, the Users API will return true, you don't
> have
> to check the cookie manually. BTW, you should really ask questions about
> the
> server side on the GAE forums.
>

Yes, well the Users API is not my concern, the server coding is the easy
part, it's
the android bit which gets me somewhat confused.

For instance I don't understand this bit from the AsyncTask of
setHelloWorldScreenContent()
in the main acvity file:

@Override
protected String doInBackground(Void... arg0) {
MyRequestFactory requestFactory =
Util.getRequestFactory(mContext,
MyRequestFactory.class);
final HelloWorldRequest request =
requestFactory.helloWorldRequest();
Log.i(TAG, "Sending request to server");
request.getMessage().fire(new Receiver() {
@Override
public void onFailure(ServerFailure error) {
message = "Failure: " + error.getMes

[android-developers] again: App Engine connected *Android* project: someone please help me understand this code

2012-01-17 Thread John Goche
Hello,

I would like to discuss the code generated in eclipse when you create an
app engine
connected android project.

First of all, I would like to understand the aspects related to
authentication rather than C2DM.
In AccountsActivity.java we have methods getAuthToken() and
getAuthCookie(). Basically
the AccountManager takes care of storing the token information together
with the account
and we store the cookie in preferences together with our default account
for the application.
We generate the cookie from the token somehow.

Next comes AndroidRequestTransport.java. Here I don't understand why we
have the line:

post.setHeader("Content-Type", "application/json;charset=UTF-8");

What if I want to communicate with the app engine server by sending XML
instead of JSON.
I think I need to send XML because the messages I send back and forth will
not correspond
directly with Java Objects but will be made up of many bits and pieces.

I also don't understand why import
com.google.web.bindery.requestfactory.shared.RequestTransport
does not have any abstract methods to implement.

I am trying to send data back and forth from the emulator to app engine in
a way that a response
is generated from the server by checking whether the user is authenticated
(a valid cookie is present)
and generating the appropriate response accordingly (the Users google api
should let me decide which
user is currently logged in on the server side).

Any comments or suggestions welcome. I am trying to understand the code so
that I may adapt it to
my own use case.

Thanks a lot,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] app engine debugging

2012-01-17 Thread John Goche
Hello,

I would like to know what the best way is
to debug an app engine application. The
problem I am experiencing is that I cannot
step through the code in Jetty nor can I
find a log where I can see what exceptions
are thrown. Any ideas on how to proceed
would be very appreciated.

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] android and XML

2012-01-15 Thread John Goche
On Sun, Jan 15, 2012 at 7:17 PM, Kristopher Micinski  wrote:

>
> I would highly doubt that there are significant api differences in xml
> parsers between java 6 and 7..
>
> kris
>

Thanks.

Another API for XML which I have not mentioned is StAX (the streaming API
for XML).
I guess that would be another alternative, which, presumably, being part of
java 6 also
works on android?

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] android and XML

2012-01-15 Thread John Goche
On Sun, Jan 15, 2012 at 6:47 PM, Kristopher Micinski  wrote:

> > I was wondering about the availability of good tutorials on Java XML DOM
> > though.
> >
>
> This shouldn't be your concern, there is a vast amount of literature
> (in the form of references, tutorials, etc...) on both XML, and DOM,
> Android also has an XmlPullParser that you might want to look into,
> I'm sure there are a fully sufficient number of tutorials on that as
> well.
>
> In general your choices in android are these three: dom, sax, and
> xmlpullparser, plus whatever off the shelf parser you want to grab.
> The stigma with dom is that there's a large runtime overhead.  Even if
> it's *small enough* you shouldn't use it (dom) just because it's
> slightly easier to learn, but there might be appropriate reasons for
> it depending on what you need...
>

Yes, for instance the fact that with DOM you can not only parse but also
build XML models in memory. I would say both are just as easy to learn,
but with DOM I can also presumably validate my document once it's in
memory. Maybe I can do that with SAX as well, not sure.

Anyways the following book has an up-to-date chapter on Java and XML

http://www.amazon.com/Beginning-Java-7-Apress/dp/1430239093/ref=sr_1_7?ie=UTF8&qid=1326650427&sr=8-7
even though android AFAIK uses Java 6 this reference should be good
enough for my purposes.

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] android and XML

2012-01-15 Thread John Goche
On Sun, Jan 15, 2012 at 6:06 PM, James Black wrote:

> You may want to ask this on stackoverflow, but, more importantly, DOM
> takes up more memory for the XML file, so why use that on a mobile device
> with less memory?


> Do you have a business need to prefer DOM over just processing the file?
>  If not, then you may want to rethink what you are asking about.
>

Well, my XML files are going to be varied but small in size, so memory
shouldn't be a problem.

I was wondering about the availability of good tutorials on Java XML DOM
though.

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] android and XML

2012-01-15 Thread John Goche
Hello,

I have been reading up on how to use XML from within android. Apparently
the interfaces are SAX which allows callbacks to be called when each element
is processed, DOM which allows in-memory tree representations of XML, JAXP
which can be used to validate XML given an XML Schema, and JAXB which is
available but takes up 8MB or so of space and would be used to convert back
and forth between XML and some annotated Java classes automatically at the
aforementioned disk storage price. Apparently JAXB used to be used to
validate
but since JAXB 2.0 that function has been delegate to JAXB. Apparently there
are three DOM levels, and Android's JDK supports level 2:

http://developer.android.com/reference/org/w3c/dom/package-summary.html

plus the load/store facilities available in DOM Level 3 which AFAIK are
used to
serialize/deserialize XML instances to and from memory?

http://developer.android.com/reference/org/w3c/dom/ls/package-summary.html

Then there are a variety of other XML APIs which do not come with Android
the
most nototrious being xerces from apache foundation which used to not be
bundled with jdk. Since jdk 5 it is, but apparently people don't use it
because
java has its own DOM API. Why would you want to use it when java bundles
a DOM API already. What more can xerces offer? And what more does the
full xerces implementation offer if you were to add the xerces jar file to
your APK?

Anyways, in the end I decided I am going to use DOM to read my files and
simply
throw an exception if what I receive does not conform to what I expect. I
also want
to build my XML files with DOM prior to sending the XML over a network.

I'm not clear on the following: where do I find good docs on DOM for
Android. Is
the API all there is available? Several books such as the following:

http://www.amazon.com/Java-XML-Brett-McLaughlin/dp/059610149X/ref=sr_1_1?ie=UTF8&qid=1326644460&sr=8-1

seem to be somewhat obsolete and document xerces or obsolete APIs/issues
(such as org.apache.xerces.parsers.DOMParser
which now seems to be replaced with:

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;

Anyways, any pointers to tutorials on using DOM on Android to process and
build XML using DOM welcome.
One useful link I found was the following:
http://www.mkyong.com/java/how-to-read-xml-file-in-java-dom-parser/

Thanks for your input,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] shared folders in eclipse

2012-01-09 Thread John Goche
Hello,

I notice that when I generate a C2DM project in android there is
a "shared folder" (the Foo-Android directory is a reference to the
Foo-AppEngine directory). How can I create my own shared folder
between two arbitrary  applications of my own in eclipse? Someone
in the past mentioned creating a library, is that the way? Exactly what
are the required steps to achieve the desired effect?

Best Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: newbie: error deploying C2DM web application

2012-01-09 Thread John Goche
I found the problem,

I had to right-click on my App Engine project -> Google -> App Engine
Settings ...

and change the capitalization of my project's name. For some reason the
framework

placed the same name there as the name I gave my eclipse project rather
than the

name I registered with the server.

Still cannot get the emulator to work though. I had to C2DM from a physical
phone.

Regards,

John Goche

On Mon, Jan 9, 2012 at 4:17 PM, John Goche wrote:

>
> Hello,
>
> I have created and registered an application by the imaginative name
> called FooBarAkAFoobar.
> I have registered it under my email account and created a C2DM
> application in eclipse by going
> to FIle -> New -> Other -> Android -> App Engine Connected Android
> Project
>
> When I try to deploy the web application I get the following error:
>
>
> ---
>
> Unable to update:
>
> com.google.appengine.tools.admin.HttpIoException: Error posting to
> URL:
> https://appengine.google.com/api/appversion/getresourcelimits?app_id=FooBarAKAFoobar&version=1&;
> 400 Bad Request
>
> Client Error (400)
> The request is invalid for an unspecified reason.
>
>
>at
>
> com.google.appengine.tools.admin.AbstractServerConnection.send1(AbstractServerConnection.java:
> 282)
>
>at
>
> com.google.appengine.tools.admin.AbstractServerConnection.send(AbstractServerConnection.java:
> 235)
>
>at
>
> com.google.appengine.tools.admin.AbstractServerConnection.post(AbstractServerConnection.java:
> 214)
>
>at
>
> com.google.appengine.tools.admin.ResourceLimits.remoteRequest(ResourceLimits.java:
> 160)
>
>at
>
> com.google.appengine.tools.admin.ResourceLimits.request(ResourceLimits.java:
> 127)
>
>at
> com.google.appengine.tools.admin.AppAdminImpl.doUpdate(AppAdminImpl.java:
> 323)
>
>at
> com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:
> 52)
>
>at
>
> com.google.appengine.eclipse.core.proxy.AppEngineBridgeImpl.deploy(AppEngineBridgeImpl.java:
> 400)
>
>at
>
> com.google.appengine.eclipse.core.deploy.DeployProjectJob.runInWorkspace(DeployProjectJob.java:
> 148)
>
>at
>
> org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:
> 38)
>
>at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
>
>
> ---
>
> What am I doing wrong,
>
> I have successfully registered for C2DM overnight and would like to
> try it out!
>
> Thanks,
>
> John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] C2DM: cannot register account on emulator

2012-01-09 Thread John Goche
Hello,

I know there are several posts lurking around on this
which state that the appropriate google packages need
to be installed in android sdk and avd manager but
where do I get these from?

In the emulator when I try to add my account I get the
error message "Setup could not finish" "Unable to open
connection to server."

I entered my username and password under "Add an
Exchange account".

I am using the 2.3.3 emulator (which is post 2.2 hence
should work, but does not).

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] C2DM sample code: unable to deploy

2012-01-09 Thread John Goche
Hello,

Has anyone been able to deploy an android
C2DM web application as generated from eclipse?

I am getting the following error during deployment:

-

Unable to update:

com.google.appengine.tools.admin.HttpIoException: Error posting to URL:
https://appengine.google.com/api/appversion/getresourcelimits?app_id=FooBarAKAFoobar&version=1&;
400 Bad Request

Client Error (400)
The request is invalid for an unspecified reason.


at
com.google.appengine.tools.admin.AbstractServerConnection.send1(AbstractServerConnection.java:282)

at
com.google.appengine.tools.admin.AbstractServerConnection.send(AbstractServerConnection.java:235)

at
com.google.appengine.tools.admin.AbstractServerConnection.post(AbstractServerConnection.java:214)

at
com.google.appengine.tools.admin.ResourceLimits.remoteRequest(ResourceLimits.java:160)

at
com.google.appengine.tools.admin.ResourceLimits.request(ResourceLimits.java:127)

at
com.google.appengine.tools.admin.AppAdminImpl.doUpdate(AppAdminImpl.java:323)

at
com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:52)

at
com.google.appengine.eclipse.core.proxy.AppEngineBridgeImpl.deploy(AppEngineBridgeImpl.java:400)

at
com.google.appengine.eclipse.core.deploy.DeployProjectJob.runInWorkspace(DeployProjectJob.java:148)

at
org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)

at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Google App Engine and Users API and android

2012-01-08 Thread John Goche
On Sat, Jan 7, 2012 at 6:04 PM, John Goche wrote:

>
> Hi Nikolay,
>
> On Sat, Jan 7, 2012 at 5:39 PM, Nikolay Elenkov  > wrote:
>
>> On Sun, Jan 8, 2012 at 1:32 AM, John Goche 
>> wrote:
>>
>> >
>> > Now that you have mentioned AccountManager I have found the following
>> site:
>> >
>> > http://gnuc.in/resources/archives/1404
>> >
>> > I don't know much of what this token is or what it is for.
>>
>
Chapter 15 of the following book mentions the AccountManager:

http://www.amazon.com/Android-Action-Frank-Ableson/dp/1617290505/ref=sr_1_2?ie=UTF8&qid=1325965851&sr=8-2

Basically android can store information from various accounts including
usernames, passords, and auth tokens which
are used so that a user does not have to login again and again (although
these auth tokens can expire depending on
what service they are used to connect to). The book explores authenticating
to LinkedIn from android. The examples
seem to use some OAuth variables with an API specific to LinkedIn. Not sure
how much of this stuff applies to what
I am trying to do. Here the code goes: AccountManager am =
AccountManager.get(ctx); String authToken
= am.getUserData(account, LinkedIn.AUTH_TOKEN); String authTokenSecret =
am.getUserData(account,
LinkedIn.AUTH_TOKEN_SECRET); etc...

Apparently the AccountManager can present an activity to the user where the
user can enter credentials?
Presumably I can use this activity rather than making up my own?

Most references to AccountManager I find in the literature have to do with
the Contacts API since each
contact is tied to an account, such as Chapter 27 of Pro Android
3<http://www.amazon.com/Pro-Android-3-Satya-Komatineni/dp/1430232226/ref=sr_1_1?ie=UTF8&qid=1325968609&sr=8-1>does
an AccountManager.get(ctx).getAccounts()
and iterates through them printing ac.name and ac.type.

There seem to be no books that describe the subject and all of the
information pertaining authenticating to google
accounts for using app engine seems to be on the web.

Interestingly enough, when a user configures an android phone the user is
asked for the credentials of a google account,
although the user may later enter other accounts as well. So assuming the
user has only one google account the following
code may work to retrieve the account:

AccountManager mgr = AccountManager.get(this);
Account[] accts = mgr.getAccountsByType("com.google");
Account acct = accts[0];

and then

mgr.getAuthToken(acct, "android", null, this, null, null);

to retrieve the token?

Anyways, now instead of having the user specify a username and
password for google accounts, I now hoave the user specify an
account. I will keep on reading http://gnuc.in/resources/archives/1404
and see if I can make more sense of it, it's quite a lot of info to digest
but well written it seems, but

right now I am not understanding the presumably Java syntax:

public static void setAuthCookie()
{
Auth.background()
{
@Override
public void run()
{
  ...
}
});
}

What is Auth.background()?

Can someone please explain the Auth.background()
syntax? I'm not familiar with it.

Any feedback sincerely appreciated,

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] AERC library: questions

2012-01-08 Thread John Goche
Hello,

I am trying to follow the code from

http://www.tbray.org/ongoing/When/201x/2011/09/29/AERC

I have obtained the library with:

$ git clone http://code.google.com/p/aerc/

but I cannot make out what the difference is between the following two
variables:

App.ROOT_URI
App.ROOT_URI and App.SECRET_URI

These are java.net.URL instances but I cannot figure out why they would
have to differ in value.

After adding the following   
   and
fixing the code
that uses the library I get the following error message:

Checkin failed: Authentication failed:
Authentication failed: No network connection

but my wi-fi is on and working. I did see the screen prompting me to use my
account credentials the first
time but not thereafter.

Any ideas why it is failing?


package com.foo.appenginetest;

import java.net.URL;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Activity;
import android.app.IntentService;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.TextView;

class App {

  static URL ROOT_URI = null;
  static URL SECRET_URI = null;

}

public class AppEngineTestActivity extends Activity {

  private Activity activity;
  private Activity mActivity;

  public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

try {
App.SECRET_URI = App.ROOT_URI = new URL("http://hellodata.appspot.com";);
} catch (Exception e) {}
setContentView(R.layout.main);
mActivity = activity = this;
(new Worker()).execute();
  }

  private class Worker extends AsyncTask {

AppEngineClient client;

protected Response doInBackground(Void... params) {
  AccountManager manager = AccountManager.get(activity);
  Account[] accounts = manager.getAccountsByType("com.google");
  client = new AppEngineClient(App.ROOT_URI, accounts[0], activity);
  return client.get(App.SECRET_URI, null);
}

protected void onPostExecute(Response response) {
  TextView text = (TextView) activity.findViewById(R.id.text);
  if (response == null)
text.setText("Checkin failed: " + client.errorMessage());
  else if ((response.status / 100) != 2)
text.setText("Checkin failed: " + new String(response.body));
  else
text.setText("The secret is: " + new String(response.body));
}

  }

  class PrepareUpload extends AsyncTask {

URL APP_URI = App.ROOT_URI;
String mErrorMessage = null;
// ...
@Override
protected String doInBackground(Void... params) {

  AccountManager manager = AccountManager.get(activity);
  Account[] accounts = manager.getAccountsByType("com.google");
  Account account = accounts[0];

  // ...
  Authenticator authent =
Authenticator.appEngineAuthenticator(mActivity, account, APP_URI);
  String authToken = authent.token();
  if (authToken == null)
mErrorMessage = authent.errorMessage();
  return authToken;

}

@Override
protected void onPostExecute(String authToken) {
  // ...
  if (authToken != null) {
Intent intent = new Intent(mActivity, UploadService.class);
intent.putExtra("authtoken", authToken); startService(intent);
  }
}
  }

  public class UploadService extends IntentService {

public UploadService() {

  super(null);

}

URL APP_URI = App.ROOT_URI;

// ...
@Override
protected void onHandleIntent(Intent intent) {
  String authToken = intent.getStringExtra("authtoken");
  AppEngineClient client = new AppEngineClient(APP_URI, authToken,
this);
  // ...
}
private void transmit(String body, AppEngineClient client, URL target) {
  //Response response = client.post(target, null, body.toByteArray());
  Response response = client.post(target, null, body.getBytes());
  if (response == null) error(client.errorMessage());
  if ((response.status / 100) != 2)
error(getString(R.string.upload_failed) + response.status);
}

private void error(String foo) { System.out.println(foo); }
  }

}

App.ROOT_URI

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Google App Engine and Users API and android

2012-01-08 Thread John Goche
I also found these links:

http://code.google.com/android/c2dm/

http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html

Not sure whether the latter link is relevant.

Also not sure what the difference between using C2DM and using the Channel
API is.

And not sure why the google accounts authentication method is not mentioned
on the
following page:
http://code.google.com/apis/accounts/docs/GettingStarted.html

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Google App Engine and Users API and android

2012-01-08 Thread John Goche
Thanks for the link, I didn't realize that the eclipse plugin

http://dl.google.com/eclipse/plugin/3.7

which I am using has a feature whereby you can

File -> New -> Other -> Android -> App Engine Connected Android Project

The video discusses RPC (remote procedure calls) and C2DM (cloud 2 device
messaging).

C2DM seems interesting as it allows the server to notify a device when some
data needs to
be pushed to a device. I wonder what would happen if a device was ofline
when C2DM kicked in.

To be honest much of the video was over my head, but I'm going to try and
have a look at that too.
I got the following URLs out of the video (shown towards the end):

http://bigdaddy-io.appspot.com/
http://code.google.com/p/cloud-tasks-io
http://cloudtasks-io.appspot.com/ <http://cloudtasksio.appspot.com/>

I'm going to have a look at these too,

Regards,

John Goche

On Sun, Jan 8, 2012 at 5:38 PM, Nikolay Elenkov
wrote:

> On Mon, Jan 9, 2012 at 1:18 AM, Kostya Vasilyev 
> wrote:
> >
> > Google I/O 2011: Android + App Engine: A Developer's Dream Combination
> >
> > The video covers this plugin for Eclipse:
> >
> > http://code.google.com/eclipse/
> >
> > ... which makes it very easy to create Andorid apps that talk to a GAE
> > backend, complete with device-to-GAE authentication and C2DM.
> >
>
> Completely forgot about this one. This is actually using a GWT endpoint
> on GAE, so you can't have multiple versions of an API and it's not very
> flexible, but should work for a quick start. If you don't want to use GWT
> RPC, you can't use this.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Google App Engine and Users API and android

2012-01-08 Thread John Goche
On Sun, Jan 8, 2012 at 3:20 PM, Nikolay Elenkov
wrote:

> On Sun, Jan 8, 2012 at 9:24 PM, John Goche 
> wrote:
> >
> > Hello,
> >
> > I am still trying to authenticate to app engine using  google accounts
> > and would like to figure out the details of how such authenticator works.
> > How do I detect in my servlet that the user has authenticated with
> > google accounts?
>
> Read the App Engine documentation first. Then start searching for
> random examples.
>

Hi, the relevant App Engine documentation on the server side seems to be
this one
for the Users service (nothing specific to android on the client side here):

http://code.google.com/appengine/docs/java/gettingstarted/usingusers.html

As I mentioned there is this site also from google:

http://code.google.com/p/google-api-java-client/wiki/AndroidAccountManager

I tried running the code with some modifications as follows but I get the
following
error message when I try to run the code on a device (on the emulator it
works
but there are no accounts):

[2012-01-08 15:25:26 - ComNet] Starting activity
com.foobar.hello.StockActivity on device 80A358189040054719
[2012-01-08 15:25:27 - ComNet] ActivityManager: Starting: Intent {
act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
cmp=com.foobar.hello/.StockActivity }
[2012-01-08 15:25:27 - ComNet] ActivityManager:
java.lang.SecurityException: Permission Denial: starting Intent {
act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
flg=0x1000 cmp=com.foobar.hello/.StockActivity } from null (pid=9825,
uid=2000) requires null

Not sure what I need to do to get rid of it...

  
  

  @Override
  public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//...
gotAccount(false);
  }

  static final int DIALOG_ACCOUNTS = 0;

  @Override
  protected Dialog onCreateDialog(int id) {
switch (id) {
  case DIALOG_ACCOUNTS:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Select a Google account");
final AccountManager manager = AccountManager.get(this);
final Account[] accounts = manager.getAccountsByType("com.google");
final int size = accounts.length;
String[] names = new String[size];
for (int i = 0; i < size; i++) {
  names[i] = accounts[i].name;
}
builder.setItems(names, new DialogInterface.OnClickListener() {
  public void onClick(DialogInterface dialog, int which) {
gotAccount(manager, accounts[which]);
  }
});
return builder.create();
}
return null;
  }

  static String PREF = "pref";

  private void gotAccount(boolean tokenExpired) {
SharedPreferences settings = getSharedPreferences(PREF, 0);
String accountName = settings.getString("accountName", null);
if (accountName != null) {
  AccountManager manager = AccountManager.get(this);
  Account[] accounts = manager.getAccountsByType("com.google");
  int size = accounts.length;
  for (int i = 0; i < size; i++) {
Account account = accounts[i];
if (accountName.equals(account.name)) {
  if (tokenExpired) {
manager.invalidateAuthToken("com.google", this.authToken);
  }
  gotAccount(manager, account);
  return;
}
  }
}
showDialog(DIALOG_ACCOUNTS);
  }

  private String AUTH_TOKEN_TYPE = "ah";

  private void gotAccount(final AccountManager manager, final Account
account) {
SharedPreferences settings = getSharedPreferences(PREF, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("accountName", account.name);
editor.commit();
new Thread() {

  @Override
  public void run() {
try {
  final Bundle bundle =
  manager.getAuthToken(account, AUTH_TOKEN_TYPE, true, null,
null)
  .getResult();
  runOnUiThread(new Runnable() {

public void run() {
  try {
if (bundle.containsKey(AccountManager.KEY_INTENT)) {
  Intent intent =
  bundle.getParcelable(AccountManager.KEY_INTENT);
  int flags = intent.getFlags();
  flags &= ~Intent.FLAG_ACTIVITY_NEW_TASK;
  intent.setFlags(flags);
  startActivityForResult(intent, REQUEST_AUTHENTICATE);
} else if
(bundle.containsKey(AccountManager.KEY_AUTHTOKEN)) {
  authenticatedClientLogin(
  bundle.getString(AccountManager.KEY_AUTHTOKEN));
}
  } catch (Exception e) {
handleException(e);
  }
}
  });
} catch (Exception e) {
  handleException(e);
}
  }
}.st

Re: [android-developers] Google App Engine and Users API and android

2012-01-08 Thread John Goche
Hello,

I am still trying to authenticate to app engine using  google accounts
and would like to figure out the details of how such authenticator works.
How do I detect in my servlet that the user has authenticated with
google accounts?

First of all there is the following link to the AccountManager API:

http://developer.android.com/reference/android/accounts/AccountManager.html

This code for picasa web seems to be one of the
few instances of sample code available:

http://code.google.com/p/google-api-java-client/wiki/AndroidAccountManager

So I need to figure out the ins and outs of the
google accounts authenticator and how to integrate it with android.

I found these links:

http://stackoverflow.com/questions/7587891/list-google-apps-accounts (this
is one of many links that shows how to access the account manager accounts,
the easy part)

http://code.google.com/apis/accounts/docs/OpenID.html (I think this is
something else)
http://stackoverflow.com/questions/7961686/which-authentication-method-is-better-for-dealing-with-google-api-and-google-acc(using
accounts manager seems to be the better choice)

http://stackoverflow.com/questions/3492775/is-there-an-official-way-to-authenticate-for-google-data-api-on-android-using-ac

I must admit I am having some trouble adapting the sample code to my case.
In particular I don't know what to pass as the
second argument for the string to getAuthToekn().

http://developer.android.com/reference/android/accounts/AccountManager.html#getAuthToken%28android.accounts.Account,%20java.lang.String,%20boolean,%20android.accounts.AccountManagerCallback%3Candroid.os.Bundle%3E,%20android.os.Handler%29

Apparently OAuth is used for authentication...

http://stackoverflow.com/questions/7699149/how-is-the-user-authentication-with-google-accounts-working-inside-the-gae-techn

http://stackoverflow.com/questions/3067780/google-auth-using-token

Here is an example that uses "ah" as the string parameter to getAuthToken.
Is this what I use?

http://stackoverflow.com/questions/6283096/android-getauthtoken-returning-null-dont-know-why

Any help sincerely appreciated, I'm really stuck on this one.

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Google App Engine and Users API and android

2012-01-07 Thread John Goche
Hi Nikolay,

On Sat, Jan 7, 2012 at 5:39 PM, Nikolay Elenkov
wrote:

> On Sun, Jan 8, 2012 at 1:32 AM, John Goche 
> wrote:
>
> >
> > Now that you have mentioned AccountManager I have found the following
> site:
> >
> > http://gnuc.in/resources/archives/1404
> >
> > I don't know much of what this token is or what it is for.
>
> You should read up on it.
>

Where???


>
> > At the moment I
> > am not
> > authenticating users which is a big problem. I appreciate any more
> pointers.
> > BTW, if I wanted to use OpenID instead of Google accounts would there be
> > much to change?
>
> Why do you think OpenID is better for your case? Google accounts
> auth works OTB, you'll need to do more work for OpenID.
>

OK so maybe scrap OpenID. I will simply use Google accounts.
The bad part about google is that I've heared its servers are slow
in China, but then probably so would app engine.

To get pointers, you need to give more details: what are
> you trying to do? Why? How many users? etc.
>

Well, what I need to do is the following. A user connects to appspot.com
site and authenticates. The user then creates a "group". The user is the
admin for that group. The user can add other users to the group by
simply entering their email addresses. These can then connect and
join the group by entering their credentials. Once connected users
of a group may share information.

This is what I am trying to do.

Pointers welcome,

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Google App Engine and Users API and android

2012-01-07 Thread John Goche
On Sat, Jan 7, 2012 at 5:14 PM, Nikolay Elenkov
wrote:

> On Sun, Jan 8, 2012 at 1:08 AM, John Goche 
> wrote:
>
> > I am using google App Engine. I need my users to authenticate
> > prior to being able to access the JDO objects on my servlet. Once
> > authenticated I need to match their usernames with fields in my
> > JDO POJOs to see whether they can perform certain operations
> > or not. How can I achieve this? I'm somewhat lost because all
> > the examples I am finding are not android specific.
> >
>
> There is not much Android-specific about this. If you are using
> Google accounts for authentication, you can use the AccountManager
> on Android to get an access token (there are examples on how to this).
> If not, there is nothing Android specific -- just have them send the
> username and password, token, etc. over SSL, authenticate, do your
> thing on the server side.
>
> So, how are you authenticating users?
>

Hi Nikolay,

Now that you have mentioned AccountManager I have found the following site:

http://gnuc.in/resources/archives/1404

I don't know much of what this token is or what it is for. At the moment I
am not
authenticating users which is a big problem. I appreciate any more pointers.
BTW, if I wanted to use OpenID instead of Google accounts would there be
much to change?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Google App Engine and Users API and android

2012-01-07 Thread John Goche
Hello,

I am using google App Engine. I need my users to authenticate
prior to being able to access the JDO objects on my servlet. Once
authenticated I need to match their usernames with fields in my
JDO POJOs to see whether they can perform certain operations
or not. How can I achieve this? I'm somewhat lost because all
the examples I am finding are not android specific.

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: uploading to the "google cloud" service

2011-12-29 Thread John Goche
Hi Studio!

What a great service this appengine seems to be. Just a shame that MySQL
is not going to be available for free it seems, so that users will have to
stick
with Java Persistence APIs and Java Data Objects (JPA and JDO) in order
to save their data.

The other thing I was wondering was, if I write an android application to
use
appengine and my phone has a web browser, what would make me want to
deploy the service as a data connection to my android application when I
could
just deploy a web service that does the same thing? The only difference I
see
is that the web has a set of UI widgets, and android UI has another but very
similar API, but allowing access from a web browser seems more flexible
because it means PCs can access it as well.

Also, people who use the application I am planning to design will want to
associate themselves into groups with each group of people having their
own private data space on the web server. How do I cater to the creation
of such groups? Do I get them to register a name on my servlet and
configure a password for them to share? What strategy should I use?

Plus, if my users exceed the quota I will have to charge them. Do I
configure
in-app billing for this or how do I tackle this issue. The space and
bandwith
offered seems copious on one hand and on the other hand perhaps not.

Thanks for all your suggestions,

John Goche

P.S. Studio, you mentioned doing much work with databases and the web in
some of your past emails, do you prefer managing your own servers or using
Google's App Engine? Please share you experience.

Best Regards,

John Goche

On Wed, Dec 28, 2011 at 10:18 PM, Studio LFP  wrote:

> You may be thinking about Google App Engine.
>
> https://appengine.google.com
>
> There is a free option with a set quota that you can pay to increase.
>
> Steven
> Studio LFP
> http://www.studio-lfp.com
>
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: uploading to the "google cloud" service

2011-12-28 Thread John Goche
Thank you for your reply,

However I see the following note on the page you posted:

"The backup service is *not* designed for synchronizing application data
with other clients"

So it seems the only way to sync application data is to deploy one's own
server software
and hope the user is willing to install it?

Thanks,

John Goche


On Wed, Dec 28, 2011 at 6:49 PM, havexz  wrote:

> BTW ...reading your question again...looks like you are looking for
> Backing up App Data and then restoring it on different device.
>
> So this is what I think you want:
>
> http://developer.android.com/guide/topics/data/backup.html
>
> On Dec 28, 5:29 am, John Goche  wrote:
> > Thanks Bali,
> >
> > However it seems you still have to have a server out there
> > to be able to use C2DM. I was wondering whether the server
> > that talks to the C2DM server can also be hosted by google
> > somewhere so you don't have to pay the fees to set up a
> > dedicated server and use google as a data store instead/
> > database backend.
> >
> > Thanks,
> >
> > John Goche
> >
> >
> >
> >
> >
> >
> >
> > On Wed, Dec 28, 2011 at 1:27 AM, havexz  wrote:
> > > Looks like this is what you looking for:
> >
> > >http://android-developers.blogspot.com/2010/05/android-cloud-to-devic.
> ..
> >
> > > On Dec 27, 5:36 pm, John Goche  wrote:
> > > > Hello,
> >
> > > > I remember reading somewhere that it is possible for an
> > > > application to connect to a free google server to upload
> > > > application data which may then be downloaded from
> > > > other mobile clients, but I cannot remember the name
> > > > of the API for such a google server. Can someone
> > > > please point me to the right place?
> > > > I just cannot find the reference.
> >
> > > > Thanks,
> >
> > > > John Goche
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] clarification: SD card

2011-12-28 Thread John Goche
Hello,

This may sound like a stupid question but when in the android literature
external storage or the SD card is mentioned is the literature actually
referring to the SIM (Subscriber Identity Module) card which also stores
the phone's phone number? I don't see any other detatchable "external"
pieces on my smartphone. Anyone know what the capacity of such a
storage location is in MB?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: uploading to the "google cloud" service

2011-12-28 Thread John Goche
Thanks Bali,

However it seems you still have to have a server out there
to be able to use C2DM. I was wondering whether the server
that talks to the C2DM server can also be hosted by google
somewhere so you don't have to pay the fees to set up a
dedicated server and use google as a data store instead/
database backend.

Thanks,

John Goche


On Wed, Dec 28, 2011 at 1:27 AM, havexz  wrote:

> Looks like this is what you looking for:
>
>
> http://android-developers.blogspot.com/2010/05/android-cloud-to-device-messaging.html
>
>
> On Dec 27, 5:36 pm, John Goche  wrote:
> > Hello,
> >
> > I remember reading somewhere that it is possible for an
> > application to connect to a free google server to upload
> > application data which may then be downloaded from
> > other mobile clients, but I cannot remember the name
> > of the API for such a google server. Can someone
> > please point me to the right place?
> > I just cannot find the reference.
> >
> > Thanks,
> >
> > John Goche
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] uploading to the "google cloud" service

2011-12-27 Thread John Goche
Hello,

I remember reading somewhere that it is possible for an
application to connect to a free google server to upload
application data which may then be downloaded from
other mobile clients, but I cannot remember the name
of the API for such a google server. Can someone
please point me to the right place?
I just cannot find the reference.

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] sending a backup file to the cloud

2011-12-27 Thread John Goche
Hello,

I have an application which saves important data to disk.
I would like to allow the user to backup the data by emailing
themselves the data. For this I need to open up a web browser
activity from within the application and allow the user to browse
the file system for the attachment (how else would I transfer the
data from a file in the application's sandbox to a user specified
server (such as a google mail server) on the web. Can someone
please offer some suggestions on how to achieve this operation
of "transfering data from the phone to a backup file in the cloud".

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] publishing two versions of same application

2011-12-27 Thread John Goche
On Tue, Dec 27, 2011 at 4:43 PM, TreKing  wrote:

>
> Yes, but an Android Library Project will help consolidate the common code.
>

OK, so how do I set up an android library project then. Having to maintain
two separate source trees for every single application seems to be a pain.

Please share your approach with us, I am very willing to learn what the
alternatives may be,

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] publishing two versions of same application

2011-12-27 Thread John Goche
Hello,

I have an application which I would like to publish as a free version
and then another with some extra features as a paid version. I was
wondering, if my package name is com.bar.foo and my application
name if com.bar.foo do I need to make a separate com.bar.foolite
application name for the free version or can I keep publish both
application under both reverse FQDNs.

Also, do I need to make two separate packages for them in eclipse
or is there a way I can keep both under one directory somehow?

Thanks for your comments and feedback,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] runtime error: com.android.internal.os.LoggingPrintStream.println

2011-12-26 Thread John Goche
Hello,

I have run across the following strange error message. From within an
button's on click
listener I call System.out.println(Foo.bar) so as to debug my program and
get the following
error message:

D/AndroidRuntime( 2313): Shutting down VM

W/dalvikvm( 2313): threadid=1: thread exiting with uncaught exception
(group=0x40015560)

E/AndroidRuntime( 2313): FATAL EXCEPTION: main

E/AndroidRuntime( 2313): java.lang.NullPointerException

E/AndroidRuntime( 2313): at
com.android.internal.os.LoggingPrintStream.println(LoggingPrintStream.java:298)

Anyone know what this is all about?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] issue with conditionally choosing first activity to be displayed

2011-12-24 Thread John Goche
Thank you all for your replies, they were really helpful.
I think I am going to launch an intent just before calling
setContentView() the first time the application starts up
followed by finish(), and call setContentView() all other
times.

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] issue with conditionally choosing first activity to be displayed

2011-12-23 Thread John Goche
Hello,

I am having the following issue. In my application I need to display
activity A the first time the application is launched so that the user
can configure some parameters on a form. When the user completes
the form a preference is set so that every other time the user starts
the application the application starts directly with activity B.

Now I am having some trouble coding this behavior because the
android manifest file does not seem to allow for this conditional
launching. It is always the same activity which seems must be
launched first.

How can I solve this issue? I hope I have explained the problem
clearly. Any help would be sincerely appreciated.

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] uploading and downloading files from email

2011-12-12 Thread John Goche
On Mon, Dec 12, 2011 at 10:37 PM, TreKing  wrote:

> On Mon, Dec 12, 2011 at 12:21 PM, John Goche 
> wrote:
>
>> I would like to know whether it is possible to invoke a web browser
>> in such a way so as to pass it an attachment and then also in another
>> application open a web browser and download an attachment to an
>> android application so that the application can read the attachment?
>>
>
> That doesn't make a ton of sense: browsers don't take "attachments".
> Besides that, uou have no control over what browser the user is using or
> what intents it responds to.
>
> In your app you can certainly point to any server and upload / download
> what you need, assuming you have appropriate permission.
>

Hi TreKing,

Sorry if I have not been clear but I need to allow the user to attach a
file from an email application in a web browser.
Maybe I can save the file from my app to external storage (SD card or such)
and have the user open it from there in a web browser session?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] uploading and downloading files from email

2011-12-12 Thread John Goche
Hello,

I would like to know whether it is possible to invoke a web browser
in such a way so as to pass it an attachment and then also in another
application open a web browser and download an attachment to an
android application so that the application can read the attachment?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] ListView entries question: dynamically changing to EditText

2011-12-12 Thread John Goche
Hello,

Is it possible to code a ListView in such a way that when a user
clicks on one of its TextView entries it turns into an EditText which
allows the user to enter text?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] ImageButton: changing image and background simultaneously

2011-12-12 Thread John Goche
Hello,

I am facing the following problem. I have a column of ImageButtons.
When the button changes state because the user presses the button
I need the both the button image and the button background to change.
However at the following site I don't see how to change the background
of the ImageButton when the user presses it.

http://developer.android.com/reference/android/widget/ImageButton.html

Changing the background is important because I need the image to fade
into the background, and since different phones have different screen
heights,
I cannot make the image the same size as the button, I need the button to
change size and leave the image size fixed.

The ImageButton background must match the image background, but I don't
see how to do this in the XML.

Instead of just:

 
 http://schemas.android.com/apk/res/android";>
  
  
  
 


I would like to specify the background property as well such as:

 
 http://schemas.android.com/apk/res/android";>
  
  
  
 


I was wondering whether it is legal to specify any property pertaining
to the ImageButton in its selector (such as the button's background
color rather than just the image). Any ideas on how to elegantly solve
the problem of having an ImageButton's background and image
change simultaneously when unpressed/pressed/selected?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: splash screen

2011-12-10 Thread John Goche
At last I was able to find this example...

http://www.wglxy.com/android-tutorials/splash-screen-demo-app-for-android

and code the following, which seems to work for a splash screen with
AsyncTask:

public class GameActivity extends Activity {

  private Panel panel = null;

  class SplashTask extends AsyncTask {

GameActivity gameActivity;

SplashTask(GameActivity gameActivity) {

  this.gameActivity = gameActivity;

}

@Override
protected Void doInBackground(Void... params) {

  Looper.prepare();

  this.gameActivity.panel = new Panel(gameActivity);

  return null;

}

@Override
protected void onPostExecute(Void params) {

  setContentView(this.gameActivity.panel);

}

  }

  class Panel extends SurfaceView implements SurfaceHolder.Callback {

Context context;

public Panel(Context context) {

  super(context);

  this.context = context;

[...snip...]

  @Override
  public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

requestWindowFeature(Window.FEATURE_NO_TITLE);

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

setVolumeControlStream(AudioManager.STREAM_MUSIC);

// panel = new Panel(this);

// setContentView(panel);

setContentView(R.layout.splash);

new SplashTask(this).execute();

PowerManager powerManager = (PowerManager)
getSystemService(Context.POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, TAG);

wakeLock.acquire();

  }

And yes, also in my manifest file:

http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: splash screen

2011-12-10 Thread John Goche
The site
http://android-developers.blogspot.com/2009/05/painless-threading.html
by Romain Guy suggests taking a look at the Shelves application accessible
via
subversion to learn about AsyncTask. However when I do a

$ svn checkout http://shelves.googlecode.com/svn/trunk/ shelves-read-only

there are a lot of classes named *Task which look similar to AsyncTask but
which do not derive from it, for example:

 * Here is an example of subclassing:
 * 
 * private class DownloadFilesTask extends UserTask<URL, Integer,
Long> {
 * public File doInBackground(URL... urls) {
 * int count = urls.length;
 * long totalSize = 0;
 * for (int i = 0; i < count; i++) {
 * totalSize += Downloader.downloadFile(urls[i]);
 * publishProgress((int) ((i / (float) count) * 100));
 * }
 * }
 *
 * public void onProgressUpdate(Integer... progress) {
 * setProgressPercent(progress[0]);
 * }
 *
 * public void onPostExecute(Long result) {
 * showDialog("Downloaded " + result + " bytes");
 * }
 * }
 * 

Here I see the familar names doInBackground() and onProgress(Update()
nad onPostExecute(). What's the relationship between this code and the
official AsyncTask code from google if any?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: splash screen

2011-12-10 Thread John Goche
> On Wed, Dec 7, 2011 at 10:18 PM, rich friedel wrote:
>
> Yeah, create an 
> AsyncTask<http://developer.android.com/reference/android/os/AsyncTask.html>and
>  do your loading/building stuff in that.
> You can even post a "message" back for the dialog in the
onProgressUpdate()<http://developer.android.com/reference/android/os/AsyncTask.html#onProgressUpdate%28Progress...%29>
.
> When it is done 
> onPostExecute()<http://developer.android.com/reference/android/os/AsyncTask.html#onPostExecute%28Result%29>will
>  be called where you can call your startActivity(Intent).
> I will warn you though, use due diligence when implementing AsyncTask:
>
https://www.google.com/#hl=en&q=android+development+asynctask+crash+when+rotating+screen
> if you destroy the activity that the AsyncTask is tied to then recreate
it (as in a screen rotation) the
> AsyncTask won't know what to do and throw an exception.

Hello all,

Sorry for bringing up this topic again but I haven't figured out how to do
it (yet).
As mentioned I am trying to make a splash screen for an application. The
reason
I need the splash screen is my app is taking a long time to load. I want
the splash
screen to be displayed until the images and sounds are finished loading,
and when
the main menu is ready to be displayed I want the splash screen to go that
very moment
without any further delays. So, I am not sure what way to go with all this
information to
digest and not so sure which path to take or how each path works. Perhaps
someone
could give me some help in understanding the best solution for my use case
and why it works?

Thanks a lot,

John Goche

(here is what I've found so far...)

--

http://stackoverflow.com/questions/3536590/android-splash-screen-loading-screen

I've had a look at this example but it seems it just waits three seconds
and then ditches the splash screen for the main application. In my case
different phones will take different amount of time which I do not know.
Basically I need to display the splash screen while the images and sounds
load up. When done I need to display my application.

http://www.androidpeople.com/android-loading-welcome-splash-spash-screen-example

--

Then I found this post stating that an AsyncTask can be used:

http://stackoverflow.com/questions/1596947/android-application-loading-screen

http://developer.android.com/reference/android/os/AsyncTask.html

--

Then I found the code at:

http://www.barebonescoder.com/2010/04/a-simple-android-splash-screen/

public class SplashScreen extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.splash);
  Thread splashThread = new Thread() {
 @Override
 public void run() {
try {
   int waited = 0;
   while (waited < 5000) {
  sleep(100);
  waited += 100;
   }
} catch (InterruptedException e) {
   // do nothing
} finally {
   finish();
   Intent i = new Intent();
   i.setClassName("com.testing.splashscreensample",
  "com.testing.splashscreensample.mainmenu");
   startActivity(i);
}
 }
  };
  splashThread.start();
   }
}

but I am not clear on what the code exactly does. Where does the
InterruptedException
arise from? What happens if it takes more than 5 seconds to load the
screen? In that
case finish() will be called and there will be a blank screen while the
game menu
screen loads? Can someone please explain to me the details of this code? Is
an
AsynchTask better?

Then there is this post:

http://stackoverflow.com/questions/1979524/android-splashscreen

Is using an AsyncTask better? What is the purpose of the template parameters
 in the AsyncTask?

Then there is this site:
http://jyro.blogspot.com/2009/11/android-asynctask-template.html

and this site:
http://android-developers.blogspot.com/2009/05/painless-threading.html

I'm somewhat confused... not sure if someone
on this list would be so kind so as to help me out
in understanding the different elements involved in
setting up an AsyncTask or any other good way to
set up a postponment till stuff is loaded,

Thanks again,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] using fonts with canvas paint

2011-12-10 Thread John Goche
Hello,

I have a couple of font-related questions I would like to ask.

1. I would like to use 16pt or 24pt SANS BOLD fonts on my
android application's canvas. I wonder what the procedure
is to use these. Do I need to install the TrueTypeFont (TFF)
file for this font. Where do I download this from and how do
I use it with getAssets() in my code?

2. Suppose I want to make my own TTF fonts for use with
android. How do I go about doing this. Can I use LaTeX somehow?

Many Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: splash screen

2011-12-08 Thread John Goche
On Thu, Dec 8, 2011 at 4:28 PM, Kristopher Micinski
wrote:

>
> I think that's the standard enough way to do it.., so yes.
>
> How long?  A few seconds?
>

About 12 seconds the first time. Then when the application has already
been in memory for some reason it takes less, perhaps two or three seconds
to load.

Another thing I am having trouble with though is that in my main activity I
call:

requestWindowFeature(Window.FEATURE_NO_TITLE);

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
 WindowManager.LayoutParams.FLAG_FULLSCREEN);

but when the application loads I can see for a short while the application
name
highlighted at the top of the black screen before the full screen. Anyone
know
why this is and how I can make it go away?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: sound effects for android game application

2011-12-08 Thread John Goche
Hi Tobiah,

Sorry for the late reply, but I've checked csounds out and have tried
a compiling a few samples. I'm not sure I can easily get it to do what
I want, as I would like sounds like say paper being mashed up or
someone burping or stuff like that, which is theoretically possible
with csound, but I don't know how. I've also checked out audacity,
which can record, but don't know how to smoothen out the recored
sounds.

Thanks,

John Goche

On Mon, Nov 28, 2011 at 10:43 PM, Tobiah  wrote:

> On 11/28/2011 1:31 PM, John Goche wrote:
>
>>
>> Thanks, but what I was asking is what software is available for
>> creating the sound effects and what is being used for them in
>> general, cause if I don't have any I cannot load them into memory.
>>
>>
>
> If you want to get serious about creating sound effects, you
> could look into csound (csounds.com).  It takes some learning,
> but it's capable of anything that you can dream up.
>
> Tobiah
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to 
> android-developers@**googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+**unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: splash screen

2011-12-08 Thread John Goche
Hi Kristopher and Miguel,

Thank you for your posts. I am not using OpenGL for this particular
application.
I am not sure what is taking long but I think it's some Config.ARGB
bitmaps
I am loading which are taking long, I can't see what else. So Kristopher
you say
start an activity that displays a spinner and then start the real activity
from there.
Or Miguel, you say place alayout on top of the surface view, but isn't the
surface
view what is taking a long time to load?

Thanks,

John Goche

On Thu, Dec 8, 2011 at 3:27 AM, Miguel Morales wrote:

> How about placing a layout or something on top of your surface view and
> place a progress control there or something.
> That would be the least intrusive i think.
>
>
> On Wed, Dec 7, 2011 at 6:17 PM, Kristopher Micinski <
> krismicin...@gmail.com> wrote:
>
>> On Wed, Dec 7, 2011 at 9:11 PM, Christopher Van Kirk
>>  wrote:
>> > Does this preserve your GL context? I thought GL context goes away when
>> its
>> > parent activity does.
>> >
>>
>> Maybe not?  I don't know anything about GL, I'm the completely wrong
>> person to ask on that one, but if it's just a splash screen you throw
>> up while loading stuff, then you switch to the "main" activity, why
>> does it matter?  (Maybe it does, I just don't see why.)
>>
>> kris
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>
>
> --
> ~ Jeremiah:9:23-24
> Android 2D MMORPG: http://solrpg.com/,
> http://www.youtube.com/user/revoltingx
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: splash screen

2011-12-07 Thread John Goche
Thanks Rich,

What do you mean by do the loading in the background. Do I have to call
startActivity() in a separate thread?
When you say send a message back to the activity do you mean I should call
startActivityForResult()?

Thanks,

John Goche

On Wed, Dec 7, 2011 at 9:45 PM, rich friedel  wrote:

> Just make an activity that is your splash screen then do the loading in
> the background. When it's done send a message back to the activity and move
> on.
>
> You could also create a "loading"/"setting things up"/"building your data
> spinner" dialog.
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] splash screen

2011-12-07 Thread John Goche
Hello,

My application is taking a while to load so I am going to have to
place a splash screen. Any suggestions about how to go about
doing this (the application is 2D and uses a SurfaceView and a
loop therein to update the user interface).

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] writing to assets directory

2011-12-07 Thread John Goche
On Wed, Dec 7, 2011 at 2:22 PM, Mark Murphy  wrote:

>
> Step #1: See if you have a local copy of the files from a previous
> execution of Step #2.
>
> Step #2: If you do not, copy them from the assets.
>

Well it could be that the user has deleted all the files
and wants to keep it that way. I am going to have to
write a separate file just to check whether there was
a previous install of the application or not.

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] writing to assets directory

2011-12-07 Thread John Goche
On Wed, Dec 7, 2011 at 2:14 PM, Mark Murphy  wrote:

> On Wed, Dec 7, 2011 at 7:58 AM, John Goche 
> wrote:
> > Is it possible to write to the assets directory
>
> No. Assets, like resources, are read-only at runtime.


Thanks, but is there a way to copy from assets to the file system only at
install time,
perhaps even only the first time the application is installed and not when
it is upgraded?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] filesystem problems: please help

2011-12-07 Thread John Goche
Hello,

I have an application which needs to read and write files. When
the application is intalled it comes with some of these files. I would
like the installed files to be accessible in a uniform way to the user
so that they are indistinguishable from those created, modified, and
deleted by the user. In order to do this my understanding is that I need
to copy these from the assets directory to the file system when the
application is installed and then do everything via the file system.
I do not want to use a database for this as it would be overkill for
my particular use case scenario.

Could someone please let me know:

1. How do I copy files from assets to the application's file system
(preferably internal storage) so that this copy operation is only
performed at install time and not every time I load my application?

2. How do I manipulate files (open, read, write) files thereafter given
the above?

Many thanks for your help,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] writing to assets directory

2011-12-07 Thread John Goche
Hello,

I would like to ask:

Is it possible to write to the assets directory
or can I only write to a separate directory
from my application's logic?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] RectF: float parameters in pixelated canvas???

2011-12-05 Thread John Goche
Hello,

Can someone explain to me how come there is a RectF class that
takes float parameters when the pixel coordinates take integer values?
How can I draw a pixel at location (3.5,8.777) for instance instead of
at location (3,7). Does this just make sense because of antialiasing?

Thanks for clarification on this subtle issue
and why things have been designed this way in the Canvas related API,

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Tabed pane Help

2011-12-02 Thread John Goche
Not sure if this helps but have you tried implementing a class to hold your
data?
In the listener for your tabbed panes then read or write the data when the
tabs are
clicked. I think you might want to look at:

http://developer.android.com/reference/android/widget/TabWidget.html

and in particular

setOnClickListener<http://developer.android.com/reference/android/view/View.html#setOnClickListener%28android.view.View.OnClickListener%29>
(View.OnClickListener<http://developer.android.com/reference/android/view/View.OnClickListener.html>l)

That should get you started. In practice though you might want to use an
SQLiteDB
to store your data.

Regards,

John Goche

On Fri, Dec 2, 2011 at 4:36 PM, chowdary nani wrote:

> Hi All,
>
> In Tabedpane i have 2 tabs.I have to send data from  one tab to another
> tab.
> Please help me how to do this in android.
>
>
> Thanks
> Naveen
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] pausing games: dealing with Handler Messages timers

2011-12-02 Thread John Goche
Well, my code uses handlers, which are specific to android, so at least I
thought I'd post my code,
so anyone with any comments on this android-specific code feel free to drop
me a line.

John Goche

class TimeStampedMessage {

  TimeStampedMessage(Handler handler, long when, int what) {

this.handler = handler;

this.when = when;

this.what = what;

this.timeStamp = System.nanoTime();

  }

  static void pauseTimers() {

for (int k = 0; k < TimeStampedMessage.timeStampedMessages.size(); k++)
{

  TimeStampedMessage timeStampedMessage =
TimeStampedMessage.timeStampedMessages.get(k);

  long oldTimeStamp = timeStampedMessage.timeStamp;

  long newTimeStamp = System.nanoTime();

  System.out.println("When1: " + timeStampedMessage.when);

  System.out.println(oldTimeStamp);

  System.out.println(newTimeStamp);

  timeStampedMessage.when -= (newTimeStamp - oldTimeStamp) / 100L;

  System.out.println("When2: " + timeStampedMessage.when);

  timeStampedMessage.handler.removeMessages(timeStampedMessage.what);

}

  }

  static void resumeTimers() {

for (int k = 0; k < TimeStampedMessage.timeStampedMessages.size(); k++)
{

  Handler handler =
TimeStampedMessage.timeStampedMessages.get(k).handler;

  long when = TimeStampedMessage.timeStampedMessages.get(k).when;

  int what = TimeStampedMessage.timeStampedMessages.get(k).what;

  TimeStampedMessage.timeStampedMessages.get(k).timeStamp =
System.nanoTime();

  Message message = handler.obtainMessage(what);

  handler.sendMessageDelayed(message, when);

  System.out.println("resuming: when:" + when);

}

  }

  static void unloadMessages(Handler handler, int what) {

for (int k = 0; k < TimeStampedMessage.timeStampedMessages.size(); k++)

  if (TimeStampedMessage.timeStampedMessages.get(k).handler == handler
&&
  TimeStampedMessage.timeStampedMessages.get(k).what == what)

TimeStampedMessage.timeStampedMessages.remove(k);

  }

  Handler handler;

  long timeStamp;

  long when;

  int what;

  static List timeStampedMessages = new
ArrayList();

}

abstract class WorldState {

  public abstract void enter(World world);

  public abstract void timerExpired(World world, Message msg);

  public abstract void update(World world, float deltaTime);

  public abstract void exit(World world);

  public void sendMessage(World world, long numMillis, int what) {

Message message = world.worldHandler.obtainMessage(what);

world.worldHandler.sendMessageDelayed(message, numMillis);

TimeStampedMessage timeStampedMessage = new
TimeStampedMessage(world.worldHandler, numMillis, what);

TimeStampedMessage.timeStampedMessages.add(timeStampedMessage);

  }

  public void removeMessages(World world, int what) {

TimeStampedMessage.unloadMessages(world.worldHandler, what);


world.worldHandler.removeMessages(World.WorldHandler.MESSAGE_WHAT_PRESENTATION_GHOST_ESCAPE);

  }

}

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] pausing games: dealing with Handler Messages timers

2011-12-02 Thread John Goche
On Fri, Dec 2, 2011 at 3:06 PM, Miguel Morales wrote:

> Why are you using timers?  That seems needlessly complicated.
> Use a game loop that keeps a constant frame rate.
> Maintain state in your sprite objects, use the game loop to update this
> state.
> Then on a separate draw loop draw the sprite according to its state.
>
> Then you dont have to worry about weird sync issues.
>

Well, I am using timers with the state design pattern so that when each
timer expires
I transition to a new state or update a variable. It keeps my code sparated
into neat
modules.

I have a separate draw function which runs after calling update(deltaTime)
on the model (sprites).
Without timers the code could become a mess with lots of time-keeping
variables decremented
on each update to the game loop and lots of tests to see which state the
sprites are in accordingly...

>
> On Fri, Dec 2, 2011 at 5:45 AM, John Goche wrote:
>
>>
>> Hello,
>>
>> I have an android game which uses timers to update the screen sprites.
>> When the user wishes to pause the screen I have to know which timers
>> are pending and how long is missing before their expiration time. So this
>> means I have to maintain separate data structures for each Handler to
>> keep track of:
>>
>> A. when the timer is set (timerSetTime) with System.nanoTime() and
>> B. how long before it expires (timerExpirationLength) so that
>>
>> when the user pauses the game screen I cancel all timers
>> and then when the user unpauses for each paused timer I compute
>>
>> unpauseTime = System.nanoTime()
>>
>> and then reset each timer to timerExpirationLength - unpauseTime +
>> timerSetTime
>>
>> and then when each timer expires unload the corresponding (timerSetTime
>> and timerExpirationLength)
>> data structure entry in the Handler subclass.
>>
>> OK, I have described my solution to the problem. The android Handler
>> system does not seem
>> to provide a custom solution to this problem so I had to implement my own
>> code. If anyone has
>> a better solution to the problem of dealing with game state timers when
>> the game is paused (so
>> that they are saved as part of the game state) I'd like to hear your
>> alternative solutions.
>>
>> Thanks,
>>
>>
>> John Goche
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
>
>
> --
> ~ Jeremiah:9:23-24
> Android 2D MMORPG: http://solrpg.com/,
> http://www.youtube.com/user/revoltingx
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: multitouch support again...

2011-12-02 Thread John Goche
Thanks Achim for the clarification, it makes sense.

Regards,

John Goche

On Fri, Dec 2, 2011 at 4:01 PM, al  wrote:

> It works because returning true signals that the event has been
> consumed. That's the signal for the parent ViewGroup to set this view
> as a "target". As a result, the "pointer" multitouch events are
> delivered to this target view. I think, the corresponding code is in
> ViewGroup.dispatchTouchEvent. You might want to take a look...
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] pausing games: dealing with Handler Messages timers

2011-12-02 Thread John Goche
Hello,

I have an android game which uses timers to update the screen sprites.
When the user wishes to pause the screen I have to know which timers
are pending and how long is missing before their expiration time. So this
means I have to maintain separate data structures for each Handler to
keep track of:

A. when the timer is set (timerSetTime) with System.nanoTime() and
B. how long before it expires (timerExpirationLength) so that

when the user pauses the game screen I cancel all timers
and then when the user unpauses for each paused timer I compute

unpauseTime = System.nanoTime()

and then reset each timer to timerExpirationLength - unpauseTime +
timerSetTime

and then when each timer expires unload the corresponding (timerSetTime and
timerExpirationLength)
data structure entry in the Handler subclass.

OK, I have described my solution to the problem. The android Handler system
does not seem
to provide a custom solution to this problem so I had to implement my own
code. If anyone has
a better solution to the problem of dealing with game state timers when the
game is paused (so
that they are saved as part of the game state) I'd like to hear your
alternative solutions.

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: multitouch support again...

2011-12-01 Thread John Goche
On Thu, Dec 1, 2011 at 8:17 PM, al  wrote:

> OK, your yamtt results mean that your device supports multitouch, but
> only two simultanious touch points. For your purpose, that should be
> enough.
>
> I might be wrong, but do you return true as the methods result? If
> not, do so.
>

Thanks, I was returning super.onTouchEvent(event);

That made the whole difference, it now works. So somehow
super.onTouchEvent(event) was consuming my event when
it was not supposed to? Why does this solution work?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: multitouch support again...

2011-12-01 Thread John Goche
Thank you for your reply,

I downloaded and installed yamtt (Yet Another MutltiTouch Test) from
Android Market. When I place the second finger down it's detected but
not when I place the third one down. Still not sure what I'm doing wrong
in my code...

On Thu, Dec 1, 2011 at 10:41 AM, al  wrote:

> At first glance, I don't see a fundamental problem with your code
> sketch that might cause your problem. I would check if your device is
> multitouch-capable. There are many free apps in the market to do this,
> for example yamtt. If the device supports mutitouch, it may help to
> debug into the onTouchEvent method or to log the event right at the
> start of the onTouchEvent method, just to see what's reported...
>

Not sure about what to do. I have tried with System.out.println() statements
but I don't see the ACTION_POINTER_DOWN which should result in a
single printf statement since there's no break statement in the code.


> Btw. capacitive touch screen indicates the technology used to
> recognize touches (a different worse technology to do this are e.g.
> resistive screens); multi-touch means the screen an recognize multiple
> touches at the same time. So, that's not the same.
>
>  means something different than multitouch:
>

Thanks for the clarification,

I would be satisfied if I could get the second finger going down detected.

Any ideas?

John Goche


>
> On 30 Nov., 22:11, John Goche  wrote:
> > Hello,
> >
> > I have posted this message before but got no repiles
> > so I decided to post it again because I need to detect
> > when a single second finger goes down while the first
> > one is still down on my canvas... here is my old post:
> >
> > I have an LG Optimus Net (P690) which as far as I understand
> > claims to support multitouch (as it sais on the following site:
> http://www.mobilespecs.in/2011/10/lg-optimus-net-also-known-as-p690.html
> > not sure if capacitive touch screen means the same thing as
> > multitouch.
> >
> > However when I try the following code...
> >
> > public boolean onTouchEvent(MotionEvent event) {
> >
> >   int pointerIndex = (event.getAction() &
> > MotionEvent.ACTION_POINTER_ID_MASK) >>
> MotionEvent.ACTION_POINTER_ID_SHIFT;
> >   int action = event.getAction() & MotionEvent.ACTION_MASK;
> >
> >   switch (action) {
> >
> > case MotionEvent.ACTION_DOWN:
> >
> >   System.out.println("got down");
> > case MotionEvent.ACTION_POINTER_DOWN:
> >   System.out.println("got pointer down");
> >
> >   int screenX = (int) (event.getX(pointerIndex) * scaleX);
> >   int screenY = (int) (event.getY(pointerIndex) * scaleY);
> >
> > I see the code run when I place the first finger down. When I place the
> > second
> > finger down without lifting the first one I don't see the
> > ACTION_POINTER_DOWN.
> >
> > Not sure what I'm doing wrong if anything.
> >
> > Thanks for your help,
> >
> > John Goche
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] multitouch support again...

2011-11-30 Thread John Goche
Hello,

I have posted this message before but got no repiles
so I decided to post it again because I need to detect
when a single second finger goes down while the first
one is still down on my canvas... here is my old post:

I have an LG Optimus Net (P690) which as far as I understand
claims to support multitouch (as it sais on the following site:
http://www.mobilespecs.in/2011/10/lg-optimus-net-also-known-as-p690.html
not sure if capacitive touch screen means the same thing as
multitouch.

However when I try the following code...

public boolean onTouchEvent(MotionEvent event) {

  int pointerIndex = (event.getAction() &
MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
  int action = event.getAction() & MotionEvent.ACTION_MASK;

  switch (action) {

case MotionEvent.ACTION_DOWN:

  System.out.println("got down");
case MotionEvent.ACTION_POINTER_DOWN:
  System.out.println("got pointer down");

  int screenX = (int) (event.getX(pointerIndex) * scaleX);
  int screenY = (int) (event.getY(pointerIndex) * scaleY);

I see the code run when I place the first finger down. When I place the
second
finger down without lifting the first one I don't see the
ACTION_POINTER_DOWN.

Not sure what I'm doing wrong if anything.

Thanks for your help,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] game design question: multiple handlers

2011-11-30 Thread John Goche
Thank you for your reply, I've restructured my code a little bit
and now I do have multiple handlers in my code but no longer
get the error message about having to call looper.prepare()
(which I tried calling without understanding exactly what it
does and didn't get a nice result). Sorry if I left the details
out, I spent some time restructuring my code and then was
unable to get the same error message hence the vagueness.

I'm still interested in what might have caused the orignal message
telling me to call looper.prepare() though and the logic behind it.

Thanks,

John Goche

2011/11/30 Kostya Vasilyev 

> You can have as many handlers as needed, within reason.
>
> The work of dispatching messages to handlers is done by Looper, anyway.
>
> And that's where I think your original issue has its roots.
>
> Posting a more exact message than "I get an error saying I need to
>
> call prepare *or something* since I cannot have more than one
> handler per thread *or something*."
>
> ( I am pretty sure what it is, but let's see the message first )
>
> -- Kostya
>
> 30 ноября 2011 г. 16:35 пользователь John Goche <
> johngoch...@googlemail.com> написал:
>
>
>> Also, why would it be better to have one handler than multiple handlers
>> anyways
>> given that in some situations multiple handlers can compile?
>>
>>
>> On Wed, Nov 30, 2011 at 1:32 PM, John Goche 
>> wrote:
>>
>>>
>>> Thank you TreKing for your advice,
>>>
>>> But then in my handleMessage I would have to check with
>>>
>>> if (inst instance of Foo)
>>>   inst.foocallback();
>>> else if (inst instanceof Bar)
>>>   inst.barcallback();
>>> else if (...)
>>>
>>> or is there a neater solution, perhaps using polymorphism or a design
>>> pattern of some sort
>>> so that my handleMessage does not quickly turn into a mess?
>>>
>>> Thanks,
>>>
>>> John Goche
>>>
>>>
>>>
>>> On Tue, Nov 29, 2011 at 11:02 PM, TreKing  wrote:
>>>
>>>> On Tue, Nov 29, 2011 at 3:46 PM, John Goche >>> > wrote:
>>>>
>>>>> The number of sprites is indefinite (could vary in number) but each
>>>>> needs to manage itself individually. On top of this the world has its
>>>>> own handler to manage updates to itself.
>>>>>
>>>>
>>>> You don't need separate handlers, you can pass the instance of the
>>>> object that is being updated in the handler message, then use one single
>>>> handler for the main thread.
>>>>
>>>>
>>>> -
>>>> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
>>>> transit tracking app for Android-powered devices
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Android Developers" group.
>>>> To post to this group, send email to
>>>> android-developers@googlegroups.com
>>>> To unsubscribe from this group, send email to
>>>> android-developers+unsubscr...@googlegroups.com
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/android-developers?hl=en
>>>
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] game design question: multiple handlers

2011-11-30 Thread John Goche
Also, why would it be better to have one handler than multiple handlers
anyways
given that in some situations multiple handlers can compile?

On Wed, Nov 30, 2011 at 1:32 PM, John Goche wrote:

>
> Thank you TreKing for your advice,
>
> But then in my handleMessage I would have to check with
>
> if (inst instance of Foo)
>   inst.foocallback();
> else if (inst instanceof Bar)
>   inst.barcallback();
> else if (...)
>
> or is there a neater solution, perhaps using polymorphism or a design
> pattern of some sort
> so that my handleMessage does not quickly turn into a mess?
>
> Thanks,
>
> John Goche
>
>
>
> On Tue, Nov 29, 2011 at 11:02 PM, TreKing  wrote:
>
>> On Tue, Nov 29, 2011 at 3:46 PM, John Goche 
>> wrote:
>>
>>> The number of sprites is indefinite (could vary in number) but each
>>> needs to manage itself individually. On top of this the world has its
>>> own handler to manage updates to itself.
>>>
>>
>> You don't need separate handlers, you can pass the instance of the object
>> that is being updated in the handler message, then use one single handler
>> for the main thread.
>>
>>
>> -
>> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
>> transit tracking app for Android-powered devices
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] game design question: multiple handlers

2011-11-30 Thread John Goche
Thank you TreKing for your advice,

But then in my handleMessage I would have to check with

if (inst instance of Foo)
  inst.foocallback();
else if (inst instanceof Bar)
  inst.barcallback();
else if (...)

or is there a neater solution, perhaps using polymorphism or a design
pattern of some sort
so that my handleMessage does not quickly turn into a mess?

Thanks,

John Goche


On Tue, Nov 29, 2011 at 11:02 PM, TreKing  wrote:

> On Tue, Nov 29, 2011 at 3:46 PM, John Goche wrote:
>
>> The number of sprites is indefinite (could vary in number) but each
>> needs to manage itself individually. On top of this the world has its
>> own handler to manage updates to itself.
>>
>
> You don't need separate handlers, you can pass the instance of the object
> that is being updated in the handler message, then use one single handler
> for the main thread.
>
>
> -
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] game design question: multiple handlers

2011-11-29 Thread John Goche
Hello,

I have an application involving several sprites. Every sprite can be in one
of
several states and a handler is used so that each sprite can have its own
state transitions when the messages posted to the handler can expire.
The number of sprites is indefinite (could vary in number) but each
needs to manage itself individually. On top of this the world has its
own handler to manage updates to itself.

However when I compile the code I get an error saying I need to
call prepare or something since I cannot have more than one
handler per thread or something. How can i solve this problem
and what exactly is the problem?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] multitouch support or no support???

2011-11-28 Thread John Goche
Hello,

I have an LG Optimus Net (P690) which as far as I understand
claims to support multitouch (as it sais on the following site:
http://www.mobilespecs.in/2011/10/lg-optimus-net-also-known-as-p690.html
not sure if capacitive touch screen means the same thing as
multitouch.

However when I try the following code...

public boolean onTouchEvent(MotionEvent event) {

  int pointerIndex = (event.getAction() &
MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
  int action = event.getAction() & MotionEvent.ACTION_MASK;

  switch (action) {

case MotionEvent.ACTION_DOWN:

  System.out.println("got down");
case MotionEvent.ACTION_POINTER_DOWN:
  System.out.println("got pointer down");

  int screenX = (int) (event.getX(pointerIndex) * scaleX);
  int screenY = (int) (event.getY(pointerIndex) * scaleY);

I see the code run when I place the first finger down. When I place the
second
finger down without lifting the first one I don't see the
ACTION_POINTER_DOWN.

Not sure what I'm doing wrong if anything.

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: sound effects for android game application

2011-11-28 Thread John Goche
Thanks, but what I was asking is what software is available for
creating the sound effects and what is being used for them in
general, cause if I don't have any I cannot load them into memory.

Regards,

John Goche

On Mon, Nov 28, 2011 at 9:24 PM, hoyski  wrote:

> On Nov 28, 9:42 am, John Goche  wrote:
> > Hello,
> >
> > I am making an android game. I wonder whether anyone can suggest
> > how to go about producing the sound effects including sound track as
> > well as other sounds for the game.
> >
> > Thank you for your feedback,
> >
> > John Goche
>
> Use android.media.SoundPool to load and play your sound effects. These
> will be held in memory so you'll only want short sound clips in your
> SoundPool. For the background sound track, stream it using
> android.media.MediaPlayer so that only a small portion will be in
> memory at any given moment.
>
> - Dave
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] sound effects for android game application

2011-11-28 Thread John Goche
Hello,

I am making an android game. I wonder whether anyone can suggest
how to go about producing the sound effects including sound track as
well as other sounds for the game.

Thank you for your feedback,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] reading a plain text file: java.lang.fileNotFoundException

2011-11-23 Thread John Goche
Thanks,

Here is how I solved it,

BufferedReader reader = new BufferedReader(new
InputStreamReader(ctx.getAssets().open(fileName)));

Regards,

John Goche

On Wed, Nov 23, 2011 at 8:53 PM, Mark Murphy wrote:

> You don't access assets/ by FileReader. You access assets/ via
> AssetManager, which you get from a Resources object, which you
> typically get via a call to getResources() on your Activity.
>
> On Wed, Nov 23, 2011 at 2:10 PM, John Goche 
> wrote:
> >
> > Hello,
> >
> > I have a really basic question.
> > I am trying to read the contents of a plain text file from my
> application.
> > I have placed the file under MyProject/assets/foo.txt and I am trying to
> > read it in my application with
> >
> > BufferedReader reader = new BufferedReader(new FileReader(fileName));
> > reader.read();
> >
> > where fileName ="assets/foo.txt" but I get a
> > java.lang.fileNotFoundException.
> >
> > How can I ensure that the file is found?
> >
> > Thanks,
> >
> > John Goche
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> > http://groups.google.com/group/android-developers?hl=en
>
>
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android App Developer Books: http://commonsware.com/books
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] reading a plain text file: java.lang.fileNotFoundException

2011-11-23 Thread John Goche
Hello,

I have a really basic question.
I am trying to read the contents of a plain text file from my application.
I have placed the file under MyProject/assets/foo.txt and I am trying to
read it in my application with

BufferedReader reader = new BufferedReader(new FileReader(fileName));
reader.read();

where fileName ="assets/foo.txt" but I get a
java.lang.fileNotFoundException.

How can I ensure that the file is found?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: View/onDraw(Canvas) vs. SurfaceView

2011-11-23 Thread John Goche
Hello,

Let me rephrase my question. Given the information found at
http://developer.android.com/guide/topics/graphics/2d-graphics.html
which states:

 "The aim of SurfaceView is to offer this drawing surface
to an application's secondary thread, so that the application isn't
required to wait until the system's View hierarchy is ready to draw."

if I have just a single View on my screen (say for a game) why would the
View hierarchy take a longer time to draw than if the View's Canvas is
updated from a separate thread?

Thanks for your feedback,

John Goche

On Wed, Nov 23, 2011 at 1:30 PM, John Goche wrote:

>
> Hello,
>
> Could anyone kindly explain to me what the difference is between
> using a SurfaceView and subclassing a View class and overriding
> its onDraw() mehtod? Plus I've read a thread on this mailing list
> that SurfaceView has problems on newer phones (and perhaps
> GLSurfaceView is affected as well). Can someone please give
> me an update on this?
>
> Thanks,
>
> John Goche
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] View/onDraw(Canvas) vs. SurfaceView

2011-11-23 Thread John Goche
Hello,

Could anyone kindly explain to me what the difference is between
using a SurfaceView and subclassing a View class and overriding
its onDraw() mehtod? Plus I've read a thread on this mailing list
that SurfaceView has problems on newer phones (and perhaps
GLSurfaceView is affected as well). Can someone please give
me an update on this?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] OpenGL on android

2011-11-16 Thread John Goche
Hello,

I am new to OpenGL and would like to write some
code in it for Android. I wonder whether there are
any significant differences in the android implementation
compared to JOGL http://jogamp.org/jogl/doc/HowToBuild.html
(which also has a quite involved setup process).

I ask because I was thinking of developing in JOGL in order to
speed up the process and then when the project is ready port
the code to android (which has a slower emulator compile,
load, and test development cycle).

Also, would I find a .OBJ (Wavefront) parser anywhere on
android or must I implement/import my own? I ask because
I would require one to read my model into OpenGL/Java.

Comments and suggestions on how to proceed welcome,

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] eclipse IDE: including misc files

2011-11-11 Thread John Goche
Hello,

I would like to know whether there is a way to
include miscellaneous files in the eclipse IDE
such as shell scripts used to generate data
without getting an error from the IDE.

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] android statistics (android versions and their market share)

2011-11-08 Thread John Goche
Hello,

I wonder if anyone could tell me how long the latest version
of android (2.3.3) has been out. Where can I find a web page
with a pie chart of the relative number of phones which have
been produced for each android version?

Thanks a lot,

Many thanks,

John Goche

P.S. I am considering making my app available on lower
versions so as to increase sales but as of now I am unsure
about how much benefit I could reap from such an increase
in number of supported phones as I don't have the figures of
what's out there.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: more SMS questions

2011-11-06 Thread John Goche
On Sun, Nov 6, 2011 at 5:57 PM, Kristopher Micinski
 wrote:
>> I need to have a bunch of android phones send and receive data to each
>> other to communicate,
>
> Don't use SMS, that seems like a bad idea waiting to happen.  Try
> using a web service or backend to do this, this is what pretty much
> everyone else does..
>
> kris

Yes but a web service / backend needs a separate server and I wanted to have
something that works out of the box. What should I do?

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: more SMS questions

2011-11-06 Thread John Goche
After some browsing I found this thread:

http://groups.google.com/group/android-developers/browse_thread/thread/3b8dc90cdc701f49/9bcf1c15f2c52fc2

Apparently to use ports you have to set up a server and listen on that
port on the receiver.

Also, the GTalk API is now obsolete I gather. It would been a good
alternative since I only need to communicate
among android devices but it's no longer available.

Now I'm considering using something else like wi-fi as it would be
less expensive and above all probably
has an API that works unlike sendDataMessage, and SMS may also be
slower than wi-fi (and more unreliable).

http://developer.android.com/reference/android/net/wifi/p2p/package-summary.html

for the cell phones to communicate. However I'm not sure of the
network coverage for wi-fi.
If a user pays a fee can that user have wi-fi just about everywhere
the user goes?

I need to have a bunch of android phones send and receive data to each
other to communicate,

Suggestions welcome,

Thanks,

John Goche

On Sun, Nov 6, 2011 at 1:55 PM, John Goche  wrote:
> Hello,
>
> I have tried using Base64.encode() with the sendDataMessage as follows:
>
> smsManager.sendDataMessage("5558", null, (short) 1500,
> Base64.encode("hello SMS".getBytes(), Base64.DEFAULT), null, null);
>
> I have also tried putting the following in my AndroidManifest.xml but
> no luck on the emulator.
>
>    
>      
>         android:name="android.provider.Telephony.SMS_RECEIVED">
>        
>        
>        
>        
>      
>    
>
> The result is the following output in adb logcat when the message is
> received (some garbage is shown
> as a notification as the text message arrives):
>
> V/Telephony(  295): getOrCreateThreadId cursor cnt: 1
>
> However I don't see the calls from my boardcast receiver being called.
> I don't understand why it's not being called.
>
> Any ideas?
>
> public class SMSReceiver extends BroadcastReceiver {
>
>  @Override
>  public void onReceive(Context context, Intent intent) {
>
>    Log.d(TAG, "hello received");
>
>    Object[] pduArray = (Object[]) intent.getExtras().get("pdus");
>
>    SmsMessage[] messages = new SmsMessage[pduArray.length];
>
>    for (int i = 0; i < pduArray.length; i++) {
>
>      Log.d(TAG, "received");
>
>      messages[i] = SmsMessage.createFromPdu((byte[]) pduArray[i]);
>
>      Log.d(TAG, messages[i].getDisplayOriginatingAddress());
>
>      Log.d(TAG, messages[i].getMessageBody());
>
>    }
>
>  }
>
>  private static final String TAG = "SMSReceiver";
>
> }
>
> Many thanks,
>
> Regards,
>
> John Goche
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: more SMS questions

2011-11-06 Thread John Goche
Hello,

I have tried using Base64.encode() with the sendDataMessage as follows:

smsManager.sendDataMessage("5558", null, (short) 1500,
Base64.encode("hello SMS".getBytes(), Base64.DEFAULT), null, null);

I have also tried putting the following in my AndroidManifest.xml but
no luck on the emulator.


  





  


The result is the following output in adb logcat when the message is
received (some garbage is shown
as a notification as the text message arrives):

V/Telephony(  295): getOrCreateThreadId cursor cnt: 1

However I don't see the calls from my boardcast receiver being called.
I don't understand why it's not being called.

Any ideas?

public class SMSReceiver extends BroadcastReceiver {

  @Override
  public void onReceive(Context context, Intent intent) {

Log.d(TAG, "hello received");

Object[] pduArray = (Object[]) intent.getExtras().get("pdus");

SmsMessage[] messages = new SmsMessage[pduArray.length];

for (int i = 0; i < pduArray.length; i++) {

  Log.d(TAG, "received");

  messages[i] = SmsMessage.createFromPdu((byte[]) pduArray[i]);

  Log.d(TAG, messages[i].getDisplayOriginatingAddress());

  Log.d(TAG, messages[i].getMessageBody());

}

  }

  private static final String TAG = "SMSReceiver";

}

Many thanks,

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: more SMS questions

2011-11-06 Thread John Goche
Tank you for your reply...

What do you mean base64 encode the binary data and send it as a plain
SMS text message?
But I don't want the message on the receiving end to go to the inbox
folder. I just want it to be
read by the application and discarded thereafter (class 0) or
otherwise use a port number that
my application can recognize. Can I do that if I simply base64 encode
my message and send
it as a multipart text sms? What about getting a status report?

I've read some posts saying sendDataMessage is broken on the emulator.

Still wondering what getSubmitPdu is used for.

Regards,

John Goche

On Sun, Nov 6, 2011 at 2:11 AM, Belvedere Computer Services
 wrote:
> Base64 encoder on the send end / decode on remote
>
> On Nov 5, 7:28 pm, John Goche  wrote:
>> Hello,
>>
>> As mentioned in an earlier post I am trying to send binary SMS
>> from one phone to another. I use the emulator number as the
>> phone number destination address in order to test things out.
>>
>> When the SMS is not binary (sendTextMessage below) things
>> work fine, the message is received by the other emulator and
>> I see the string output. However when I use sendDataMessage
>> (presumably this is to send a binary SMS), the sending emulator
>> stalls (I see the small windows spinning blue circle) for a while
>> (a few seconds) after which I do not see the Log.d output in the
>> receiving emulator.
>>
>> I would like to know what I am doing wrong. Also, how do I:
>>
>> 1. Specify class 0 for the SMS if this in not done automatically?
>> 2. Listen on the specified port number (123) on the receiver?
>> 3. Choose an appropriate SMS port number for my application?
>> 4. Can someone please explain to me what the getSubmitPdu
>>     method is good for? I've read the docs and also the reference
>>     on SMS athttp://www.dreamfabric.com/sms/and the android
>>     docs but I still cannot figure it out.
>> 5. Am I correct at interpreting that with sendDataMessage an
>>     SMS status report will be generated if and only if the last
>>     argument (the pending intent) is not null, otherwise the
>>     SMS will be sent without specifying that a status report
>>     be generated?
>>
>> Thank you for your help,
>>
>> John Goche
>>
>> FooActivity.java 
>>
>>         SmsManager smsManager = SmsManager.getDefault();
>>
>>         //smsManager.sendTextMessage("5556", null, "hello SMS", null, null);
>>
>>         smsManager.sendDataMessage("5556", null, (short) 123, new
>> byte[] { '1', '2', '3', '4' }, null, null);
>>
>> SMSReceiver.java -
>>
>> import android.content.BroadcastReceiver;
>> import android.content.Context;
>> import android.content.Intent;
>> import android.telephony.SmsMessage;
>> import android.util.Log;
>>
>> public class SMSReceiver extends BroadcastReceiver {
>>
>>   @Override
>>   public void onReceive(Context context, Intent intent) {
>>
>>     Object[] pduArray = (Object[]) intent.getExtras().get("pdus");
>>
>>     SmsMessage[] messages = new SmsMessage[pduArray.length];
>>
>>     for (int i = 0; i < pduArray.length; i++) {
>>
>>       Log.d(TAG, "received");
>>
>>       messages[i] = SmsMessage.createFromPdu((byte[]) pduArray[i]);
>>
>>       Log.d(TAG, messages[i].getDisplayOriginatingAddress());
>>
>>       Log.d(TAG, messages[i].getMessageBody());
>>
>>     }
>>
>>   }
>>
>>   private static final String TAG = "SMSReceiver";
>>
>>
>>
>>
>>
>>
>>
>> }
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] more SMS questions

2011-11-05 Thread John Goche
Hello,

As mentioned in an earlier post I am trying to send binary SMS
from one phone to another. I use the emulator number as the
phone number destination address in order to test things out.

When the SMS is not binary (sendTextMessage below) things
work fine, the message is received by the other emulator and
I see the string output. However when I use sendDataMessage
(presumably this is to send a binary SMS), the sending emulator
stalls (I see the small windows spinning blue circle) for a while
(a few seconds) after which I do not see the Log.d output in the
receiving emulator.

I would like to know what I am doing wrong. Also, how do I:

1. Specify class 0 for the SMS if this in not done automatically?
2. Listen on the specified port number (123) on the receiver?
3. Choose an appropriate SMS port number for my application?
4. Can someone please explain to me what the getSubmitPdu
method is good for? I've read the docs and also the reference
on SMS at http://www.dreamfabric.com/sms/ and the android
docs but I still cannot figure it out.
5. Am I correct at interpreting that with sendDataMessage an
SMS status report will be generated if and only if the last
argument (the pending intent) is not null, otherwise the
SMS will be sent without specifying that a status report
be generated?

Thank you for your help,

John Goche

FooActivity.java 

SmsManager smsManager = SmsManager.getDefault();

//smsManager.sendTextMessage("5556", null, "hello SMS", null, null);

smsManager.sendDataMessage("5556", null, (short) 123, new
byte[] { '1', '2', '3', '4' }, null, null);


SMSReceiver.java -

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.SmsMessage;
import android.util.Log;

public class SMSReceiver extends BroadcastReceiver {

  @Override
  public void onReceive(Context context, Intent intent) {

Object[] pduArray = (Object[]) intent.getExtras().get("pdus");

SmsMessage[] messages = new SmsMessage[pduArray.length];

for (int i = 0; i < pduArray.length; i++) {

  Log.d(TAG, "received");

  messages[i] = SmsMessage.createFromPdu((byte[]) pduArray[i]);

  Log.d(TAG, messages[i].getDisplayOriginatingAddress());

  Log.d(TAG, messages[i].getMessageBody());

}

  }

  private static final String TAG = "SMSReceiver";

}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] android market language listings

2011-11-04 Thread John Goche
Hello,

I wonder how come not all languages are supported
for listings in android market. For instance I can see
Chinese (Taiwan) but not Chinese (PRC), and I cannot
see many other languages despite the mobile phones
support many. What's up with this?

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] binary SMS on android

2011-11-03 Thread John Goche
Hello,

I have an android application with a database of records. I would like to send
some of those records to another instance of the same android application. In
order for this to happen I would like to use a phone number and a text message.
However the text message should not contain data to be read by the user of the
phone but should simply be read by the application on the other end and then
discarded. However I cannot find a good tutorial on this anywhere. To achieve
this purpose do I:

1. Set the message class to zero to make it disappear.
2. Use port numbers (do these work for GSM only or also on CDMA networks)?
In this case do I make up my own port number and hope no other application
on the receiving end will use it? I see SmsManager has a method called
sendDataMessage. Does this send a binary SMS?
3. Can I indeed use binary SMS? Is binary SMS supported on both GSM and CDMA?
4. I see the following methods in android.telephony.SmsMessage:

static SmsMessage.SubmitPdu getSubmitPdu(String scAddress, String
destinationAddress, short destinationPort, byte[] data, boolean
statusReportRequested)

Get an SMS-SUBMIT PDU for a data message to a destination address & port.

static SmsMessage.SubmitPdu getSubmitPdu(String scAddress, String
destinationAddress, String message, boolean statusReportRequested)

Get an SMS-SUBMIT PDU for a destination address and a message.

Is this what I use? Is destinationAddress the destination phone number?

What do I do with the SubmitPdu (payload data unit) once I have instantiated it?

5. Also, I've read status reports can take several days to get back so
are they not somehow pointless. Should I do without them
and have the receiving application send an outbound sms if any at all?

-

Sorry for asking so many questions, I am just unsure on how to
proceed. For instance don't I have
to set the UDH header somehow or is this done automatically for me
with the above method? Or is
UDH just a GSM specific thing?

Thanks a lot for all clarifications,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: published market app showing up but not using keyword search

2011-11-03 Thread John Goche
My application hardly shows up (actually does not show up at all)
unless I enter the exact tiltle of the application for the keywords.
I wonder what would be a good way to make it show up more
often in search results (for instance when half the keyword
app title is entered or when some text in the body description
is entered?).

Thanks,

John Goche

On Thu, Nov 3, 2011 at 6:32 AM, Belvedere Computer Services <
fa829...@gmail.com> wrote:

> this is something I have been wanting to bring up in a proper context
> so I will write some fast and dirty Java for the engineers when they
> get here
>
> //  stochastic search ~ should be how selector for App Store
> //  pulls selection set so the few thousand in millions get a roll
>
> final TreeMapselectorMap=new TreeMap();
>
> load(Object next){
>  Integer( SecureRandom.nextInt() )
>  selectorMap.put(Integer,Object);
>
> Object presentationApp() {
>  return  selectorMap.get( SecureRandom.nextInt(size) )
>
>  really raw dirty but I can put up a little better on Git if code
> engineer wants some clearer code and while we are at it your keyword
> idea is something that needs to be opened as an issue as we are as a
> group going up against an established competitor who will throw $ at
> holding an entrenched position so this is not a time for the game
> stuff that everyone is interested in
>
> On Nov 2, 5:47 pm, John Goche  wrote:
> > Hello,
> >
> > I have published an application to android market
> > using the provided web interface. When I type the
> > application name as follows I can see it:
> >
> > https://market.android.com/details?id=com.foobar.foo
> >
> > However I cannot see it when I perform a search
> > neither from my PC nor from my up-to-date phone.
> >
> > When I used the web interface I could not see any
> > place where I could enter any keywords for the
> > android market searches.
> >
> > How long does one have to wait before searching
> > is enabled. If I put the application name or the name
> > of the company or developer I thought the application
> > would show up but no luck. I'm lost.
> >
> > Any help appreciated,
> >
> > Regards,
> >
> > John Goche
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] published market app showing up but not using keyword search

2011-11-02 Thread John Goche
Hello,

I have published an application to android market
using the provided web interface. When I type the
application name as follows I can see it:

https://market.android.com/details?id=com.foobar.foo

However I cannot see it when I perform a search
neither from my PC nor from my up-to-date phone.

When I used the web interface I could not see any
place where I could enter any keywords for the
android market searches.

How long does one have to wait before searching
is enabled. If I put the application name or the name
of the company or developer I thought the application
would show up but no luck. I'm lost.

Any help appreciated,

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: SMS interface and timestamps

2011-11-01 Thread John Goche
On Tue, Nov 1, 2011 at 8:37 AM, gjs  wrote:

> Hi,
>
> For (1) probably not, sms can be queued by the operator for quite a
> while if recipient phone is off.
>
> For (2) you can get an accurate GMT timestamp from the GPS Location,
> provided you have a current gps fix.
>

What do you mean by current gps fix?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] SMS interface and timestamps

2011-10-31 Thread John Goche
Hello,

I would like to code with android's SMS interface, however I am
somewhat new to SMS programming. I would like to know:

1. If I send an SMS, can I be notified from the operator with some
option about the timestamp in GMT for instance that the message
was sent?

I ask because I need to coordinate database manipulations across
a distributed network of cellphones and am concened that if I use
the time on each phone then if different phones have different
timestamps things may get out of sync.

2. Is there an alternate way of letting the phones know about any
time discrepancies in their time tracking settings?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

  1   2   3   >