Comments (8)
I got it building in Eclipse, but when I upload it to the phone, when I click send I get the error:
07-29 13:55:50.395: E/AndroidRuntime(15716): FATAL EXCEPTION: main
07-29 13:55:50.395: E/AndroidRuntime(15716): Process: com.android.phone, PID: 15716
07-29 13:55:50.395: E/AndroidRuntime(15716): java.lang.RuntimeException: PhoneFactory.getDefaultPhone must be called from Looper thread
07-29 13:55:50.395: E/AndroidRuntime(15716): at com.android.internal.telephony.PhoneFactory.getDefaultPhone(PhoneFactory.java:191)
07-29 13:55:50.395: E/AndroidRuntime(15716): at net.tomcsanyi.domonkos.SilentSMS$4.run(SilentSMS.java:185)
Apparently to call the phones default phone object it needs to be done on the main thread - does this not happen for you??
from silentsms.
@amlwwalker that is an interesting error, I have struggled with it quite some time, but I'm almost certain I fixed it by changing the way the code works (I call getDefaultPhone from the main thread now).
Did you use the AndroidManifest.xml I provided? Is you APK signed/you have signature verification turned off in CWM?
See this thread for more info
http://stackoverflow.com/questions/2143754/can-a-telephony-phone-object-be-instantiated-through-the-sdk
I haven't touched this code for some time, but I'm not aware of any reason why it shouldn't work.
from silentsms.
Hi @domi007 thanks for getting back to me. Yeah I am using your manifest, although I am using it in Android Studio as Eclipse is a bit buggy I find in comparison.
yeah I looked at your code and it seems that you are calling it from the main thread, but reading around it seemed as though the getDefaultPhone() needs to be called on the thread of the phones Phone object (if you see what I mean - i.e your app isnt making a new one, but borrowing the Phone object of the phone?). Have you got it building (could you try getting it to build??) in Android Studio?
With regards to signature verficiation, do you need to do this when debugging - i.e installing over USB from the dev enviroment? Also I am using Cyanogenmod and I have rooted it. I am not sure whether this is the same as disabling signature verification??
from silentsms.
@amlwwalker I understand what you mean, hence there is a property in the manifest file that should tell Android my app is going to use the Phone system app to borrow the object.
I used Android Studio when I created the app, so it can definitely compile it.
Signature verification: if you read the link I posted above it states that you need to have the APK signed with the system keys (because it acts like a system app so it has the privileges to for example borrow the phone object). For Cyanogenmod these keys are public, so anyone could create a system app - that's what I did. For other ROMs these keys are not public, but there is a way to turn off the signature verification of system apps from ClockWorkMod bootloader as far as I know. Haven't gone down on that way, but it should be possible to make SilentSMS work like that.
Rooting needs to be done so you can re-mount the system partiton as writable and copy the apk to the proper directory.
from silentsms.
Right ok, so looking at that post, this line:
android:sharedUserId="android.uid.phone"
uses the public cyanogenmod key(??) - i.e I dont have to find out what the cyanogenmod key is because as you say its public?
And this line:
android:process="com.android.phone"
says to become a phone system app so it can borrow the object?
from silentsms.
I set sharedUserId to system so it runs as a system app. The process line gives us permission to borrow the phone object I think (probably in real life it gives access to the phone process which can give out the object).
To be able to do all of this it is required to have the APK signed with the system key, or have system signature verification turned off. Based on your response it seems to me you are not really familiar with the concept of signatures and public key cryptography so either read a little bit about it, or just use Cyanogenmod and the signed APK - those should work together just fine.
from silentsms.
Ok thanks, do you have any reference as to what sharedUserId can be set to or where to find out what it can be set to?
I am running cyanogenmod already. I understand the principles of signatures and public key cryptography but not in the light of android Apps. Im not sure how to find the system key and how to sign the app with it. I know that I can sign apps - but when I have done this in the past, i have created my own key
from silentsms.
all right then, here are the Cyanogenmod keys
https://github.com/CyanogenMod/android_build/tree/cm-11.0/target/product/security
Change the branch according to your version. Don't touch the sharedUserId yet - it is probably set to the correct value.
good luck
from silentsms.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from silentsms.