• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

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

Alibabara

Lurker
Sep 13, 2016
9
0
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
 
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!
 
Last edited:
Upvote 0
Well I don't know for sure what's happening with your app, but it's probably a good idea to review the app lifecycle. The system gives you various methods to control this, and if you implement them in your Activity, you can customise what happens to your app.

https://developer.android.com/training/basics/activity-lifecycle/index.html


android_application_life_cycle.gif
 
  • Like
Reactions: Alibabara
Upvote 0
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
 
Upvote 0
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)
 

Attachments

  • Unbenannt.JPG
    Unbenannt.JPG
    28.9 KB · Views: 40
Upvote 0
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
 
Upvote 0
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:
import pl.polidea.apphance.Apphance;

Also comment out this line in MainActivity.java

Code:
Apphance.start(this, APP_KEY);

Second problem is that layout 'menu' is missing 2 layout attributes, so I added those in menu.xml

Code:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

Also remove this comment from SpectrumFragment.java as the compiler goes bananas over those weird characters

Code:
//wyznaczony metod� i�yniersk� mno�nik okre�laj�cy ile razy warto�� musi by� wi�ksza od �redniej, �eby uzna� j� za wa�n�

After these changes, the app compiled successfully, and deployed on my device. It seems to run ok.
 
Upvote 0
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
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones