Android Question Amazon Marketplace - "Your app appears to be a ringtone."

Discussion in 'Android Questions' started by TheWind777, Nov 12, 2014.

  1. TheWind777

    TheWind777 Active Member Licensed User

    When I submit my App to be tested at: https://developer.amazon.com/public/solutions/devices/fire-tablets by dropping the APK into the "Easy Android Based Development" window... it goes through the tests and always says:


    "Caution: Ringtones detected"

    "Your app appears to be a ringtone. You can submit your APK without fixing this issue, but your app will not be compatible with Amazon devices."

    Here, another person was having this problem:

    http://support.andromo.com/discussi...lems-with-creating-app-for-amazon-marketplace

    The thing which fixed their problem was:

    "This issue is caused by one of the new tests that Amazon performs now when you submit an app. It is a false positive: they incorrectly assume it is a ringtone app based on that the presence of an API call within the .apk file, even though the API call is never used when ringtones are disabled.

    I have implemented a workaround that solves this issue. I made it so the API call is not included in the app at all unless the app has ringtones enabled. The new version passes the Amazon App Test with no issues."

    In the case of b4a Libraries, I can't either know what API call is the one which they're objecting to - nor can I 'not include that API Call in the app'.

    I could not use that library... but I don't know what library it is that they're referring to.

    It would have to be in one of the sound-related libraries I am using.

    Phone (version: 2.25)

    In the Phone library is the API Call called SetRingerMode and GetRingerMode so that must be it (although there is no website warning anything at all about not using the SetRingerMode function for Fire phones and tablets if you want to be on the Amazon store).

    The functions I'm needing out of that library are:

    SetVolume
    GetVolume
    Manufacturer
    Model
    Product
    GetPhoneType
    GetSimOperator

    The Make and Model information is sent back to me when they report bugs. I suppose I could give those up... but I still definitely need the SetVolume and GetVolume functions.

    Are the SetVolume and GetVolume available in some other library? Or, can I use the Reflection library in some way to set and get the volume (and/or get the phone manufacturer information?)

    -----------------

    Hmmm... I just saw an interesting thing. I wonder if I set

    Phone_Lib.setRingerMode(RINGER_SILENT)

    If that would make a difference?

    Does setting the RingerMode to RINGER_SILENT shut off the speakers, though?

    Questions... questions.
     
  2. mlc

    mlc Active Member Licensed User

  3. TheWind777

    TheWind777 Active Member Licensed User

    Well, I did the modifications to the Phone.jar file and removed the references to the RingManager class and two functions... but it is still doing the same thing.

    Another page:

    http://support.andromo.com/discussi...lems-with-creating-app-for-amazon-marketplace

    mentioned that, "... you didn't set the "Target" option on the "App Info" tab of your project to be "Amazon Appstore: Kindle Fire and Kindle Fire HD".
    Rebuilding your app with that option selected will resolve the issues you're having with your submission to Amazon."

    But I don't see any 'App Info' tab of my project. They are probably talking about Eclipse.

    Is there an #AppInfo or some-such, that can be put into the Project Attributes section or Manifest file?
     
  4. TheWind777

    TheWind777 Active Member Licensed User

    Well, I did the modifications to the Phone.jar file and removed the references to the RingManager class and two functions... but it is still doing the same thing.

    The strange thing is... when I declare LIB_Phone as Phone and then do a LIB_Phone. so it shows me the listing of the available functions - it still lists GetRingTone and SetRingTone() functions.

    I wonder if GetRingerMode and SetRingerMode are ones it doesn't like (probably not GetRingerMode).

    Lets try getting rid of those and recompiling.

    I verified that neither GetRingerMode nor SetRingerMode are in the XML file as a <method>

    I unchecked Phone, shut down, started it up, checked Phone.

    When type LIB_Phone, there they are still. There must be some declaration of them in one of the other classes, maybe?

    How is it still that they're in the list? Isn't the list that is created when you type LIB_Phone with a period at the end of it built from the declarations in the jar's .xml file?

    AHAH! I guess that the Phone library must now be integrated with B24? I had a Phone Library inside my external libraries folder and removed it. Then rebooted B24 and THERE WAS STILL A PHONE LIBRARY.

    What?

    Thus, I must be modifying the wrong phone library file. There must be some embedded-in-B4A Phone library file that I need to modify?

    It can't possibly know there is a phone library if I have completely removed it from the external library area and rebooted B4A unless there is ANOTHER Phone library, version 2.25, somewhere else.

    Yep. There it is.

    C:\Program Files (x86)\Anywhere Software\Basic4android\Libraries

    I'm starting again...

    First I grab the phone.jar and phone.xml and put them in a safe place (Originals folder)

    Next I unpack phone.jar to anywheresoftware folder which contains b4a folder which contains phone folder using 7z.

    In the phone folder I delete RingtoneManagerWrapper$1.class and RingtoneManagerWrapper.class

    I run 7-zip, create archive, on the anywheresoftware folder and choose Archive format zip

    I rename anywheresoftware.zip as phone.jar and agree to the complaint.

    I load Phone.xml into Wordpad.

    I find <class> just before the declaration of
    <name>anywheresoftware.b4a.phone.RingtoneManagerWrapper</name>

    and I put three spaces there so I can find it again.

    I search for </class>, that's the end of the declaration. I highlight from there up to the gap where <class> is and delete that class.

    I delete until there is no gap between

    </class>
    <class>

    Next, I find the two function <method> names...

    I delete this code:

    Code:
    <method>
    <name>GetRingerMode</name>
    <comment>Returns the 
    phone ringer mode.
    Value will be one of the RINGER constants.</comment>
    <returntype>int</returntype>
    </method>
    Leaving no gap between </method> and <method> (probably unnecessary)

    I then search for <name>SetRinger and remove that <method>

    Code:
    <method>
    <name>SetRingerMode</name>
    <comment>Sets the 
    phone ringer mode.
    Mode - One of the RINGER constants.
    Example:&lt;code&gt;
    Dim p As Phone
    p.SetRingerMode(p.RINGER_VIBRATE)&lt;/code&gt;</comment>
    <returntype>void</returntype>
    <parameter>
    <name>Mode</name>
    <
    type>int</type>
    </parameter>
    </method>
    That should do it (let's see if it really does). I now replace the old phone.jar and phone.xml with the new ones in the Libraries folder at C:\Program Files (x86)\Anywhere Software\Basic4android\Libraries

    I'll uncheck Phone in the Libs area, shut down B24, restart it... check phone, recompile, upload to Amazon and see.

    ---

    Just checked and GetRingerMode and SetRingerMode are now GONE, as they should be, when I type LIB_Phone with a dot. Tah-dah. First step done. Bet Amazon will like it now.

    I compile the App to the phone, go to the App's Object folder, open Amazon's webpage:

    https://developer.amazon.com/public/solutions/devices/fire-tablets

    ... and drop the .apk file on their drag-and-drop window under Android-Based Development. Then wait...

    What will be frustrating is, if I upload it and it still gives me the same error. ;)

    And it did...

    Same problem. It, apparently, wasn't those two functions it was looking for... or I didn't extract every last trace of the RingtoneManager. Let me find the listing of what functions are included in the RingtoneManager and see what else might still need to be deleted. I would definitely say that it's some function in the RingtoneManager that is bugging Amazon. Wish they'd tell us which particular API Call that it objects to!

    Well, nothing more in RingtoneManager... Lets check permissions.

    This looks suspect. Lets try removing that.

    It might be the .VIBRATE permission which is causing it.

    Code:
    <class>
    <name>anywheresoftware.b4a.phone.Phone.PhoneVibrate</name>
    <shortname>
    PhoneVibrate</shortname>
    <owner>process</owner>
    <permission>android.permission.VIBRATE</permission>
    <method>
    <name>Vibrate</name>
    <comment>Vibrates the 
    phone for the specified duration.</comment>
    <returntype>void</returntype>
    <parameter>
    <name>ba</name>
    <
    type>anywheresoftware.b4a.BA</type>
    </parameter>
    <parameter>
    <name>TimeMs</name>
    <
    type>long</type>
    </parameter>
    </method>
    </class>
    I delete it out of the xml, uncheck Phone. Save it, quit, copy the new xml over and replace the old, restart, check Phone again. Compile.

    Unfortunately I was using PhoneVibrate, so I will lose that capability if that is what is causing it. It seems like it must be a permission setting, though, that it's objecting to.

    ---

    That's not it either; still gives the same error. Good, I didn't want to lose the capability of using PhoneVibrate (and what does PhoneVibrate have to do with ringtones, anyways). Why is Amazon even worrying about whether one is making an App which is a ringtone?

    So, what does that LEAVE? Not much.
    I wonder if it even has anything to do with the phone library?

    Lets try disabling everything that uses the phone library and submit it (don't you hate when things aren't easy?).

    ... So, I just removed all traces of the Phone library from the App and it worked.

    "Compatibility test successfully completed. We did not find any of the common issues that can prevent an app from being published to the Amazon Appstore"

    So, it still is something that I'm doing.

    I am waking it up when it is in sleep mode. How can that be related to it thinking the App is a ringtone? Do ringtones wake up Apps?

    I have verified, so far, that when you cut out of the xml file GetRingerMode, SetRingerMode, VibratePhone class, WakeLock class, and turn off all uses of the Phone, only keeping the Dim Phone as *** statement... it still says it is a ringtone.

    However, if one completely unchecks Phone and comments-out the Dim statement. It works.

    And... the final test of the day. I removed all the class files for all of those from the .jar file and recompressed it. Still same problem.

    That means that the problem is Amazon seeing some part of the phone library that isn't even being used by me in the App and reacting as if I am using it. Tomorrow I will remove the class definitions one-by-one until the problem stops - that should show which one is doing it.

    Very weird.
     
    Last edited: Nov 13, 2014
  5. TheWind777

    TheWind777 Active Member Licensed User

    OK. Started-over with a fresh .xml and fresh .jar

    Removed RingtoneManagerWrapper$1.class and RingtoneManagerwrapper.class from the jar's phone folder. Removed just the SetRingerMode() <method> from the xml file. Bumped the Version number of the Phone library to 2.26. Compacted the jar, copied the jar and xml to C:\Program Files (x86)\Anywhere Software\Basic4android\Libraries folder. Had already unchecked Phone from my Project and saved without Phone loaded. Loaded b4a back in. Checked Phone radio button in Libs. Loaded, said Version 2.26. Compiled, sent apk to Amazon.

    Tah-dah.

    "Compatibility test successfully completed. We did not find any of the common issues that can prevent an app from being published to the Amazon Appstore".

    I was tired yesterday. Anyways... you can at least see the process one uses to modify a jar file, that you can remove any <class> from the xml from <class> to </class>. If you do, also delete it from the jar file (making sure there are no other classes that use that class).

    Here is the finished Amazon Phone library. With it you will be able to use most of the functionality of the Phone library. However, you will have changed the phone library forever and if you ever upgrade to a new version of B4a, it will wipe that version out. And, Erel might bump his next version number and give it a version of 2.26. WARNINGS. Make sure you put the original Phone.jar and Phone.xml in a good backup place (not in either the Libraries folder, or your secondary libraries folder. Make sure you remove any other versions of the Phone library you might have in your external Libraries folder.
     

    Attached Files:

    jmon likes this.
  6. Turbo3

    Turbo3 Active Member Licensed User

    Looks like erel has updated the Phone library to 2.26.

    Any chance you could create a new one based on 2.26 without the Ringtone code for those of us uploading to Amazon?
     
  7. Dave O

    Dave O Active Member Licensed User

    FYI, in B4A 5.8 and later, we can now explicitly exclude the RingToneManager from our apps by including this line in our "Region Module Attributes":

    Code:
    #ExcludeClasses: anywheresoftware.b4a.phone.RingtoneManager
     
    Last edited: Feb 26, 2016
    Erel and jmon like this.
  8. Erel

    Erel Administrator Staff Member Licensed User

    Note that you only need to add it to the main module.
     
    jmon and Dave O like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice