Search This Blog

Saturday, March 17, 2012

Tuning fork and the Amazon Android app store


I tried submitting two apps so far to the Amazon app store in parallel with the Google market.   Both were rejected.  This post is just a minor frustration release.   My goal in submitting in parallel was to reach the Amazon Kindle Fire which can't see the Google market, unless you jail break it.

The LED blink app, they wrote back and said it didn't work, the camera flash light didn't come on.   Well, OK, they didn't say what phone they used.   I have found there is trouble with some common phones.  I took it in stride.  It wasn't worth trying to get it approved.

I tried again with a simple app that couldn't possibly go wrong.  Well it did.
I submitted the Tuning Fork App.


Get it on Google Play








The second app, my Note Calculator and Tuning fork, they had this to say:


There were some issues with your application submission: issue#1 -If the user navigates away from the application by pressing the device Home key the application audio can still be heard on the device Home screen. Steps to reproduce: 1. Launch the application 2. Select 'Off', notice the application audio plays 3. Press the device Home key 4. Notice while the user is on the device Home screen the application audio is still generated from the background --- issue#2 - If the user receives a voice call while the application is running the application audio can be heard during the voice call. Steps to reproduce: 1. Launch the application 2. Ensure application audio is playing 3. Receive a voice call 4. Notice the application audio is heard during the voice call --- issue#3 - If the allows an alarm event to be sounded while the application is running, the application audio is heard while the device alarm is running. Steps to reproduce: 1. Launch the application 2. Ensure application audio is playing on the main menu 3. Allow an alarm event to be sounded 4. Notice the application audio is heard while the alarm event is in use --- issue#4 - If the user takes a picture while the application is running, the application audio is heard while the device camera is running. Steps to reproduce: 1. Launch the application 2. Ensure application audio is playing on the main menu 3. Hold the device Home key and select the camera from the recent app list 4. Notice the application audio is heard while the device camera is in use
Please correct the issue(s) we found with your app submission.
When completed, go to the Amazon Appstore Developer Portal to re-submit your application.
If you have any questions about your app, please use the Contact Us link in your Developer Portal account: https://developer.amazon.com/help/contact-us.html.

Sincerely,

Amazon Appstore Account Team
================================

Arrrrgh. I wanted it to work that way!  It is not a bug.  I'm supposed to monitor all events on the phone, and mute my sound if ANY other function requests the audio.!?  I actually designed the app to continue to play when you navigated away from it in case you wanted to use another app at the same time.  Going back to the app you can turn it off.   The LED blinker works this way if you want to take video while the light is flashing.

The next day after writing the app, I decided to use this as a learning experience.  How exactly do I turn off the sound when other things happen.   It must be easier than I thought.

I started by adding this code
--------------------------------------------------------------------------
 @Override
    protected void onPause() {
    super.onDestroy();
    // kill the child thread
    running = false;     }
--------------------------------------------------------------------------

This worked well.   If I hit the home button, or a call came in, the app stopped.  Only problem was when I went back to the app, it thought it was on and the button was pressed, but the sound was off.  A little more housekeeping on the various entry and exit routines fixed the problem.



Added some overrides to clean up when the project starts and stops...
 @Override
   protected void onPause() {
    super.onDestroy();
    // kill the child thread
    running = false;     getWindow().setBackgroundDrawableResource(R.drawable.tuningfork_still);
            mToggle.setChecked(false);
 }

 @Override
 protected void onResume() {
   super.onResume();
   mSensorManager.registerListener(mSensorListener, mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL);
   running = false; getWindow().setBackgroundDrawableResource(R.drawable.tuningfork_still);
        mToggle.setChecked(false);
 }
 @Override
 protected void onStop() {
   mSensorManager.unregisterListener(mSensorListener);
   running = false; getWindow().setBackgroundDrawableResource(R.drawable.tuningfork_still);
        mToggle.setChecked(false);
   super.onStop();
 }
 
The side effect of all this is that if the user sets a tone, gets interrupted, they have to go back and reset the tone.  I'd like the app to remember where it was left.  A little harder but valuable skill.

http://stackoverflow.com/questions/151777/how-do-i-save-an-android-applications-state

Added this code to save the state

@Override    public void onSaveInstanceState(Bundle savedInstanceState) {      // Save UI state changes to the savedInstanceState.      // This bundle will be passed to onCreate if the process is      // killed and restarted.      savedInstanceState.putInt("Pitch", mPitchBar.getProgress());      savedInstanceState.putInt("Note", mSineFreqBar.getProgress());      // etc.      super.onSaveInstanceState(savedInstanceState);    }
@Override
    public void onRestoreInstanceState(Bundle savedInstanceState) {
      super.onRestoreInstanceState(savedInstanceState);
      // Restore UI state from the savedInstanceState.
      // This bundle has also been passed to onCreate.
      int lastPitch = savedInstanceState.getInt("Pitch");
      int lastNote = savedInstanceState.getInt("Note");
    }
It seemed to work under some scenarios, where the user navigated away and came back, but not if the program was destroyed and restarted.  Not perfect but good enough for now.  This is a useful function I need to learn more about for more complicated apps.

Alright you evil Amazon app store flunkie!  I'll admit the app is better now than it was before.  Previously if the tone was playing you could close the app and then not know how to turn off that annoying pitch.   I'll resubmit and see what happens, and update the google play app as well.    I'm betting the Amazon app store will reject it again for some other reason.

Success!  Apparently I've learned that you need to fill out the onPause section of your app.  :)


Appstore Developer Portal Logo 

Congratulations! The following app has been approved and will be included in the Amazon Appstore for Android:
Note Calculator & Tuning Fork
Please note that we may review your app separately for Kindle Fire.
To manage your account details, as well as any marketing material updates for your app, please use the Amazon Appstore Developer Portal. If you have any questions about your app, please use the Contact Us link in your Developer Portal account.
We look forward to doing business with you.
Sincerely,
The Amazon Appstore Account Team
================================



Here is the link,  buy it for free!



I did see that it was listed as compatible with my Droid, but not the Kindle.  Maybe they haven't approved it for that yet.  I will wait and see.

 Meanwhile I looked at some of the other apps of this type, and mine is kind of lame.   Oh well, it was just for fun, and I'm going to try to add note detection and tuning capability.


No comments:

Post a Comment