1. Download our Official Android App: Forums for Android!

Apps Modify existing app...can anyone tell me how to do this?

Discussion in 'Android Development' started by Alibabara, Sep 13, 2016.

  1. Alibabara

    Alibabara Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    9
    Joined:
    Sep 13, 2016

    Sep 13, 2016
    9
    0
    5
    Hello Guys...

    I want to programm an android app for my school project.
    It needs to detect DTMF Sounds and decode it, and depending on which number was dialed, the whole screen should colorize in a specific colour.

    I found an app in the playstore...a DTMF Decoder. https://play.google.com/store/apps/d...ms.dtmfd&hl=de

    so this app already detects and decodes the DTMF signals, and shows which numbers were dialed.

    Unfortunately it forcecloses when there's an active call in the background. I guess because both apps want to access the microphone at the same moment?

    Can someone tell me, if it's possible to use this app as a fundament, and make my desired app based on it? And maybe stop forceclosing it?

    I would be very grateful for any help!

    Best Regards, Alex

     

    Advertisement

  2. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #16
    Points:
    1,488
    Posts:
    6,701
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,701
    9,409
    1,488
    Male
    Software developer
    South West of England
    Reverse engineering an APK is possible, but probably contravenes the terms of use. However, I found this publicly available project, which you could use as a starting point:

    https://github.com/pjasiun/dtmf-decoder
     
  3. mikedt

    mikedt 你好
    Rank:
     #7
    Points:
    2,238
    Posts:
    24,192
    Joined:
    Sep 22, 2010

    Sep 22, 2010
    24,192
    13,298
    2,238
    Teachaaa
    Jinan, China
    Google the Goertzel algorithm, I believe that's what's usually used to decode DTMF. Should be able to find some open source code or libraries that implement it.
     
    Alibabara likes this.
  4. Alibabara

    Alibabara Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    9
    Joined:
    Sep 13, 2016

    Sep 13, 2016
    9
    0
    5
    Thank you guys for your answers! i found this dtmf-decoder project too, and I tested the apk in there. It does the same as the app from the playstore. So I could really use it as a starting point.

    But I honestly don't know much about Android App Development. How do I solve this problem with the forceclose when there is an active call in the background? Because this project-app does have the same issue. I can only think of a conflict between those two apps with the mic.

    I have programmed C++, C# and a little bit of java. So I would be very grateful, when someone can help me with the programming of my desired app...:)

    Thank you for telling me about Goertzel algorithm. it is indeed some useful information!
     
    #4 Alibabara, Sep 13, 2016
    Last edited: Sep 13, 2016
  5. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #16
    Points:
    1,488
    Posts:
    6,701
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,701
    9,409
    1,488
    Male
    Software developer
    South West of England
    Alibabara likes this.
  6. Alibabara

    Alibabara Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    9
    Joined:
    Sep 13, 2016

    Sep 13, 2016
    9
    0
    5
    Thank you, I will inform myself about this Lifecycle, it looks like the right way.

    If another one has any ideas, feel free to reply :)
     
  7. Alibabara

    Alibabara Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    9
    Joined:
    Sep 13, 2016

    Sep 13, 2016
    9
    0
    5
    Hello Guys,

    I played a little bit around with Android Studio and I opened the project of github.com/pjasiun/dtmf-decoder and did absolutely no changes. When I want to run it and install it on my smartphone it forcecloses immediately...

    BUT in the project folder is also an precompiled .apk-file. When I install this apk-file on my smartphone it doesnt forceclose. It works like a charm! Unfortunately it forcescloses too, when there's an active call in the background.

    Has anybody an idea , why my untouched project code can't compile into an .apk which doesn't forceclose???

    Cuz with this fault , I can't even change something and test it out...

    Maybe someone can test it out himself, and see if he has the same fault as me!

    Best Regards, Alex
     
  8. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #16
    Points:
    1,488
    Posts:
    6,701
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,701
    9,409
    1,488
    Male
    Software developer
    South West of England
    Do you get a stack trace in Android Studio? Have you tried running the app in debug mode?
     
  9. Alibabara

    Alibabara Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    9
    Joined:
    Sep 13, 2016

    Sep 13, 2016
    9
    0
    5
    When I try running the app in debug mode I also get an error message and can't compile it to my smartphone.

    I hope you mean this with stack trace, because I'm not sure:

    09-15 23:13:21.702 8429-8429/wpam.recognizer E/Trace: error opening trace file: No such file or directory (2)
    09-15 23:13:21.843 8429-8429/wpam.recognizer E/AndroidRuntime: FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{wpam.recognizer/wpam.recognizer.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "wpam.recognizer.MainActivity" on path: DexPathList[[zip file "/mnt/asec/wpam.recognizer-2/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/wpam.recognizer-2/lib, /vendor/lib, /system/lib]]
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2277)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2403)
    at android.app.ActivityThread.access$600(ActivityThread.java:165)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:194)
    at android.app.ActivityThread.main(ActivityThread.java:5391)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.ClassNotFoundException: Didn't find class "wpam.recognizer.MainActivity" on path: DexPathList[[zip file "/mnt/asec/wpam.recognizer-2/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/wpam.recognizer-2/lib, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1123)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2403)
    at android.app.ActivityThread.access$600(ActivityThread.java:165)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:194)
    at android.app.ActivityThread.main(ActivityThread.java:5391)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
    at dalvik.system.NativeStart.main(Native Method)
     

    Attached Files:

  10. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #16
    Points:
    1,488
    Posts:
    6,701
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,701
    9,409
    1,488
    Male
    Software developer
    South West of England
    Are there any build problems?
    Clean the project and do a complete rebuild

    Build -> Clean build
     
  11. Alibabara

    Alibabara Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    9
    Joined:
    Sep 13, 2016

    Sep 13, 2016
    9
    0
    5
    Thanks for this tip, but in Build there is no "clean build" only:

    - Make module 'dtmf-decoder-master'
    - generate signed APK
    - deploy module to app engine

    I think this is an old eclipse project and I have to migrate it to Android Studio...but I first have to figure out how to do this and have no errors....

    am I right?

    Best Regards
     
  12. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #16
    Points:
    1,488
    Posts:
    6,701
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,701
    9,409
    1,488
    Male
    Software developer
    South West of England
    If I have time tomorrow, I'll try to import that project into AS and see what happens.
     
  13. Alibabara

    Alibabara Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    9
    Joined:
    Sep 13, 2016

    Sep 13, 2016
    9
    0
    5
    Wow that would be very nice from you!! But no hurry, I have unfortunately no time this weekend . So I will look at this thread earliest Monday. :)

    I wish you a nice weekend, and best of luck, if you'll try to import it ;)

    Best Regards, Alex
     
  14. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #16
    Points:
    1,488
    Posts:
    6,701
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,701
    9,409
    1,488
    Male
    Software developer
    South West of England
    So I downloaded the zip file for this project, unpacked it, and imported into Android Studio using

    New -> Import Project

    When I tried to run it on my attached device, AS tried to build the project, but there were problems. The first one was because it's trying to use something called Apphance, but you can remove this import statement from MainActivity.java

    Code (Text):
    1.  
    2. import pl.polidea.apphance.Apphance;
    3.  
    Also comment out this line in MainActivity.java

    Code (Text):
    1.  
    2. Apphance.start(this, APP_KEY);
    3.  
    Second problem is that layout 'menu' is missing 2 layout attributes, so I added those in menu.xml

    Code (Text):
    1.  
    2. <menu xmlns:android="http://schemas.android.com/apk/res/android"
    3.     android:layout_width="wrap_content"
    4.     android:layout_height="wrap_content">
    5.  
    Also remove this comment from SpectrumFragment.java as the compiler goes bananas over those weird characters

    Code (Text):
    1.  
    2. //wyznaczony metod� i�yniersk� mno�nik okre�laj�cy ile razy warto�� musi by� wi�ksza od �redniej, �eby uzna� j� za wa�n�
    3.  
    After these changes, the app compiled successfully, and deployed on my device. It seems to run ok.
     
    Alibabara and mikedt like this.
  15. Alibabara

    Alibabara Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    9
    Joined:
    Sep 13, 2016

    Sep 13, 2016
    9
    0
    5
    Many Thanks LV426!!

    I will Do the Same on monday and hope I have the Same results!

    Have a nice weekend.

    Best Regards, Alex
     
  16. Alibabara

    Alibabara Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    9
    Joined:
    Sep 13, 2016

    Sep 13, 2016
    9
    0
    5
    Hello LV426,

    Thanks to you, I could successfully compile, and run it on my device! It works now exactly as the apk-file in the project!

    Thank you very much!!

    I'm pretty sure the recognition goes on in this programcode of mainactivity.java :


    public int getAudioSource()
    {
    TelephonyManager telephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);

    if (telephonyManager.getCallState() != TelephonyManager.PHONE_TYPE_NONE)
    return MediaRecorder.AudioSource.VOICE_DOWNLINK;

    return MediaRecorder.AudioSource.MIC;
    }


    I already solved the foreclose when there's an active call in the background!

    All I had to do was change this line 'return MediaRecorder.AudioSource.VOICE_DOWNLINK;'
    and replace it with this line 'return MediaRecorder.AudioSource.MIC;'

    so this is there two times. And voilà: the app can recognize the numbers which were dialed in the other phone!

    Now I only have to program an action, that paints the whole screen in a specific color depending on the number dialed.

    If I get stuck there, I will sure let you know..:)

    But for now: many thanks to you LV426!

    Best Regards,

    Alex
     

Share This Page

Loading...